Add new nodes
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
Imports DevExpress.Utils
|
||||
Imports DevExpress.XtraTreeList.Nodes
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class ClassNodeCreator
|
||||
Inherits BaseClass
|
||||
|
||||
Private ReadOnly _ImageList As ImageCollection
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pImageList As ImageCollection)
|
||||
MyBase.New(pLogConfig)
|
||||
_ImageList = pImageList
|
||||
End Sub
|
||||
|
||||
Public Function AddNode(pEntityId As Integer, pNodeCaption As String, pParentNodeId As Integer, pNodeConfigId As Integer) As Boolean
|
||||
|
||||
' Create a new Record in the given Entity
|
||||
Dim oRecordId = ClassRecordCommands.CreateRecordProcedure(pEntityId)
|
||||
If oRecordId = 0 Then
|
||||
Logger.Warn("Could not create a record. Exiting.")
|
||||
Return False
|
||||
End If
|
||||
|
||||
' Update the proxy?
|
||||
ClassProxy.PRPROXY_RECORD_UPD_INS(pEntityId, oRecordId)
|
||||
|
||||
' Create the Node in the Database
|
||||
Dim oNodeIdentifier = $"CONFIG {oRecordId}-{pNodeConfigId}"
|
||||
Dim oNodeId = ClassNodeNavigation.CreateNodeProcedure(oRecordId, pNodeConfigId, pNodeCaption, oNodeIdentifier, pParentNodeId, USER_USERNAME)
|
||||
|
||||
If oNodeId = 0 Then
|
||||
Logger.Warn("Node could not be created in database. Exiting.")
|
||||
Return False
|
||||
End If
|
||||
|
||||
Return True
|
||||
End Function
|
||||
End Class
|
||||
@@ -0,0 +1,34 @@
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class ClassNodeLoader
|
||||
Inherits BaseClass
|
||||
|
||||
Private ReadOnly Database As MSSQLServer
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer)
|
||||
MyBase.New(pLogConfig)
|
||||
Database = pDatabase
|
||||
End Sub
|
||||
|
||||
Public Async Function LoadNodes(pEntityId As Integer) As Task(Of DataTable)
|
||||
Dim oStructureNodeSql = $"SELECT
|
||||
T.GUID,
|
||||
T.RECORD_ID,
|
||||
T.NODE_CONFIG_ID,
|
||||
T.NODE_CAPTION,
|
||||
T.ID1,
|
||||
T.BACK_COLOR,
|
||||
T.PARENT_GUID,
|
||||
T.SEQUENCE,
|
||||
T.TYPE_NODE
|
||||
FROM
|
||||
VWPMO_STRUCTURE_NODES T
|
||||
INNER JOIN VWPMO_CONSTRUCTOR_FORMS T1 ON T.ENTITY_ID = T1.FORM_ID
|
||||
WHERE T.ENTITY_ID = {pEntityId}"
|
||||
Dim oTable = Await Database.GetDatatableAsync(oStructureNodeSql)
|
||||
|
||||
Return oTable
|
||||
End Function
|
||||
End Class
|
||||
Reference in New Issue
Block a user