Common/ObjectPropertyDialog: Respect System attribute flag

This commit is contained in:
Jonathan Jenne
2022-03-10 15:54:35 +01:00
parent abb850192a
commit a6de7e0af2
6 changed files with 31 additions and 39 deletions

View File

@@ -88,7 +88,8 @@ Public Class frmObjectPropertyDialog
.ID = oRow.Item("ATTR_ID"),
.Title = oRow.Item("ATTR_TITLE"),
.TypeID = oRow.Item("TYPE_ID"),
.TypeName = oRow.Item("TYPE_NAME")
.TypeName = oRow.Item("TYPE_NAME"),
.IsSystem = Convert.ToBoolean(oRow.Item("SYS_ATTRIBUTE"))
})
Next
@@ -175,7 +176,8 @@ Public Class frmObjectPropertyDialog
End If
For Each oAttribute As Attribute In oAttributes
Dim oControl = _Controls.GetControlForAttribute(oAttribute, True)
Dim oEditable = ShouldControlBeEditable(oAttribute)
Dim oControl = _Controls.GetControlForAttribute(oAttribute, Not oEditable)
Dim oItem As LayoutControlItem = AttributeLayout.AddItem()
oItem.Text = oAttribute.Title
@@ -188,11 +190,13 @@ Public Class frmObjectPropertyDialog
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
@@ -200,6 +204,15 @@ Public Class frmObjectPropertyDialog
End Try
End Sub
Private Function ShouldControlBeEditable(pAttribute As Attribute) As Boolean
If pAttribute.IsSystem Then
Return False
End If
Return True
End Function
Private Function ShowAttributeHistory(pDatatable As DataTable) As Boolean
Try
If pDatatable.Rows.Count > 0
@@ -234,8 +247,4 @@ Public Class frmObjectPropertyDialog
Return False
End Try
End Function
Private Sub TabFormControl1_Click(sender As Object, e As EventArgs) Handles TabFormControl1.Click
End Sub
End Class