EDMIAPI: Improve Service an Client, Revert some changed function names
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
Imports System.IO
|
||||
Imports System.ServiceModel
|
||||
Imports System.Timers
|
||||
Imports DigitalData.Modules.EDMI.API.Constants
|
||||
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
||||
Imports DigitalData.Modules.EDMI.API.Rights
|
||||
@@ -7,78 +8,34 @@ Imports DigitalData.Modules.Language.Utils
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class Client
|
||||
' Constants
|
||||
Private Const UPDATE_INTERVAL_IN_MINUTES As Integer = 1
|
||||
Public Const INVALID_OBEJCT_ID As Long = 0
|
||||
Private Const KIND_TYPE_DOC = "DOC"
|
||||
|
||||
Private ReadOnly _LogConfig As LogConfig
|
||||
Private ReadOnly _logger As Logger
|
||||
Private ReadOnly _channelFactory As ChannelFactory(Of IEDMIServiceChannel)
|
||||
Private ReadOnly _IPAddressServer As String
|
||||
Private ReadOnly _PortServer As Integer
|
||||
Private ReadOnly _FileEx As Filesystem.File
|
||||
Private _channel As IEDMIServiceChannel
|
||||
' Helper Classes
|
||||
Private ReadOnly LogConfig As LogConfig
|
||||
Private ReadOnly Logger As Logger
|
||||
Private ReadOnly FileEx As Filesystem.File
|
||||
|
||||
''' <summary>
|
||||
''' Creates a new EDMI Client object
|
||||
''' </summary>
|
||||
''' <param name="pLogConfig">LogConfig object</param>
|
||||
''' <param name="pServiceAdress">The IP address/hostname and port, separated by semicolon or colon, ex. 1.2.3.4:9000</param>
|
||||
Public Sub New(pLogConfig As LogConfig, pServiceAdress As String)
|
||||
_LogConfig = pLogConfig
|
||||
_logger = pLogConfig.GetLogger()
|
||||
_FileEx = New Filesystem.File(pLogConfig)
|
||||
' Runtime Variables
|
||||
Private ReadOnly ServerAddress As String
|
||||
Private ReadOnly ServerPort As Integer
|
||||
|
||||
Dim oServiceAddress As String = pServiceAdress
|
||||
Dim oAddressArray() As String
|
||||
' Channel
|
||||
Private ReadOnly ChannelFactory As ChannelFactory(Of IEDMIServiceChannel)
|
||||
Private Channel As IEDMIServiceChannel
|
||||
|
||||
If oServiceAddress.Contains(";") Then
|
||||
oAddressArray = oServiceAddress.Split(";")
|
||||
Else
|
||||
oAddressArray = oServiceAddress.Split(":")
|
||||
End If
|
||||
' Update Timer
|
||||
Private WithEvents UpdateTimer As New Timers.Timer
|
||||
|
||||
Try
|
||||
_IPAddressServer = oAddressArray(0)
|
||||
_PortServer = oAddressArray(1)
|
||||
|
||||
Dim oBinding = Channel.GetBinding()
|
||||
Dim oAddress = New EndpointAddress($"net.tcp://{_IPAddressServer}:{_PortServer}/DigitalData/Services/Main")
|
||||
Dim oFactory = New ChannelFactory(Of IEDMIServiceChannel)(oBinding, oAddress)
|
||||
|
||||
_channelFactory = oFactory
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Creates a new EDMI Client object
|
||||
''' </summary>
|
||||
''' <param name="LogConfig">LogConfig object</param>
|
||||
''' <param name="IPAddress">The IP address to connect to</param>
|
||||
''' <param name="PortNumber">The Port number to use for the connection</param>
|
||||
Public Sub New(LogConfig As LogConfig, IPAddress As String, PortNumber As Integer)
|
||||
_LogConfig = LogConfig
|
||||
_logger = LogConfig.GetLogger()
|
||||
_FileEx = New Filesystem.File(LogConfig)
|
||||
|
||||
Try
|
||||
_IPAddressServer = IPAddress
|
||||
Dim oBinding = Channel.GetBinding()
|
||||
Dim oAddress = New EndpointAddress($"net.tcp://{IPAddress}:{PortNumber}/DigitalData/Services/Main")
|
||||
Dim oFactory = New ChannelFactory(Of IEDMIServiceChannel)(oBinding, oAddress)
|
||||
|
||||
_channelFactory = oFactory
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
' Public Variables
|
||||
Public CachedTables As New List(Of String)
|
||||
|
||||
''' <summary>
|
||||
''' Parse a IPAddress:Port String into its parts
|
||||
''' </summary>
|
||||
''' <param name="AddressWithOptionalPort"></param>
|
||||
''' <returns></returns>
|
||||
Public Shared Function ParseServiceAddress(AddressWithOptionalPort As String) As Tuple(Of String, Integer)
|
||||
Dim oSplit() As String = AddressWithOptionalPort.Split(":"c)
|
||||
Dim oAppServerAddress As String = oSplit(0)
|
||||
@@ -95,22 +52,81 @@ Public Class Client
|
||||
Return New Tuple(Of String, Integer)(oAppServerAddress, oAppServerPort)
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Creates a new EDMI Client object
|
||||
''' </summary>
|
||||
''' <param name="pLogConfig">LogConfig object</param>
|
||||
''' <param name="pServiceAdress">The IP address/hostname and port, separated by semicolon or colon, ex. 1.2.3.4:9000</param>
|
||||
Public Sub New(pLogConfig As LogConfig, pServiceAdress As String)
|
||||
LogConfig = pLogConfig
|
||||
Logger = pLogConfig.GetLogger()
|
||||
FileEx = New Filesystem.File(pLogConfig)
|
||||
|
||||
Dim oServiceAddress As String = pServiceAdress
|
||||
Dim oAddressArray() As String
|
||||
|
||||
If oServiceAddress.Contains(";") Then
|
||||
oAddressArray = oServiceAddress.Split(";")
|
||||
Else
|
||||
oAddressArray = oServiceAddress.Split(":")
|
||||
End If
|
||||
|
||||
UpdateTimer.Interval = 60 * 1000 * UPDATE_INTERVAL_IN_MINUTES
|
||||
UpdateTimer.Start()
|
||||
|
||||
Try
|
||||
ServerAddress = oAddressArray(0)
|
||||
ServerPort = oAddressArray(1)
|
||||
|
||||
Dim oBinding = API.Channel.GetBinding()
|
||||
Dim oAddress = New EndpointAddress($"net.tcp://{ServerAddress}:{ServerPort}/DigitalData/Services/Main")
|
||||
Dim oFactory = New ChannelFactory(Of IEDMIServiceChannel)(oBinding, oAddress)
|
||||
|
||||
ChannelFactory = oFactory
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Creates a new EDMI Client object
|
||||
''' </summary>
|
||||
''' <param name="LogConfig">LogConfig object</param>
|
||||
''' <param name="IPAddress">The IP address to connect to</param>
|
||||
''' <param name="PortNumber">The Port number to use for the connection</param>
|
||||
Public Sub New(LogConfig As LogConfig, IPAddress As String, PortNumber As Integer)
|
||||
Me.LogConfig = LogConfig
|
||||
Logger = LogConfig.GetLogger()
|
||||
FileEx = New Filesystem.File(LogConfig)
|
||||
|
||||
Try
|
||||
ServerAddress = IPAddress
|
||||
Dim oBinding = API.Channel.GetBinding()
|
||||
Dim oAddress = New EndpointAddress($"net.tcp://{IPAddress}:{PortNumber}/DigitalData/Services/Main")
|
||||
Dim oFactory = New ChannelFactory(Of IEDMIServiceChannel)(oBinding, oAddress)
|
||||
|
||||
ChannelFactory = oFactory
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Connect to the service
|
||||
''' </summary>
|
||||
''' <returns>True if connection was successful, false otherwise</returns>
|
||||
Public Function Connect() As Boolean
|
||||
Try
|
||||
_channel = GetChannel()
|
||||
Channel = GetChannel()
|
||||
|
||||
_logger.Debug("Opening channel..")
|
||||
_channel.Open()
|
||||
Logger.Debug("Opening channel..")
|
||||
Channel.Open()
|
||||
|
||||
_logger.Info($"Connection to AppService {_IPAddressServer} successfully established!")
|
||||
Logger.Info($"Connection to AppService {ServerAddress} successfully established!")
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
@@ -119,17 +135,29 @@ Public Class Client
|
||||
''' Aborts the channel and creates a new connection
|
||||
''' </summary>
|
||||
Public Sub Reconnect()
|
||||
_logger.Warn("Connection faulted. Trying to reconnect..")
|
||||
Logger.Warn("Connection faulted. Trying to reconnect..")
|
||||
|
||||
Try
|
||||
_channel.Abort()
|
||||
_channel = GetChannel()
|
||||
_channel.Open()
|
||||
Channel.Abort()
|
||||
Channel = GetChannel()
|
||||
Channel.Open()
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Async Function UpdateTimer_Elapsed(sender As Object, e As ElapsedEventArgs) As Task Handles UpdateTimer.Elapsed
|
||||
Try
|
||||
Dim oTables As String() = Await Channel.GetCachedTablesAsync()
|
||||
CachedTables = oTables.
|
||||
Select(Function(table) table.ToUpper).
|
||||
ToList()
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
CachedTables = New List(Of String)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Imports a file from a filepath, creating a IDB ObjectId and Filesystem Object
|
||||
''' </summary>
|
||||
@@ -157,7 +185,7 @@ Public Class Client
|
||||
Dim oFileName As String = oFileInfo.Name
|
||||
Dim oFileCreatedAt As Date = oFileInfo?.CreationTime
|
||||
Dim oFileModifiedAt As Date = oFileInfo?.LastWriteTime
|
||||
Dim oFileHash As String = _FileEx.GetChecksum(oFileInfo.FullName)
|
||||
Dim oFileHash As String = FileEx.GetChecksum(oFileInfo.FullName)
|
||||
|
||||
' Importing the file now
|
||||
Using oFileStream As New FileStream(pFilePath, FileMode.Open, FileAccess.Read)
|
||||
@@ -165,7 +193,7 @@ Public Class Client
|
||||
oFileStream.CopyTo(oMemoryStream)
|
||||
Dim oContents = oMemoryStream.ToArray()
|
||||
|
||||
Dim oFileImportResponse = Await _channel.NewFileAsync(New NewFileRequest With {
|
||||
Dim oFileImportResponse = Await Channel.NewFileAsync(New NewFileRequest With {
|
||||
.BusinessEntity = pBusinessEntity,
|
||||
.File = New FileProperties With {
|
||||
.FileName = oFileInfo.Name,
|
||||
@@ -191,7 +219,7 @@ Public Class Client
|
||||
End Using
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Logger.Error(ex)
|
||||
Return INVALID_OBEJCT_ID
|
||||
End Try
|
||||
End Function
|
||||
@@ -205,32 +233,32 @@ Public Class Client
|
||||
pBusinessEntity As String,
|
||||
Optional pImportOptions As Options.ImportFileOptions = Nothing) As Task(Of ImportFileResponse)
|
||||
Try
|
||||
Dim oImportFile As New Modules.Globix.ImportFile(_LogConfig, _channel)
|
||||
Dim oImportFile As New Modules.Globix.ImportFile(LogConfig, Channel)
|
||||
Return Await oImportFile.RunAsync(pFilePath, pProfileId, pAttributeValues, pObjectStoreName, pObjectKind, pBusinessEntity, pImportOptions)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function Zooflow_GetFileObject(pObjectId As Long, pLoadFileContents As Boolean) As FileObject
|
||||
Try
|
||||
Dim oGetFileObject As New Modules.Zooflow.GetFileObject(_LogConfig, _channel)
|
||||
Dim oGetFileObject As New Modules.Zooflow.GetFileObject(LogConfig, Channel)
|
||||
Dim oFileObject = oGetFileObject.Run(pObjectId, pLoadFileContents)
|
||||
Return oFileObject
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Async Function GetFileObjectAsync(pObjectId As Long, pLoadFileContents As Boolean) As Task(Of FileObject)
|
||||
Try
|
||||
Dim oGetFileObject As New Modules.Zooflow.GetFileObject(_LogConfig, Me)
|
||||
Dim oGetFileObject As New Modules.Zooflow.GetFileObject(LogConfig, Me)
|
||||
Dim oFileObject = Await oGetFileObject.RunAsync(pObjectId, pLoadFileContents)
|
||||
Return oFileObject
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
@@ -256,13 +284,13 @@ Public Class Client
|
||||
}
|
||||
|
||||
Try
|
||||
Dim oResponse = _channel.TestObjectIdExists(New TestObjectIdExistsRequest With {.ObjectId = pObjectId})
|
||||
Dim oResponse = Channel.TestObjectIdExists(New TestObjectIdExistsRequest With {.ObjectId = pObjectId})
|
||||
If oResponse.Exists = False Then
|
||||
Return False
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
|
||||
@@ -287,7 +315,7 @@ Public Class Client
|
||||
For Each oRow As DataRow In oTable.Rows
|
||||
Dim oExists As Boolean = False
|
||||
For Each oNewValueRow As DataRow In oValueTable.Rows
|
||||
_logger.Debug($"Checking oldValue[{oCurrentValue}] vs NewValue [{oNewValueRow.Item(1)}]")
|
||||
Logger.Debug($"Checking oldValue[{oCurrentValue}] vs NewValue [{oNewValueRow.Item(1)}]")
|
||||
|
||||
If oNewValueRow.Item(1).ToString.ToUpper = oRow.Item(0).ToString.ToUpper Then
|
||||
oExists = True
|
||||
@@ -296,7 +324,7 @@ Public Class Client
|
||||
Next
|
||||
|
||||
If oExists = False Then
|
||||
_logger.Debug($"Value [{oRow.Item(0)}] no longer existing in Vector-Attribute [{pAttributeName}] - will be deleted!")
|
||||
Logger.Debug($"Value [{oRow.Item(0)}] no longer existing in Vector-Attribute [{pAttributeName}] - will be deleted!")
|
||||
DeleteTermObjectFromMetadata(pObjectId, pAttributeName, oRow.Item(0))
|
||||
End If
|
||||
|
||||
@@ -308,7 +336,7 @@ Public Class Client
|
||||
'now Checking whether the old row still remains in Vector? If not it will be deleted as it cannot be replaced in multivalues
|
||||
Dim oExists As Boolean = False
|
||||
For Each oNewValueRow As DataRow In oValueTable.Rows
|
||||
_logger.Debug($"Checking oldValue[{oCurrentValue}] vs NewValue [{oNewValueRow.Item(1)}]")
|
||||
Logger.Debug($"Checking oldValue[{oCurrentValue}] vs NewValue [{oNewValueRow.Item(1)}]")
|
||||
|
||||
If oNewValueRow.Item(1).ToString.ToUpper = oCurrentValue.ToString.ToUpper Then
|
||||
oExists = True
|
||||
@@ -317,12 +345,12 @@ Public Class Client
|
||||
|
||||
Next
|
||||
If oExists = False Then
|
||||
_logger.Debug($"Value [{oCurrentValue}] no longer existing in Vector-Attribute [{pAttributeName}] - will be deleted!")
|
||||
Logger.Debug($"Value [{oCurrentValue}] no longer existing in Vector-Attribute [{pAttributeName}] - will be deleted!")
|
||||
DeleteTermObjectFromMetadata(pObjectId, pAttributeName, oCurrentValue.Value)
|
||||
End If
|
||||
|
||||
Else
|
||||
_logger.Debug($"Value [{oCurrentValue}] of Attribute [{pAttributeName}] obviously was updated during runtime - will be deleted!")
|
||||
Logger.Debug($"Value [{oCurrentValue}] of Attribute [{pAttributeName}] obviously was updated during runtime - will be deleted!")
|
||||
DeleteTermObjectFromMetadata(pObjectId, pAttributeName, oCurrentValue.Value)
|
||||
|
||||
End If
|
||||
@@ -348,7 +376,7 @@ Public Class Client
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
@@ -367,14 +395,14 @@ Public Class Client
|
||||
|
||||
' Check if ObjectId exists
|
||||
Try
|
||||
Dim oResponse = _channel.TestObjectIdExists(New TestObjectIdExistsRequest With {.ObjectId = pObjectId})
|
||||
Dim oResponse = Channel.TestObjectIdExists(New TestObjectIdExistsRequest With {.ObjectId = pObjectId})
|
||||
If oResponse.Exists = False Then
|
||||
Return New VariableValue()
|
||||
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Logger.Error(ex)
|
||||
Return New VariableValue()
|
||||
|
||||
End Try
|
||||
@@ -407,7 +435,7 @@ Public Class Client
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Logger.Error(ex)
|
||||
Return New VariableValue()
|
||||
|
||||
End Try
|
||||
@@ -452,7 +480,7 @@ Public Class Client
|
||||
Return oAttributeValue
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
|
||||
End Try
|
||||
@@ -462,7 +490,7 @@ Public Class Client
|
||||
Dim oAttributes As New List(Of ObjectAttribute)
|
||||
|
||||
Try
|
||||
Dim oResult As TableResult = _channel.ReturnDatatable_MSSQL_IDB($"EXEC [PRIDB_GET_VALUE_DT] {pObjectId}, '{pLanguage}'")
|
||||
Dim oResult As TableResult = Channel.ReturnDatatable_MSSQL_IDB($"EXEC [PRIDB_GET_VALUE_DT] {pObjectId}, '{pLanguage}'")
|
||||
|
||||
If oResult.OK = False Then
|
||||
Throw New ApplicationException(oResult.ErrorMessage)
|
||||
@@ -488,7 +516,7 @@ Public Class Client
|
||||
|
||||
Return oAttributes
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
@@ -503,11 +531,11 @@ Public Class Client
|
||||
|
||||
Dim oSql = $"DECLARE @NEW_OBJ_MD_ID BIGINT
|
||||
EXEC PRIDB_NEW_OBJ_DATA({pObjectId}, '{pAttributeName}', '{oUsername}', '{pValue}', '{oLanguage}', 0, @OMD_ID = @NEW_OBJ_MD_ID OUTPUT)"
|
||||
Dim oResult = _channel.ExecuteNonQuery_MSSQL_IDB(oSql)
|
||||
Dim oResult = Channel.ExecuteNonQuery_MSSQL_IDB(oSql)
|
||||
|
||||
If oResult.OK = False Then
|
||||
_logger.Warn("Error while deleting Term object")
|
||||
_logger.Error(oResult.ErrorMessage)
|
||||
Logger.Warn("Error while deleting Term object")
|
||||
Logger.Error(oResult.ErrorMessage)
|
||||
End If
|
||||
|
||||
Return oResult.OK
|
||||
@@ -520,92 +548,92 @@ Public Class Client
|
||||
|
||||
Dim oIdIsForeign As Integer = 1
|
||||
Dim oDELSQL = $"EXEC PRIDB_DELETE_TERM_OBJECT_METADATA {pObjectId},'{pAttributeName}','{pTerm2Delete}','{oUsername}','{oLanguage}',{oIdIsForeign}"
|
||||
Dim oResult = _channel.ExecuteNonQuery_MSSQL_IDB(oDELSQL)
|
||||
Dim oResult = Channel.ExecuteNonQuery_MSSQL_IDB(oDELSQL)
|
||||
|
||||
If oResult.OK = False Then
|
||||
_logger.Warn("Error while deleting Term object")
|
||||
_logger.Error(oResult.ErrorMessage)
|
||||
Logger.Warn("Error while deleting Term object")
|
||||
Logger.Error(oResult.ErrorMessage)
|
||||
End If
|
||||
|
||||
Return oResult.OK
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function GetDatatableFromIDB(pSQL As String, Optional pConnectionId As Integer = 0) As GetDatatableResponse
|
||||
Try
|
||||
Dim oResponse = _channel.ReturnDatatable(New GetDatatableRequest() With {
|
||||
Dim oResponse = Channel.ReturnDatatable(New GetDatatableRequest() With {
|
||||
.SqlCommand = pSQL,
|
||||
.NamedDatabase = DatabaseName.IDB,
|
||||
.ConnectionId = pConnectionId
|
||||
})
|
||||
Return oResponse
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Async Function GetDatatableFromIDBAsync(pSQL As String, Optional pConnectionId As Integer = 0) As Task(Of GetDatatableResponse)
|
||||
Try
|
||||
Dim oResponse = Await _channel.ReturnDatatableAsync(New GetDatatableRequest() With {
|
||||
Dim oResponse = Await Channel.ReturnDatatableAsync(New GetDatatableRequest() With {
|
||||
.SqlCommand = pSQL,
|
||||
.NamedDatabase = DatabaseName.IDB,
|
||||
.ConnectionId = pConnectionId
|
||||
})
|
||||
Return oResponse
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function GetScalarValueFromIDB(pSQL As String, Optional pConnectionId As Integer = 0) As GetScalarValueResponse
|
||||
Try
|
||||
Dim oResponse = _channel.ReturnScalarValue(New GetScalarValueRequest() With {
|
||||
Dim oResponse = Channel.ReturnScalarValue(New GetScalarValueRequest() With {
|
||||
.SqlCommand = pSQL,
|
||||
.NamedDatabase = DatabaseName.IDB,
|
||||
.ConnectionId = pConnectionId
|
||||
})
|
||||
Return oResponse
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Async Function GetScalarValueFromIDBAsync(pSQL As String, Optional pConnectionId As Integer = 0) As Task(Of GetScalarValueResponse)
|
||||
Try
|
||||
Dim oResponse = Await _channel.ReturnScalarValueAsync(New GetScalarValueRequest() With {
|
||||
Dim oResponse = Await Channel.ReturnScalarValueAsync(New GetScalarValueRequest() With {
|
||||
.SqlCommand = pSQL,
|
||||
.NamedDatabase = DatabaseName.IDB,
|
||||
.ConnectionId = pConnectionId
|
||||
})
|
||||
Return oResponse
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function GetDatatableByName(DatatableName As String, Optional FilterExpression As String = "", Optional SortByColumn As String = "") As TableResult
|
||||
Try
|
||||
Dim oResponse = _channel.ReturnDatatableFromCache(DatatableName, FilterExpression, SortByColumn)
|
||||
Dim oResponse = Channel.ReturnDatatableFromCache(DatatableName, FilterExpression, SortByColumn)
|
||||
Return oResponse
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Async Function GetDatatableByNameAsync(DatatableName As String, Optional FilterExpression As String = "", Optional SortByColumn As String = "") As Task(Of TableResult)
|
||||
Try
|
||||
Dim oResponse = _channel.ReturnDatatableFromCache(DatatableName, FilterExpression, SortByColumn)
|
||||
Dim oResponse = Await Channel.ReturnDatatableFromCacheAsync(DatatableName, FilterExpression, SortByColumn)
|
||||
Return oResponse
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
@@ -618,7 +646,7 @@ Public Class Client
|
||||
''' <returns></returns>
|
||||
Public Function GetDocumentInfo(UserId As Long, ObjectId As Long) As DocumentInfo
|
||||
Try
|
||||
Dim oResponse As DocumentInfoResponse = _channel.GetFileInfoByObjectId(New DocumentInfoRequest With {
|
||||
Dim oResponse As DocumentInfoResponse = Channel.GetFileInfoByObjectId(New DocumentInfoRequest With {
|
||||
.ObjectId = ObjectId,
|
||||
.UserId = UserId
|
||||
})
|
||||
@@ -629,15 +657,15 @@ Public Class Client
|
||||
}
|
||||
|
||||
Catch ex As FaultException(Of ObjectDoesNotExistFault)
|
||||
_logger.Error(ex)
|
||||
Logger.Error(ex)
|
||||
Throw ex
|
||||
|
||||
Catch ex As FaultException
|
||||
_logger.Error(ex)
|
||||
Logger.Error(ex)
|
||||
Throw ex
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Logger.Error(ex)
|
||||
Throw ex
|
||||
|
||||
End Try
|
||||
@@ -649,14 +677,14 @@ Public Class Client
|
||||
.ObjectId = ObjectId,
|
||||
.UserId = UserId
|
||||
}
|
||||
Dim oResponse As DocumentInfoResponse = Await _channel.GetFileInfoByObjectIdAsync(oParams)
|
||||
Dim oResponse As DocumentInfoResponse = Await Channel.GetFileInfoByObjectIdAsync(oParams)
|
||||
|
||||
Return New DocumentInfo With {
|
||||
.AccessRight = oResponse.FileRight,
|
||||
.FullPath = oResponse.FullPath
|
||||
}
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
@@ -669,14 +697,14 @@ Public Class Client
|
||||
''' <returns>A channel object</returns>
|
||||
Private Function GetChannel() As IEDMIServiceChannel
|
||||
Try
|
||||
_logger.Debug("...Creating channel..")
|
||||
Dim oChannel = _channelFactory.CreateChannel()
|
||||
Logger.Debug("...Creating channel..")
|
||||
Dim oChannel = ChannelFactory.CreateChannel()
|
||||
|
||||
AddHandler oChannel.Faulted, AddressOf Reconnect
|
||||
|
||||
Return oChannel
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Reference in New Issue
Block a user