MS Structure Nodes
This commit is contained in:
@@ -1,8 +1,61 @@
|
||||
Public Class ClassNodeNavigation
|
||||
Imports System.Data.SqlClient
|
||||
Imports DevExpress.Utils
|
||||
Public Class ClassNodeNavigation
|
||||
Public Shared NODE_CONFIGURABLE_ID As Integer
|
||||
Public Shared MyTreeView As TreeView
|
||||
Public Shared Datatable_Nodes As DataTable
|
||||
Public Shared TREEVIEW_IMAGELIST As ImageList
|
||||
Public Shared IMAGE_COLLECTION As ImageCollection
|
||||
Public Shared Function CreateNodeProcedure(RECORD_ID As Integer, NODE_CONFIG_ID As Integer, NODE_CAPTION As String, NODE_ID1 As String, NODE_PARENT_ID As String, ADDED_WHO As String)
|
||||
Try
|
||||
Dim connection As New SqlConnection
|
||||
connection.ConnectionString = MyConnectionString
|
||||
|
||||
Using cmd As New SqlCommand("PRPMO_CREATE_NODE", connection)
|
||||
cmd.CommandType = CommandType.StoredProcedure
|
||||
'@pNODE_PARENT_ID INT, @pADDED_WHO
|
||||
cmd.Parameters.AddWithValue("@pRECORD_ID", RECORD_ID)
|
||||
cmd.Parameters.AddWithValue("@pNODE_CONFIG_ID", NODE_CONFIG_ID)
|
||||
cmd.Parameters.AddWithValue("@pNODE_CAPTION", NODE_CAPTION)
|
||||
cmd.Parameters.AddWithValue("@pNODE_ID1", NODE_ID1)
|
||||
cmd.Parameters.AddWithValue("@pNODE_PARENT_ID", NODE_PARENT_ID)
|
||||
cmd.Parameters.AddWithValue("@pADDED_WHO", ADDED_WHO)
|
||||
cmd.Parameters.Add("@pRESULT", SqlDbType.Int)
|
||||
cmd.Parameters("@pRESULT").Direction = ParameterDirection.Output
|
||||
|
||||
connection.Open()
|
||||
cmd.ExecuteNonQuery()
|
||||
connection.Close()
|
||||
|
||||
Dim GUID As Integer = cmd.Parameters("@pRESULT").Value
|
||||
Return GUID
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error in CreateNodeProcedure: ")
|
||||
ClassLogger.Add("Error in CreateNodeProcedure: " & ex.Message, True)
|
||||
Return 0
|
||||
End Try
|
||||
End Function
|
||||
|
||||
|
||||
Public Shared Function CREATE_IMAGE_COLL(DT_IMAGELIST As DataTable)
|
||||
IMAGE_COLLECTION = New ImageCollection
|
||||
For Each row As DataRow In DT_IMAGELIST.Rows
|
||||
Try
|
||||
Dim bimage = row.Item("NODE_IMAGE")
|
||||
If Not IsDBNull(bimage) Then
|
||||
Dim Node_image = ByteArrayToBitmap(bimage)
|
||||
IMAGE_COLLECTION.AddImage(Node_image, row.Item("GUID")) 'row.Item("GUID").ToString & "#" & row.Item("ENTITY_ID")
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
Next
|
||||
End Function
|
||||
|
||||
|
||||
Public Shared Function Return_Node(PARENT_ID As Integer, ParentNode As TreeNode)
|
||||
Dim expression As String
|
||||
expression = "PARENT_GUID = " & PARENT_ID 'Einschränkung auf Type und Parent_Guid
|
||||
@@ -43,8 +96,8 @@
|
||||
Dim NODE_ID
|
||||
Dim staticListItems = myTreeNode.Tag.Split("#")
|
||||
If staticListItems(0).Contains("NODE-TYPE") Then
|
||||
NODE_ID = staticListItems(0).ToString.Replace("NODE-TYPE-", "")
|
||||
|
||||
' NODE_ID = staticListItems(0).ToString.Replace("NODE-TYPE-", "")
|
||||
NODE_ID = Return_NODEID_forTag(myTreeNode.Tag)
|
||||
|
||||
End If
|
||||
If CURRENT_DT_NODE_CONFIGURABLE_NODES.Rows.Count > 0 And IsNumeric(NODE_ID) Then
|
||||
@@ -135,9 +188,9 @@
|
||||
MAIN_NODE.ImageIndex = index
|
||||
MAIN_NODE.SelectedImageIndex = index
|
||||
'New Font(fontfamily, fontsize, CType(fontstyle, FontStyle))
|
||||
Dim fontfamily As String
|
||||
Dim fontfamily, backcolor As String
|
||||
Dim fontstyle, fontcolor, fontsize As Integer
|
||||
Dim backcolor
|
||||
|
||||
fontfamily = MAIN_NODES(i)("FONT_FAMILY").ToString
|
||||
fontsize = CInt(MAIN_NODES(i)("FONT_SIZE"))
|
||||
fontstyle = MAIN_NODES(i)("FONT_STYLE")
|
||||
@@ -147,14 +200,10 @@
|
||||
MAIN_NODE.ForeColor = IntToColor(fontcolor)
|
||||
|
||||
Try
|
||||
If IsNumeric(backcolor) Then
|
||||
If backcolor = 16711680 Then
|
||||
Console.WriteLine("16711680")
|
||||
End If
|
||||
MAIN_NODE.BackColor = IntToColor(backcolor)
|
||||
Else
|
||||
If backcolor <> String.Empty Then MAIN_NODE.BackColor = Color.FromName(backcolor)
|
||||
If backcolor <> String.Empty Then
|
||||
MAIN_NODE.BackColor = Color.FromName(backcolor)
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add(">> Unexpected Error in Formatting NodeColor (CreateTreViewNodes): " & ex.Message, True)
|
||||
End Try
|
||||
@@ -208,8 +257,8 @@
|
||||
Next
|
||||
SUB_NODE.ImageIndex = index
|
||||
SUB_NODE.SelectedImageIndex = index
|
||||
Dim fontfamily As String
|
||||
Dim fontstyle, fontcolor, fontsize, backcolor As Integer
|
||||
Dim fontfamily, backcolor As String
|
||||
Dim fontstyle, fontcolor, fontsize As Integer
|
||||
|
||||
fontfamily = SUB_NODE_ROW(i)("FONT_FAMILY").ToString
|
||||
fontsize = CInt(SUB_NODE_ROW(i)("FONT_SIZE"))
|
||||
@@ -219,15 +268,12 @@
|
||||
SUB_NODE.NodeFont = New Font(fontfamily, fontsize, CType(fontstyle, FontStyle))
|
||||
SUB_NODE.ForeColor = IntToColor(fontcolor)
|
||||
Try
|
||||
If IsNumeric(backcolor) Then
|
||||
If backcolor = 255 Then
|
||||
Console.WriteLine("255")
|
||||
End If
|
||||
Dim col = IntToColor(backcolor)
|
||||
SUB_NODE.BackColor = IntToColor(backcolor)
|
||||
Else
|
||||
If backcolor <> String.Empty Then SUB_NODE.BackColor = Color.FromName(backcolor)
|
||||
If backcolor <> String.Empty Then
|
||||
SUB_NODE.BackColor = Color.FromName(backcolor)
|
||||
Dim icolor = SUB_NODE.BackColor
|
||||
End If
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add(">> Unexpected Error in Formatting NodeColor (Subnodes): " & ex.Message, True)
|
||||
End Try
|
||||
|
||||
Reference in New Issue
Block a user