EDMIAPI: Add SetObjectState Function
This commit is contained in:
parent
41447e80c5
commit
1e5d8c96fd
@ -194,9 +194,11 @@ Public Class Client
|
||||
Try
|
||||
Dim oNewFile As New Modules.IDB.NewFile(LogConfig, Channel)
|
||||
Return Await oNewFile.RunAsync(pFilePath, pObjectStoreName, pObjectKind, pBusinessEntity, pImportOptions)
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
|
||||
End Try
|
||||
End Function
|
||||
|
||||
@ -204,9 +206,23 @@ Public Class Client
|
||||
Try
|
||||
Dim oUpdateFile As New Modules.IDB.UpdateFile(LogConfig, Channel)
|
||||
Return Await oUpdateFile.RunAsync(pFilePath, pObjectId, pImportOptions)
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Async Function SetObjectStateAsync(pObjectId As Long, pState As String, Optional pOptions As Options.SetObjectStateOptions = Nothing) As Task(Of Boolean)
|
||||
Try
|
||||
Dim oSetObjectState As New Modules.IDB.SetObjectState(LogConfig, Channel)
|
||||
Return Await oSetObjectState.RunAsync(pObjectId, pState, pOptions)
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
|
||||
End Try
|
||||
End Function
|
||||
|
||||
@ -221,9 +237,11 @@ Public Class Client
|
||||
Try
|
||||
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)
|
||||
Return Nothing
|
||||
|
||||
End Try
|
||||
End Function
|
||||
|
||||
|
||||
@ -43,6 +43,16 @@
|
||||
Public Property DateImported As Date = Date.Now
|
||||
End Class
|
||||
|
||||
Public Class SetObjectStateOptions
|
||||
Inherits BaseOptions
|
||||
|
||||
''' <summary>
|
||||
''' Date when the file was imported. Can be in the past. Defaults to now.
|
||||
''' </summary>
|
||||
Public Property DateImported As Date = Date.Now
|
||||
End Class
|
||||
|
||||
|
||||
Public Class GetVariableValueOptions
|
||||
Inherits BaseOptions
|
||||
End Class
|
||||
|
||||
@ -80,6 +80,7 @@
|
||||
<Compile Include="Modules\Globix\ImportFile.vb" />
|
||||
<Compile Include="Helpers.vb" />
|
||||
<Compile Include="Modules\IDB\NewFile.vb" />
|
||||
<Compile Include="Modules\IDB\SetObjectState.vb" />
|
||||
<Compile Include="Modules\IDB\UpdateFile.vb" />
|
||||
<Compile Include="Modules\ZooFlow\GetFileObject.vb" />
|
||||
<Compile Include="Connected Services\EDMIServiceReference\Reference.vb">
|
||||
|
||||
34
Modules.EDMIAPI/Modules/IDB/SetObjectState.vb
Normal file
34
Modules.EDMIAPI/Modules/IDB/SetObjectState.vb
Normal file
@ -0,0 +1,34 @@
|
||||
|
||||
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
||||
Imports DigitalData.Modules.EDMI.API.Options
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Namespace Modules.IDB
|
||||
Public Class SetObjectState
|
||||
Inherits BaseMethod
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pChannel As IEDMIServiceChannel)
|
||||
MyBase.New(pLogConfig, pChannel)
|
||||
End Sub
|
||||
|
||||
Public Async Function RunAsync(pObjectId As String, pState As String, Optional pOptions As SetObjectStateOptions = Nothing) As Task(Of Boolean)
|
||||
Try
|
||||
|
||||
Dim oSql As String = $"EXEC PRIDB_OBJECT_SET_STATE {pObjectId}, '{pState}', '{pOptions.Username}', '{pOptions.Language}'"
|
||||
Dim oResult = Await Channel.ExecuteNonQuery_MSSQL_IDBAsync(oSql)
|
||||
|
||||
If oResult.OK Then
|
||||
Return True
|
||||
End If
|
||||
|
||||
Logger.Warn("Error while setting Object State: [{0}]", oResult.ErrorMessage)
|
||||
Return False
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
End Namespace
|
||||
Loading…
x
Reference in New Issue
Block a user