This commit is contained in:
2023-04-13 17:11:20 +02:00
parent aa7c68a4ce
commit 2db575d944
20 changed files with 584 additions and 4214 deletions

View File

@@ -16,6 +16,8 @@ Imports System.IO
Imports DD_LIB_Standards
Imports System.Runtime.InteropServices
Public Class frmNodeNavigation
<DllImport("Shell32", CharSet:=CharSet.Auto, SetLastError:=True)>
Public Shared Function ShellExecuteEx(ByRef lpExecInfo As SHELLEXECUTEINFO) As Boolean
@@ -72,7 +74,6 @@ Public Class frmNodeNavigation
Private SELECTED_NODE_RECORD_ID As Integer
Private SELECTED_NODE_CAPTION As String
Private ENTITY_RECORD_COUNT As Integer = 0
Private act_FormViewID As Integer
Private FORMVIEW_ID As Integer
Private FORM_LOADED As Boolean = False
Private FORM_SHOWN As Boolean = False
@@ -94,8 +95,109 @@ Public Class frmNodeNavigation
Private Const SEE_MASK_FLAG_NO_UI = &H400
Public Const SW_SHOW As Short = 5
Private CONTROL_DOCTYPE_MATCH As Integer = 0
#End Region
Private FocusedNode As TreeListNode
Private MyTreeListViewState As TreeListViewState
#End Region
Public Class TreeListViewState
Private expanded As ArrayList
Private selected As ArrayList
Private focused As Object
Private topNode As Object
Public Sub New()
Me.New(Nothing)
End Sub
Public Sub New(ByVal treeList As TreeList)
Me.treeList_Renamed = treeList
expanded = New ArrayList()
selected = New ArrayList()
End Sub
Public Sub Clear()
expanded.Clear()
selected.Clear()
focused = Nothing
topNode = Nothing
End Sub
Private Function GetExpanded() As ArrayList
Dim op As New OperationSaveExpanded()
TreeList.NodesIterator.DoOperation(op)
Return op.Nodes
End Function
Private Function GetSelected() As ArrayList
Dim al As New ArrayList()
For Each node As TreeListNode In TreeList.Selection
al.Add(node.GetValue(TreeList.KeyFieldName))
Next node
Return al
End Function
Public Sub LoadState()
TreeList.BeginUpdate()
Try
TreeList.CollapseAll()
Dim node As TreeListNode
For Each key As Object In expanded
node = TreeList.FindNodeByKeyID(key)
If node IsNot Nothing Then
node.Expanded = True
End If
Next key
TreeList.FocusedNode = TreeList.FindNodeByKeyID(focused)
For Each key As Object In selected
node = TreeList.FindNodeByKeyID(key)
If node IsNot Nothing Then
TreeList.Selection.Add(node)
End If
Next key
Finally
TreeList.EndUpdate()
Dim topVisibleNode As TreeListNode = TreeList.FindNodeByKeyID(topNode)
If topVisibleNode Is Nothing Then
topVisibleNode = TreeList.FocusedNode
End If
TreeList.TopVisibleNodeIndex = TreeList.GetVisibleIndexByNode(topVisibleNode)
End Try
End Sub
Public Sub SaveState()
If TreeList.FocusedNode IsNot Nothing Then
expanded = GetExpanded()
selected = GetSelected()
focused = TreeList.FocusedNode(TreeList.KeyFieldName)
topNode = TreeList.GetNodeByVisibleIndex(TreeList.TopVisibleNodeIndex)(TreeList.KeyFieldName)
Else
Clear()
End If
End Sub
Private treeList_Renamed As TreeList
Public Property TreeList() As TreeList
Get
Return treeList_Renamed
End Get
Set(ByVal value As TreeList)
treeList_Renamed = value
Clear()
End Set
End Property
Private Class OperationSaveExpanded
Inherits TreeListOperation
Private al As New ArrayList()
Public Overrides Sub Execute(ByVal node As TreeListNode)
If node.HasChildren AndAlso node.Expanded Then
al.Add(node.GetValue(node.TreeList.KeyFieldName))
End If
End Sub
Public ReadOnly Property Nodes() As ArrayList
Get
Return al
End Get
End Property
End Class
End Class
Public Sub New(pEntityID As Int16, pConstructID As Int16)
' Dieser Aufruf ist für den Designer erforderlich.
@@ -162,14 +264,13 @@ Public Class frmNodeNavigation
DT_VWPMO_CONSTRUCTOR_FORMS = ClassDatabase.Return_Datatable(Sql, True)
CURRENT_DT_TBPMO_ENTITY_RIGHT_CONTROLS = ClassDatabase.Return_Datatable(String.Format("SELECT T.* FROM TBPMO_ENTITY_RIGHT_CONTROLS T INNER JOIN VWPMO_CONSTRUCTOR_FORMS T1 ON T.ENTITY_ID = T1.FORM_ID where T1.CONSTRUCT_ID = {0}", CONSTRUCTORID), False)
' Hintergrund Bild initialisieren
If (System.IO.File.Exists(Application.StartupPath + "\Resources\windream-landscape_col_RGB.png")) Then
WM_LOGO = New Bitmap(Application.StartupPath + "\Resources\windream-landscape_col_RGB.png")
' MessageBox.Show("File: " & Application.StartupPath + "\Resources\Pic1.png" & " doesn't exist. Check file and try again.")
End
End If
BACKGROUND_HELPER = New ClassBackgroundHelper(GridViewDoc_Search, WM_LOGO) '
ClassWindowLocation.LoadFormLocationSize(Me, CONSTRUCTORID, CURRENT_SCREEN_ID, "CONSTRUCTOR_MAIN")
'If (System.IO.File.Exists(Application.StartupPath + "\Resources\windream-portrait_col_RGB_Wordpress.png")) Then
' WM_LOGO = New Bitmap(Application.StartupPath + "\Resources\windream-portrait_col_RGB_Wordpress.png")
' BACKGROUND_HELPER = New ClassBackgroundHelper(GridViewDoc_Search, WM_LOGO) '
' ' MessageBox.Show("File: " & Application.StartupPath + "\Resources\Pic1.png" & " doesn't exist. Check file and try again.")
' End
'End If
ClassWindowLocation.LoadFormLocationSize(Me, CONSTRUCTORID, CURRENT_SCREEN_ID, "NODE_NAVIGATION")
Try
DT_CONSTRUCT_VIEW = ClassDatabase.Return_Datatable("SELECT * FROM TBPMO_FORM_CONSTRUCTOR WHERE GUID = " & CONSTRUCTORID)
Dim SEL1 = String.Format("SELECT * FROM TBPMO_FORM WHERE GUID IN (SELECT FORM_ID FROM VWPMO_CONSTRUCTOR_FORMS WHERE SCREEN_ID = {0} AND CONSTRUCT_ID = {1})", CURRENT_SCREEN_ID, CONSTRUCTORID)
@@ -190,6 +291,7 @@ Public Class frmNodeNavigation
' "GROUP BY T1.ENTITY_ID,T.GUID,T.TITLE,T.MANUALLY,T.CREATE_ON_REC_CREATE,T.CREATE_ON_FOLL_UP"
'DT_WORKFLOWS_MANUAL = ClassDatabase.Return_Datatable(sql_ResultList)
Load_Datafor_Entity()
FORM_LOADED = True
Catch ex As System.Exception
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", ex.Message, "Error in Loading Form part 4")
@@ -325,6 +427,7 @@ Public Class frmNodeNavigation
' ClassNodeNavigation.Check_NODE_CONFIG_ID(oEntityID, SelectedNode)
CURRENT_RECORD_ID = pRecord
ClassHelper.GetDocrecordLinks(CURRENT_RECORD_ID)
CURRENT_ENTITY_ID = oEntityID
CURRENT_NODE_GUID = oID
SELECTED_NODE_CAPTION = oNode_Caption
@@ -935,7 +1038,7 @@ Public Class frmNodeNavigation
Try
CURRENT_RECORD_ID = pRecord
CURRENT_SEARCH_TYPE = "RECORD"
ClassHelper.GetDocrecordLinks(CURRENT_RECORD_ID)
'Wird jetzt bei BeforeRowChange überprüft
@@ -1009,7 +1112,7 @@ Public Class frmNodeNavigation
e.Cancel = True
End If
ClassWindowLocation.SaveFormLocationSize(Me, CONSTRUCTORID, CURRENT_SCREEN_ID, "CONSTRUCTOR_MAIN")
ClassWindowLocation.SaveFormLocationSize(Me, CONSTRUCTORID, CURRENT_SCREEN_ID, "NODE_NAVIGATION")
CURRENT_OPEN_CONSTRUCTOR_FORMS.Remove(CONSTRUCTORID)
@@ -1026,7 +1129,6 @@ Public Class frmNodeNavigation
Private Sub pnlControls_Enter(sender As Object, e As EventArgs) Handles pnlControls.Enter
In_Visible_Record_Group(True)
In_Visible_File_Group(False)
End Sub
Private Sub pnlControls_Leave(sender As Object, e As EventArgs) Handles pnlControls.Leave
@@ -1037,16 +1139,12 @@ Public Class frmNodeNavigation
In_Visible_Record_Group(False)
End Sub
Private Sub pnlControls_MouseDown(sender As Object, e As MouseEventArgs) Handles pnlControls.MouseDown
In_Visible_File_Group(False)
End Sub
Sub In_Visible_Record_Group(oBool As Boolean)
RibbonPageGroupRecord.Visible = oBool
RibbonPageGroupRecord.Enabled = oBool
End Sub
Sub In_Visible_File_Group(oBool As Boolean)
RibbonPageGroupRecord.Visible = oBool
RibbonPageGroupRecord.Enabled = oBool
End Sub
Private Sub bbtnitmEditRec_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtnitmRecEdit.ItemClick
If RECORD_ENABLED = False Then
EnableEditMode()
@@ -1113,6 +1211,7 @@ Public Class frmNodeNavigation
End If
CURRENT_RECORD_ID = SELECTED_NODE_RECORD_ID
ClassHelper.GetDocrecordLinks(CURRENT_RECORD_ID)
CtrlCommandUI.IsEdit = True
' Abhängige Listen laden
CtrlBuilder.WatchRecordChanges = False
@@ -1536,7 +1635,7 @@ Public Class frmNodeNavigation
Dim oSQL = $"SELECT ENTITY_DOC_SEARCH FROM TBPMO_FORM WHERE GUID = {oEntityID}"
CURRENT_DOCSEARCH_SQL = ClassDatabase.Execute_Scalar(oSQL, True)
If CURRENT_DOCSEARCH_SQL <> String.Empty Then
Dim oText = $"Die Entität-weite Suche wird im Hintergrund ausgeführt und angezeigt sobald sie fertig ist."
Dim oText = $"Die Entität-weite Suche wird im Hintergrund ausgeführt und in einem separaten Fenster angezeigt sobald sie fertig ist."
If USER_LANGUAGE <> "de-De" Then
oText = $"The entity-wide search will be started in background. The result will be displayed when ready."
End If
@@ -1722,13 +1821,11 @@ Public Class frmNodeNavigation
End Sub
#Region "GridViewEvents"
Private Sub GridViewDoc_Search_ColumnFilterChanged(sender As Object, e As EventArgs) Handles GridViewDoc_Search.ColumnFilterChanged
Private Sub GridViewDoc_Search_LayoutSave(sender As Object, e As EventArgs) Handles GridViewDoc_Search.ColumnFilterChanged, GridViewDoc_Search.ColumnWidthChanged, GridViewDoc_Search.ColumnPositionChanged
Save_DocGrid_Layout()
End Sub
Private Sub GridViewDoc_Search_ColumnWidthChanged(sender As Object, e As DevExpress.XtraGrid.Views.Base.ColumnEventArgs) Handles GridViewDoc_Search.ColumnWidthChanged
Save_DocGrid_Layout()
End Sub
Private Sub GridViewDoc_Search_FocusedColumnChanged(sender As Object, e As DevExpress.XtraGrid.Views.Base.FocusedColumnChangedEventArgs) Handles GridViewDoc_Search.FocusedColumnChanged
@@ -1758,12 +1855,14 @@ Public Class frmNodeNavigation
End Sub
Sub Save_DocGrid_Layout()
Try
Dim XMLPath = Get_DocGrid_Layout_Filename()
GridViewDoc_Search.SaveLayoutToXml(XMLPath)
If FORM_LOADED And Node_AfterSelect = False Then
Dim XMLPath = Get_DocGrid_Layout_Filename()
GridViewDoc_Search.SaveLayoutToXml(XMLPath)
Update_Status_Label(True, "Grid Layout Saved")
Update_Status_Label(True, "Grid Layout Saved")
End If
Catch ex As Exception
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", ex.Message, ex.StackTrace)
End Try
@@ -1827,8 +1926,10 @@ Public Class frmNodeNavigation
End Sub
#Region "Dropping Files"
Sub Drag_Enter(e As DragEventArgs)
If act_FormViewID <> 0 Then
If oEntityID <> 0 Then
ClassDragDrop.Drag_enter(e)
Else
Update_Status_Label(True, "No entity selected", EditState.Insert)
End If
End Sub
Sub Drag_Drop(e As DragEventArgs)
@@ -1844,7 +1945,7 @@ Public Class frmNodeNavigation
ClassHelper.MSGBOX_Handler("INFO", "Attention", "Check Your windream-connection and restart ADDI afterwards.", "Could not create a windream session!")
Exit Sub
End If
If act_FormViewID <> 0 And (RIGHT_READ_ONLY_DOC = False And GridControlDocSearch.ContextMenuStrip.Name = "ContextMenuStripResultFiles") Or RIGHT_ADD_DOC = True Then
If oEntityID <> 0 And (RIGHT_READ_ONLY_DOC = False And GridControlDocSearch.ContextMenuStrip.Name = "ContextMenuStripResultFiles") Or RIGHT_ADD_DOC = True Then
Dim sql = "select count(*) from VWPMO_DOKUMENTTYPES where FORMVIEW_ID = " & FORMVIEW_ID
Dim count_DT = ClassDatabase.Execute_Scalar(sql, True)
If count_DT = 0 And CURRENT_ENTITY_REDUNDANT_ID = 0 Then
@@ -2024,6 +2125,13 @@ Public Class frmNodeNavigation
Private Sub pnlControls_DragEnter(sender As Object, e As DragEventArgs) Handles pnlControls.DragEnter
Drag_Enter(e)
End Sub
Private Sub SplitContainer1_DragEnter(sender As Object, e As DragEventArgs) Handles SplitContainer1.DragEnter
Drag_Enter(e)
End Sub
Private Sub SplitContainer1_DragDrop(sender As Object, e As DragEventArgs) Handles SplitContainer1.DragDrop
Drag_Drop(e)
End Sub
#End Region
Function Save_Record()
@@ -2489,7 +2597,7 @@ Public Class frmNodeNavigation
msg = "Would You like to delete only the references?" & vbNewLine & "File(s) will stay in ECM/Archive/Explorer!"
End If
Dim result As MsgBoxResult
result = MessageBox.Show(msg, "Confirmation:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
result = MessageBox.Show(msg, CAPTION_CONFIRMATION, MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = MsgBoxResult.Yes Then
Try
For Each row As DataRow In ClassWindreamDocGrid.DT_RESULTFILES.Rows
@@ -2569,4 +2677,62 @@ Public Class frmNodeNavigation
CURRENT_SEARCH_TYPE = "ENTITY"
RUN_ENTITY_DOC_SEARCH()
End Sub
Private Sub bbtnitmReloadView_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtnitmReloadView.ItemClick
ReloadTreeView()
End Sub
Sub ReloadTreeView()
TreeListDevexpress.Nodes.Clear()
Load_nodes()
End Sub
Private Sub UnterknotenNeuOrdnenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles UnterknotenNeuOrdnenToolStripMenuItem.Click
MyTreeListViewState = New TreeListViewState(TreeListDevexpress)
Dim oQuestion = "Wollen Sie die gesamte Struktur unterhalb dieses Knotens neu ordnen lassen?" & vbNewLine & "Nein, wenn nur die direkten Unterknoten neu geordnet werden sollen!"
If USER_LANGUAGE <> "de-DE" Then
oQuestion = "Do you want to reorder the entire structure below this node?" & vbNewLine & "No, if only the direct subnodes are to be reordered!"
End If
Dim result As MsgBoxResult
result = MessageBox.Show(oQuestion, CAPTION_CONFIRMATION, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)
Dim oSubnodes As String = "0"
If result = MsgBoxResult.Yes Then
oSubnodes = "1"
ElseIf result = MsgBoxResult.Cancel Then
Exit Sub
End If
Cursor = Cursors.WaitCursor
Dim oSQL = $"EXEC PRCUST_REORDER_CHILD_NODES "
Dim oNodeGUID As Integer = 0
Dim oID = FocusedNode.Id
Dim PID = FocusedNode.ParentNode
Dim Column_pRecord As TreeListColumn = TreeListDevexpress.Columns("RECORD_ID")
Dim Column_Caption As TreeListColumn = TreeListDevexpress.Columns("NODE_CAPTION")
If oID > 0 Then
MyTreeListViewState.SaveState()
oNodeGUID = oID
oSQL += $" {oNodeGUID},{oSubnodes} "
ClassDatabase.Execute_non_Query(oSQL)
ReloadTreeView()
MyTreeListViewState.LoadState()
TreeListDevexpress.FocusedNode = FocusedNode
End If
Cursor = Cursors.Default
End Sub
Private Sub TreeListDevexpress_MouseUp(sender As Object, e As MouseEventArgs) Handles TreeListDevexpress.MouseUp
Dim tree As TreeList = TryCast(sender, TreeList)
If e.Button = MouseButtons.Right AndAlso ModifierKeys = Keys.None AndAlso tree.State = TreeListState.Regular Then
Dim info As TreeListHitInfo = tree.CalcHitInfo(e.Location)
FocusedNode = tree.FocusedNode
Dim SavedTopIndex As Integer = tree.TopVisibleNodeIndex
tree.FocusedNode = info.Node
cmsTreeView.Show(TreeListDevexpress, e.Location)
End If
End Sub
End Class