EDMIAPI: Add SetObjectState Function
This commit is contained in:
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
|
||||
Reference in New Issue
Block a user