Common: ObjectPropertyDialog

This commit is contained in:
Jonathan Jenne
2022-03-11 15:46:59 +01:00
parent a6de7e0af2
commit 7f9fd6ee58
36 changed files with 785 additions and 326 deletions

View File

@@ -224,6 +224,18 @@ Public Class Client
End Try
End Function
Public Async Function SetAttributeValueAsync(pObjectId As Long, pName As String, pValue As Object, Optional pOptions As Options.SetAttributeValueOptions = Nothing) As Task(Of Boolean)
Try
Dim oSetAttributeValue As New Modules.IDB.SetAttributeValue(LogConfig, Channel)
Return Await oSetAttributeValue.RunAsync(pObjectId, pName, pValue, pOptions)
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
Public Async Function Globix_ImportFileAsync(
pFilePath As String,
pProfileId As Integer,
@@ -273,115 +285,115 @@ Public Class Client
''' <param name="pValue"></param>
''' <param name="pOptions"></param>
''' <returns></returns>
Public Function SetVariableValue(pObjectId As Long, pAttributeName As String, pValue As Object, Optional pOptions As Options.SetVariableValueOptions = Nothing) As Boolean
Try
' Set default options
If pOptions Is Nothing Then
pOptions = New Options.SetVariableValueOptions()
End If
'Public Function SetVariableValue(pObjectId As Long, pAttributeName As String, pValue As Object, Optional pOptions As Options.SetVariableValueOptions = Nothing) As Boolean
' Try
' ' Set default options
' If pOptions Is Nothing Then
' pOptions = New Options.SetVariableValueOptions()
' End If
Dim oOptions As New Options.GetVariableValueOptions With {
.Language = pOptions.Language,
.Username = pOptions.Username
}
' Dim oOptions As New Options.GetVariableValueOptions With {
' .Language = pOptions.Language,
' .Username = pOptions.Username
' }
Try
Dim oResponse = Channel.TestObjectIdExists(New TestObjectIdExistsRequest With {.ObjectId = pObjectId})
If oResponse.Exists = False Then
Return False
End If
' Try
' 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)
Return False
End Try
' Catch ex As Exception
' Logger.Error(ex)
' Return False
' End Try
Dim oType = pValue.GetType.Name
' Dim oType = pValue.GetType.Name
If oType = GetType(DataTable).Name Then
Dim oValueTable As DataTable = pValue
Dim oCurrentValue As VariableValue
' If oType = GetType(DataTable).Name Then
' Dim oValueTable As DataTable = pValue
' Dim oCurrentValue As VariableValue
' Get current value
oCurrentValue = GetVariableValue(pObjectId, pAttributeName, oOptions)
' ' Get current value
' oCurrentValue = GetVariableValue(pObjectId, pAttributeName, oOptions)
' If current value is datatable
If oCurrentValue.Type = GetType(DataTable) Then
' ' If current value is datatable
' If oCurrentValue.Type = GetType(DataTable) Then
' Convert value to Datatable
Dim oTable As DataTable = oCurrentValue.Value
' ' Convert value to Datatable
' Dim oTable As DataTable = oCurrentValue.Value
If oTable.Rows.Count > 1 Then
' If oTable.Rows.Count > 1 Then
'now Checking whether the old row still remains in Vector? If not it will be deleted as it cannot be replaced in multivalues
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)}]")
' 'now Checking whether the old row still remains in Vector? If not it will be deleted as it cannot be replaced in multivalues
' 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)}]")
If oNewValueRow.Item(1).ToString.ToUpper = oRow.Item(0).ToString.ToUpper Then
oExists = True
Exit For
End If
Next
' If oNewValueRow.Item(1).ToString.ToUpper = oRow.Item(0).ToString.ToUpper Then
' oExists = True
' Exit For
' End If
' Next
If oExists = False Then
Logger.Debug($"Value [{oRow.Item(0)}] no longer existing in Vector-Attribute [{pAttributeName}] - will be deleted!")
DeleteTermObjectFromMetadata(pObjectId, pAttributeName, oRow.Item(0))
End If
' If oExists = False Then
' Logger.Debug($"Value [{oRow.Item(0)}] no longer existing in Vector-Attribute [{pAttributeName}] - will be deleted!")
' DeleteTermObjectFromMetadata(pObjectId, pAttributeName, oRow.Item(0))
' End If
Next
End If
Else
If oValueTable.Rows.Count > 1 Then
' Next
' End If
' Else
' If oValueTable.Rows.Count > 1 Then
'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)}]")
' '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)}]")
If oNewValueRow.Item(1).ToString.ToUpper = oCurrentValue.ToString.ToUpper Then
oExists = True
Exit For
End If
' If oNewValueRow.Item(1).ToString.ToUpper = oCurrentValue.ToString.ToUpper Then
' oExists = True
' Exit For
' End If
Next
If oExists = False Then
Logger.Debug($"Value [{oCurrentValue}] no longer existing in Vector-Attribute [{pAttributeName}] - will be deleted!")
DeleteTermObjectFromMetadata(pObjectId, pAttributeName, oCurrentValue.Value)
End If
' Next
' If oExists = False Then
' 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!")
DeleteTermObjectFromMetadata(pObjectId, pAttributeName, oCurrentValue.Value)
' Else
' Logger.Debug($"Value [{oCurrentValue}] of Attribute [{pAttributeName}] obviously was updated during runtime - will be deleted!")
' DeleteTermObjectFromMetadata(pObjectId, pAttributeName, oCurrentValue.Value)
End If
' End If
End If
' End If
For Each oNewValueRow As DataRow In oValueTable.Rows
Dim oResult As Boolean = NewObjectData(pObjectId, pAttributeName, pValue, New Options.NewObjectOptions With {
.Language = pOptions.Language,
.Username = pOptions.Username
})
' For Each oNewValueRow As DataRow In oValueTable.Rows
' Dim oResult As Boolean = NewObjectData(pObjectId, pAttributeName, pValue, New Options.NewObjectOptions With {
' .Language = pOptions.Language,
' .Username = pOptions.Username
' })
If oResult = False Then
Return False
End If
Next
Return True
Else
Return NewObjectData(pObjectId, pAttributeName, pValue, New Options.NewObjectOptions With {
.Language = pOptions.Language,
.Username = pOptions.Username
})
End If
' If oResult = False Then
' Return False
' End If
' Next
' Return True
' Else
' Return NewObjectData(pObjectId, pAttributeName, pValue, New Options.NewObjectOptions With {
' .Language = pOptions.Language,
' .Username = pOptions.Username
' })
' End If
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
' Catch ex As Exception
' Logger.Error(ex)
' Return False
' End Try
'End Function
''' <summary>
'''