ms debug wegen dauer aufruf CW

This commit is contained in:
2021-09-07 13:45:10 +02:00
parent 701877c5ba
commit 63b9b0e085
10 changed files with 77 additions and 65 deletions

View File

@@ -157,37 +157,45 @@ Public Class frmObjectPropertyDialog
End Function
Private Async Sub cmbBusinessEntity_EditValueChanged(sender As Object, e As EventArgs) Handles cmbBusinessEntity.EditValueChanged
Dim oEntityId As Long
If Long.TryParse(cmbBusinessEntity.EditValue, oEntityId) = False Then
Exit Sub
End If
Dim oAttributes = Await GetAttributesForBusinessEntity(oEntityId)
For Each oAttribute As Attribute In oAttributes
Dim oControl = _Controls.GetControlForAttribute(oAttribute, True)
Dim oItem As LayoutControlItem = AttributeLayout.AddItem()
oItem.Text = oAttribute.Title
oItem.Name = oAttribute.Title
oItem.Control = oControl
Next
For Each oItem As LayoutControlItem In AttributeLayout.Items
If TypeOf oItem.Control Is BaseEdit Then
Dim oValue = Await GetAttributeValue(oItem.Name, _ObjectId)
Dim oEdit = DirectCast(oItem.Control, BaseEdit)
oEdit.EditValue = oValue
ElseIf TypeOf oItem.Control Is GridControl Then
Dim oValueTable = Await GetAttributeValueAsTable(oItem.Name, _ObjectId)
Dim oGrid = DirectCast(oItem.Control, GridControl)
oGrid.DataSource = oValueTable
End If
Next
Load_Attributes()
End Sub
Private Async Sub Load_Attributes()
Try
Dim oEntityId As Long
If Long.TryParse(cmbBusinessEntity.EditValue, oEntityId) = False Then
_Logger.Warn("Could not Parse Entity from cmbBusinessEntity")
Exit Sub
End If
Dim oAttributes = Await GetAttributesForBusinessEntity(oEntityId)
For Each oAttribute As Attribute In oAttributes
Dim oControl = _Controls.GetControlForAttribute(oAttribute, True)
Dim oItem As LayoutControlItem = AttributeLayout.AddItem()
oItem.Text = oAttribute.Title
oItem.Name = oAttribute.Title
oItem.Control = oControl
Next
For Each oItem As LayoutControlItem In AttributeLayout.Items
If TypeOf oItem.Control Is BaseEdit Then
Dim oValue = Await GetAttributeValue(oItem.Name, _ObjectId)
Dim oEdit = DirectCast(oItem.Control, BaseEdit)
oEdit.EditValue = oValue
ElseIf TypeOf oItem.Control Is GridControl Then
Dim oValueTable = Await GetAttributeValueAsTable(oItem.Name, _ObjectId)
Dim oGrid = DirectCast(oItem.Control, GridControl)
oGrid.DataSource = oValueTable
End If
Next
Catch ex As Exception
_Logger.Error(ex)
End Try
End Sub
Private Function ShowAttributeHistory(pDatatable As DataTable) As Boolean
Try
If pDatatable.Rows.Count > 0