EDMI.API: Clean up Client
This commit is contained in:
@@ -7,7 +7,6 @@ Imports System.IO
|
||||
Public Class Client
|
||||
Private ReadOnly _logger As Logger
|
||||
Private ReadOnly _channelFactory As ChannelFactory(Of IEDMIServiceChannel)
|
||||
Private _ServiceAddress As String
|
||||
Private _IPAddressServer As String
|
||||
Private _channel As IEDMIServiceChannel
|
||||
|
||||
@@ -34,7 +33,6 @@ Public Class Client
|
||||
_logger = LogConfig.GetLogger()
|
||||
|
||||
Try
|
||||
_ServiceAddress = ServiceAdress
|
||||
Dim oBinding = Channel.GetBinding()
|
||||
Dim oAddress = New EndpointAddress(ServiceAdress)
|
||||
Dim oFactory = New ChannelFactory(Of IEDMIServiceChannel)(oBinding, oAddress)
|
||||
@@ -281,41 +279,56 @@ Public Class Client
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
Public Function NewFileStoreObject(IDB_OBJ_ID As Long, pStoreType As String, pDate As String, pExtension As String, pKeepExtension As String) As String
|
||||
|
||||
Public Function CreateObjectId(pKindType As String, pWho As String, pBusinessEntity As String) As Long
|
||||
Try
|
||||
Dim oArgs As New NewObjectIdRequest With {
|
||||
.KindType = pKindType,
|
||||
.BusinessEntity = pBusinessEntity,
|
||||
.Who = pWho
|
||||
}
|
||||
Dim oResponse = _channel.NewObjectId(oArgs)
|
||||
Return oResponse.ObjectId
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function CreateFileStoreObject(pObjectId As Long, pStoreType As String, pDate As String, pExtension As String, pKeepExtension As String) As String
|
||||
Try
|
||||
' Remove dot in Extension
|
||||
If pExtension.StartsWith(".") Then
|
||||
pExtension = pExtension.Replace(".", "")
|
||||
pExtension = pExtension.Substring(1)
|
||||
End If
|
||||
Dim oResponse = _channel.New_FileStore_Object(IDB_OBJ_ID, pStoreType, pDate, pExtension, pKeepExtension)
|
||||
Return oResponse
|
||||
|
||||
Dim oArgs As New NewFileObjectRequest With {
|
||||
.ObjectId = pObjectId,
|
||||
.StoreType = pStoreType,
|
||||
.DateImported = pDate,
|
||||
.Extension = pExtension,
|
||||
.KeepExtension = pKeepExtension
|
||||
}
|
||||
Dim oResponse = _channel.NewFileObject(oargs)
|
||||
Return oResponse.FileObjectPath
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
Public Function NewIDB_OBJ_ID(pKindType As String, pWho As String, pBusinessEntity As String) As Long
|
||||
Try
|
||||
Dim oResponse = _channel.New_IDB_OBJECT(pKindType, pWho, pBusinessEntity)
|
||||
Return oResponse
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
Public Async Function ImportIDBFOAsync(pContent As Byte(), pWho As String, pIDB_OBJ_ID As Long, pObjectStoreID As Short, pIDBFOPath As String) As Task(Of Boolean)
|
||||
Try
|
||||
Dim oData As New DocumentImportIDBFORequest() With {
|
||||
.Contents = pContent,
|
||||
.pWho = pWho,
|
||||
.pIDBFilePath = pIDBFOPath,
|
||||
.pIDB_OBJ_ID = pIDB_OBJ_ID,
|
||||
.pObjectStoreID = pObjectStoreID
|
||||
}
|
||||
|
||||
Dim oResponse = Await _channel.ImportNewIDBFOAsync(oData)
|
||||
Public Async Function ImportFileObjectAsync(pContent As Byte(), pWho As String, pObjectId As Long, pObjectStoreID As Short, pFileObjectPath As String) As Task(Of Boolean)
|
||||
Try
|
||||
Dim oData As New ImportFileIntoFileObjectRequest() With {
|
||||
.Contents = pContent,
|
||||
.pWho = pWho,
|
||||
.pIDBFilePath = pFileObjectPath,
|
||||
.pIDB_OBJ_ID = pObjectId,
|
||||
.pObjectStoreID = pObjectStoreID
|
||||
}
|
||||
|
||||
Dim oResponse = Await _channel.ImportFileIntoFileObjectAsync(oData)
|
||||
Return oResponse.Result
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return False
|
||||
|
||||
Reference in New Issue
Block a user