Get DocumentObject from DocId or ContainerId
This commit is contained in:
@@ -3,6 +3,7 @@ Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Filesystem
|
||||
Imports System.IO
|
||||
Imports DigitalData.Services.EDMService
|
||||
|
||||
<ServiceBehavior(InstanceContextMode:=InstanceContextMode.PerSession)>
|
||||
Public Class EDMService
|
||||
@@ -236,10 +237,56 @@ Public Class EDMService
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region "Utils"
|
||||
Public Function GetDocumentByDocumentId(DocumentId As Long) As DocumentResult Implements IEDMService.GetDocumentByDocumentId
|
||||
Try
|
||||
Dim oSQL = $"SELECT GUID, CONTAINER_ID, ORIGINAL_FILENAME FROM TBICM_DOCUMENT WHERE GUID = {DocumentId}"
|
||||
Dim oTable = Database.GetDatatable(oSQL)
|
||||
|
||||
If oTable.Rows.Count = 0 Then
|
||||
Return New DocumentResult("Document not found")
|
||||
End If
|
||||
|
||||
Dim oRow As DataRow = oTable.Rows.Item(0)
|
||||
Dim oDocument As New DocumentObject(
|
||||
oRow.Item("CONTAINER_ID"),
|
||||
oRow.Item("GUID"),
|
||||
oRow.Item("ORIGINAL_FILENAME")
|
||||
)
|
||||
|
||||
Return New DocumentResult(oDocument)
|
||||
Catch ex As Exception
|
||||
Return New DocumentResult(ex.Message)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function GetDocumentByContainerId(ContainerId As String) As DocumentResult Implements IEDMService.GetDocumentByContainerId
|
||||
Try
|
||||
Dim oSQL = $"SELECT GUID, CONTAINER_ID, ORIGINAL_FILENAME FROM TBICM_DOCUMENT WHERE CONTAINER_ID = '{ContainerId}'"
|
||||
Dim oTable = Database.GetDatatable(oSQL)
|
||||
|
||||
If oTable.Rows.Count = 0 Then
|
||||
Return New DocumentResult("Document not found")
|
||||
End If
|
||||
|
||||
Dim oRow As DataRow = oTable.Rows.Item(0)
|
||||
Dim oDocument As New DocumentObject(
|
||||
oRow.Item("CONTAINER_ID"),
|
||||
oRow.Item("GUID"),
|
||||
oRow.Item("ORIGINAL_FILENAME")
|
||||
)
|
||||
|
||||
Return New DocumentResult(oDocument)
|
||||
Catch ex As Exception
|
||||
Return New DocumentResult(ex.Message)
|
||||
End Try
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
#Region "Index"
|
||||
Public Function NewFileIndex(DocObject As DocumentObject, Syskey As String, LanguageCode As String, Value As String) As IndexResult Implements IEDMService.NewFileIndex
|
||||
Try
|
||||
Dim oSQL = $"SELECT FNICM_NEW_OBJECT_VALUE({DocObject.DocumentId},'{Syskey}','{LanguageCode}','{Value}','{_username}') FROM RDB$DATABASE;"
|
||||
Dim oSQL = $"SELECT FNICM_NEW_DOC_VALUE({DocObject.DocumentId},'{Syskey}','{LanguageCode}','{Value}','{_username}') FROM RDB$DATABASE;"
|
||||
Dim oIndexId As Int64 = Database.GetScalarValue(oSQL)
|
||||
|
||||
Return New IndexResult(oIndexId)
|
||||
|
||||
Reference in New Issue
Block a user