handle create record false

This commit is contained in:
Jonathan Jenne
2023-09-21 16:37:58 +02:00
parent e423365257
commit 965ee96968
3 changed files with 21 additions and 8 deletions

View File

@@ -22,7 +22,8 @@ Public Class ClassNodeCommands
T.BACK_COLOR, T.BACK_COLOR,
T.PARENT_GUID, T.PARENT_GUID,
T.SEQUENCE, T.SEQUENCE,
T.TYPE_NODE T.TYPE_NODE,
T.CREATE_RECORD
FROM FROM
VWPMO_STRUCTURE_NODES T VWPMO_STRUCTURE_NODES T
INNER JOIN VWPMO_CONSTRUCTOR_FORMS T1 ON T.ENTITY_ID = T1.FORM_ID INNER JOIN VWPMO_CONSTRUCTOR_FORMS T1 ON T.ENTITY_ID = T1.FORM_ID

View File

@@ -13,13 +13,22 @@ Public Class ClassNodeCreator
_ImageList = pImageList _ImageList = pImageList
End Sub End Sub
Public Function AddNode(pEntityId As Integer, pNodeCaption As String, pParentNodeId As Integer, pNodeConfigId As Integer) As Boolean Public Function AddNode(pEntityId As Integer, pNodeCaption As String, pParentNodeId As Integer, pNodeConfigId As Integer, pCreateRecord As Boolean) As Boolean
' Create a new Record in the given Entity Dim oRecordId
Dim oRecordId = ClassRecordCommands.CreateRecordProcedure(pEntityId)
If oRecordId = 0 Then ' If a record should be created, do it.
Logger.Warn("Could not create a record. Exiting.") ' Otherwise we set the record id to 0.
Return False If pCreateRecord Then
' Create a new Record in the given Entity
oRecordId = ClassRecordCommands.CreateRecordProcedure(pEntityId)
If oRecordId = 0 Then
Logger.Warn("Could not create a record. Exiting.")
Return False
End If
Else
' Zero will be handled by CreateNodeProcedure
oRecordId = 0
End If End If
' Update the proxy? ' Update the proxy?

View File

@@ -2931,10 +2931,13 @@ Public Class frmNodeNavigation
Exit Sub Exit Sub
End If End If
Dim oRow = NODE_CONFIGURABLE_NODES_DT.Select($"GUID = {oForm.Id}").First()
Dim oCreateRecord = oRow.Item("CREATE_RECORD")
Dim oParentNodeGuid As Integer = FocusedNode.Item("GUID") Dim oParentNodeGuid As Integer = FocusedNode.Item("GUID")
Dim oIsExpanded As Boolean = FocusedNode.Expanded Dim oIsExpanded As Boolean = FocusedNode.Expanded
Dim oNodeCreator = New ClassNodeCreator(LOGCONFIG, ImageCollection1) Dim oNodeCreator = New ClassNodeCreator(LOGCONFIG, ImageCollection1)
oNodeCreator.AddNode(_EntityId, oForm.Title, oParentNodeGuid, oForm.Id) oNodeCreator.AddNode(_EntityId, oForm.Title, oParentNodeGuid, oForm.Id, oCreateRecord)
Await ReloadTreeView() Await ReloadTreeView()