Add NewFileIndex
This commit is contained in:
@@ -86,11 +86,11 @@ Public Class EDMService
|
||||
_request.LogDebug($"ReturnDatatable, SQL: {SQL}")
|
||||
|
||||
Dim oResult As DataTable = Database.GetDatatableWithConnection(SQL, _request.Connection)
|
||||
Return New TableResult(True, oResult, Nothing)
|
||||
Return New TableResult(oResult)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
_request.LogError(ex.Message)
|
||||
Return New TableResult(False, Nothing, ex.Message)
|
||||
Return New TableResult(ex.Message)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
@@ -102,11 +102,11 @@ Public Class EDMService
|
||||
_request.LogDebug($"ReturnScalar, SQL: {SQL}")
|
||||
|
||||
Dim oResult As Object = Database.GetScalarValueWithConnection(SQL, _request.Connection)
|
||||
Return New ScalarResult(True, oResult, Nothing)
|
||||
Return New ScalarResult(oResult)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
_request.LogError(ex.Message)
|
||||
Return New ScalarResult(False, Nothing, ex.Message)
|
||||
Return New ScalarResult(ex.Message)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
@@ -118,24 +118,24 @@ Public Class EDMService
|
||||
_request.LogDebug($"ExecuteNonQuery, SQL: {SQL}")
|
||||
|
||||
Dim oResult As Boolean = Database.ExecuteNonQueryWithConnection(SQL, _request.Connection)
|
||||
Return New NonQueryResult(True, Nothing)
|
||||
Return New NonQueryResult()
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
_request.LogError(ex.Message)
|
||||
Return New NonQueryResult(False, ex.Message)
|
||||
Return New NonQueryResult(ex.Message)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
|
||||
#End Region
|
||||
#Region "Document"
|
||||
Public Function CreateFile(FileName As String, Contents() As Byte) As DocumentResult Implements IEDMService.CreateFile
|
||||
Public Function NewFile(FileName As String, Contents() As Byte) As DocumentResult Implements IEDMService.NewFile
|
||||
Try
|
||||
Dim oContainer As FileContainer
|
||||
Dim oContainerId As String
|
||||
|
||||
If Not TestUserAuth() Then
|
||||
Throw New Exception("User not authorized")
|
||||
Throw New Exception($"User {_username} not authorized.")
|
||||
End If
|
||||
|
||||
oContainer = FileContainer.Create(LogConfig, AppConfig.ContainerPassword)
|
||||
@@ -160,9 +160,8 @@ Public Class EDMService
|
||||
|
||||
_logger.Debug("File saved in Container!", FileName)
|
||||
|
||||
Return New DocumentResult() With {
|
||||
.Document = New DocumentObject(oContainerId, oDocId, FileName)
|
||||
}
|
||||
Dim oDocument = New DocumentObject(oContainerId, oDocId, FileName)
|
||||
Return New DocumentResult(oDocument)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return New DocumentResult(ex.Message)
|
||||
@@ -181,9 +180,8 @@ Public Class EDMService
|
||||
oFileContainer.SetFile(Contents, oFileContainer.GetFile.FileName)
|
||||
oFileContainer.Save()
|
||||
|
||||
Return New DocumentResult() With {
|
||||
.Document = DocObject
|
||||
}
|
||||
|
||||
Return New DocumentResult(DocObject)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return Nothing
|
||||
@@ -198,10 +196,7 @@ Public Class EDMService
|
||||
Dim oContainer As FileContainer = FileContainer.Load(LogConfig, AppConfig.ContainerPassword, oContainerPath)
|
||||
Dim oContents As Byte() = oContainer.GetFile().Contents
|
||||
|
||||
Return New DocumentResult With {
|
||||
.Document = DocObject,
|
||||
.Contents = oContents
|
||||
}
|
||||
Return New DocumentResult(DocObject, oContents)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return New DocumentResult(ex.Message)
|
||||
@@ -224,7 +219,6 @@ Public Class EDMService
|
||||
End Try
|
||||
End Function
|
||||
|
||||
|
||||
Private Function GetContainerPath(ContainerId As String) As String
|
||||
Return Path.Combine(AppConfig.ContainerPath, GetContainerName(ContainerId))
|
||||
End Function
|
||||
@@ -243,8 +237,16 @@ Public Class EDMService
|
||||
#End Region
|
||||
|
||||
#Region "Index"
|
||||
Public Function SetFileIndex(DocObject As DocumentObject, Syskey As String, Value As String) As Object Implements IEDMService.SetFileIndex
|
||||
Throw New NotImplementedException()
|
||||
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 oIndexId As Int64 = Database.GetScalarValue(oSQL)
|
||||
|
||||
Return New IndexResult(oIndexId)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return New IndexResult(ex.Message)
|
||||
End Try
|
||||
End Function
|
||||
#End Region
|
||||
End Class
|
||||
Reference in New Issue
Block a user