3763 lines
162 KiB
VB.net
3763 lines
162 KiB
VB.net
Imports System.IO
|
||
Imports System.Text
|
||
Imports System.Threading
|
||
Imports DD_Record_Organizer.ClassDocGrid
|
||
Imports DevExpress.Data
|
||
Imports DevExpress.Data.Filtering
|
||
Imports DevExpress.Utils
|
||
Imports DevExpress.XtraBars.Ribbon
|
||
Imports DevExpress.XtraEditors
|
||
Imports DevExpress.XtraGrid
|
||
Imports DevExpress.XtraGrid.Views.Grid
|
||
Imports DevExpress.XtraPrinting
|
||
Imports DevExpress.XtraRichEdit.API.Native
|
||
Imports DevExpress.XtraScheduler
|
||
Imports DevExpress.XtraSplashScreen
|
||
Imports DevExpress.XtraTreeList
|
||
Imports DevExpress.XtraTreeList.Columns
|
||
Imports DevExpress.XtraTreeList.Nodes
|
||
Imports DevExpress.XtraTreeList.Nodes.Operations
|
||
Imports DigitalData.Modules.Base
|
||
Imports DigitalData.Modules.Database
|
||
Imports DigitalData.Modules.Logging
|
||
|
||
Public Class frmNodeNavigation
|
||
#Region "Laufzeitvariablen & Konstanten"
|
||
Private NNLogger As Logger
|
||
Private Property DT_STRUCTURE_NODES As DataTable
|
||
Private Property DT_ADDING_USERS As DataTable
|
||
Private Property DT_VWPMO_CONSTRUCTOR_FORMS As DataTable
|
||
Private Property RunningTaskTokenSource As New CancellationTokenSource
|
||
Private Property _EntityId As Short
|
||
Private Property oConstructID As Short
|
||
Private Property CONSTRUCTORID As Integer
|
||
Private Property CONSTRUCTOR_DETAIL_ID As Short
|
||
Private Property _RowReadOnly As Boolean = False
|
||
Private Property ADD_RECORDS_CONSTR As Boolean = True
|
||
Private Property TV_Collapse_ExpandState As String = "Collapse"
|
||
Private _ActiveGrid As GridControl = Nothing
|
||
Private Property WindowsEx As WindowsEx
|
||
|
||
Private Property DT_CONTROLS_ENTITY As DataTable
|
||
Private Property DT_COLUMNS_GRID_ENTITY As DataTable
|
||
Private Property DT_DOCRESULT_DROPDOWN_ITEMS As DataTable
|
||
Private Property DT_RESULTLIST_OPTIONS As DataTable
|
||
Private Property DT_RESULTLIST_VARIABLE_VALUE As DataTable
|
||
Private Property DT_ENTITY_DATA As DataTable
|
||
Private Property ENTITY_TYPE As String = ""
|
||
Private Property DT_TBPMO_FORM_VIEW As DataTable
|
||
Private Property DT_CONSTRUCT_VIEW As DataTable
|
||
Private Property COUNT_RO_CONTROLS As Integer = 0
|
||
Private Property SELECTED_NODE_RECORD_ID As Integer
|
||
Private Property SELECTED_NODE_CAPTION As String
|
||
Private Property FORMVIEW_ID As Integer
|
||
Private Property FORM_LOADED As Boolean = False
|
||
Private Property FORM_SHOWN As Boolean = False
|
||
Private Property SAVE_ROUTINE_ACTIVE As Boolean = False
|
||
|
||
Private Property ENTITY_LOADING_PROCESS As Boolean = False
|
||
Private Property RECORD_ENABLED As Boolean = False
|
||
Private Property Node_AfterSelect As Boolean = False
|
||
Private Property EDIT_STATE As EditState = EditState.None
|
||
Private Property ERROR_WHILE_SAVING As Boolean = False
|
||
Private Property IW_USER As String
|
||
Private Property IW_COMMENT As String
|
||
Private Property INWORK_FILE As Boolean
|
||
Private Property INWORK_MULTIPLE_FILES_SET_FREE As Boolean
|
||
Private Property CONTROL_DOCTYPE_MATCH As Integer = 0
|
||
Private Property MyFocusedNode As TreeListNode
|
||
Private Property oCollapseInAction As Boolean = False
|
||
Private Property MyTreeListViewState As ClassTreeListViewState
|
||
|
||
Private Property AvailableConfigNodes As New List(Of frmNewNode.NodeConfig)
|
||
Private Property CurrentNodeConfigId As Integer = 0
|
||
|
||
Private Property mySelectedDocs As List(Of clsWMDoc)
|
||
Private Property Current_DocList As ClassDocGrid
|
||
|
||
Public CtrlBuilder As ClassControlBuilder
|
||
Public CtrlCommandUI As ClassControlCommandsUI
|
||
Private Property ParentNodeChangeinAction As Boolean = False
|
||
Private Property ChildNodeGuid As Integer = 0
|
||
|
||
Private Property ClassNodeCommands As ClassNodeCommands
|
||
Private Property DocViewInitialized As Boolean = False
|
||
|
||
Private PA_NODE_GUID_STAMM As Integer = 0
|
||
Private PA_NODE_CONFIG_USER_STAMM As Integer = 0
|
||
Private Debug As Boolean = False
|
||
|
||
Public Enum EditState
|
||
None
|
||
Insert
|
||
Update
|
||
Delete
|
||
End Enum
|
||
#End Region
|
||
Public Sub New(pEntityID As Int16, pConstructID As Int16)
|
||
' Dieser Aufruf ist für den Designer erforderlich.
|
||
InitializeComponent()
|
||
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
|
||
_EntityId = pEntityID
|
||
oConstructID = pConstructID
|
||
Dim oMyClassName = $"frmNodeNavigation_Entity{_EntityId}"
|
||
NNLogger = LOGCONFIG.GetLogger(oMyClassName)
|
||
|
||
NNLogger.Debug("Loading NodeNavigation for Entity [{0}]", pEntityID)
|
||
|
||
|
||
|
||
Current_DocList = New ClassDocGrid(GridViewDoc_Search)
|
||
WindowsEx = New WindowsEx(LOGCONFIG)
|
||
ClassNodeCommands = New ClassNodeCommands(LOGCONFIG, MYDB_ECM)
|
||
End Sub
|
||
|
||
Sub Save_Splitter_Layout()
|
||
Try
|
||
|
||
CONFIG.Config.TreeListSplitterWidth = SplitContainerTreeList.SplitterPosition
|
||
CONFIG.Config.DocumentViewerSplitterWidth = SplitContainerDocView.SplitterPosition
|
||
CONFIG.Config.DocumentSearchSplitterWidth = SplitContainerDocumentSearch.SplitterPosition
|
||
CONFIG.Save()
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", ex.Message, ex.StackTrace)
|
||
End Try
|
||
End Sub
|
||
|
||
Sub Load_Splitter_Layout()
|
||
Try
|
||
If CONFIG.Config.TreeListSplitterWidth > 0 Then
|
||
SplitContainerTreeList.SplitterPosition = CONFIG.Config.TreeListSplitterWidth
|
||
End If
|
||
|
||
If CONFIG.Config.DocumentViewerSplitterWidth > 0 Then
|
||
SplitContainerDocView.SplitterPosition = CONFIG.Config.DocumentViewerSplitterWidth
|
||
End If
|
||
|
||
If CONFIG.Config.DocumentSearchSplitterWidth > 0 Then
|
||
SplitContainerDocumentSearch.SplitterPosition = CONFIG.Config.DocumentSearchSplitterWidth
|
||
End If
|
||
If DocViewInitialized Then
|
||
SplitContainerDocView.Collapsed = Not CONFIG.Config.DocumentViewerShown
|
||
Else
|
||
SplitContainerDocView.Collapsed = True
|
||
End If
|
||
|
||
checkShowPreview.Checked = CONFIG.Config.DocumentViewerShown
|
||
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", ex.Message, ex.StackTrace)
|
||
End Try
|
||
End Sub
|
||
Private Async Function frmNodeNavigation_Load(sender As Object, e As EventArgs) As Task Handles Me.Load
|
||
NNLogger.Debug("Loading NodeNavigation")
|
||
|
||
CONSTRUCTORID = CURRENT_CONSTRUCTOR_ID
|
||
|
||
DT_VWPMO_CONSTRUCTOR_FORMS = ClassFormCommands.LoadConstructorForms(CURRENT_SCREEN_ID, oConstructID, USER_LANGUAGE)
|
||
|
||
'Dim Sql = String.Format("SELECT *, [dbo].[FNPMO_GETOBJECTCAPTION]('{0}','FORMVIEW_TITLE' + CONVERT(VARCHAR(5), FORM_VIEW_ID), {1}) AS 'CAPTION' " &
|
||
' "FROM VWPMO_CONSTRUCTOR_FORMS WHERE SCREEN_ID = {2} AND CONSTRUCT_ID = {3} ORDER BY SEQUENCE", USER_LANGUAGE, CURRENT_SCREEN_ID, CURRENT_SCREEN_ID, oConstructID)
|
||
'DT_VWPMO_CONSTRUCTOR_FORMS = MYDB_ECM.GetDatatable(Sql)
|
||
|
||
CURRENT_DT_TBPMO_ENTITY_RIGHT_CONTROLS = MYDB_ECM.GetDatatable(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))
|
||
Try
|
||
If DocumentViewer.Init(LOGCONFIG, MYGDPICTURE_LICENSE_KEY, New DigitalData.Controls.DocumentViewer.DocumentViewer.ToolbarSettings() With {
|
||
.ShowPrintButton = True,
|
||
.ShowRotateButton = True,
|
||
.ShowFlipButton = True,
|
||
.ShowSettingButton = True
|
||
}) = False Then
|
||
MsgBox("Viewer konnte nicht initialisiert werden. Bitte informieren Sie den Systembetreuer und prüfen Ihr Log.", MsgBoxStyle.Information)
|
||
SplitContainerDocView.Collapsed = True
|
||
DocumentViewer.Visible = False
|
||
Else
|
||
DocumentViewer.Viewer_ForceTemporaryMode = CONFIG.Config.Viewer_ForceTemporaryMode
|
||
DocViewInitialized = True
|
||
End If
|
||
Catch ex As Exception
|
||
NNLogger.Warn($"Error while init DocumentViewer: {ex.Message}")
|
||
End Try
|
||
|
||
If USER_IS_ADMIN Then
|
||
TreeListDevexpress.ContextMenuStrip = CMSAdmin_Treeview
|
||
Else
|
||
TreeListDevexpress.ContextMenuStrip = Nothing
|
||
End If
|
||
|
||
' Hintergrund Bild initialisieren
|
||
'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 = MYDB_ECM.GetDatatable("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)
|
||
DT_ENTITY_DATA = MYDB_ECM.GetDatatable(SEL1)
|
||
|
||
SEL1 = String.Format("SELECT *, dbo.FNPMO_GET_CONTROL_CAPTION ('{0}', 1, CONTROL_ID) AS 'CAPTION' FROM VWPMO_CONTROL_SCREEN", USER_LANGUAGE)
|
||
DT_VWPMO_CONTROL_SCREEN = MYDB_ECM.GetDatatable(SEL1)
|
||
|
||
If DT_CONSTRUCT_VIEW.Rows.Count = 1 Then
|
||
'Load Input Grid
|
||
Me.Text = DT_CONSTRUCT_VIEW.Rows(0).Item("FORM_TITLE")
|
||
'Die Standards ein/ausblenden
|
||
End If
|
||
|
||
Load_Datafor_Entity()
|
||
If WM_READ_ONLY Then
|
||
tsitmDMSReadOnly.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
|
||
Else
|
||
tsitmDMSReadOnly.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
||
End If
|
||
FORM_LOADED = True
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", ex.Message, "Error in Loading Form part 4")
|
||
End Try
|
||
|
||
Await Load_nodes()
|
||
End Function
|
||
Private Async Function Load_nodes() As Task
|
||
Dim oHandle = SplashScreenManager.ShowOverlayForm(Me)
|
||
NNLogger.Debug("Loading nodes for entity [{0}]", CURRENT_ENTITY_ID)
|
||
|
||
Try
|
||
Dim oTable = Await ClassNodeCommands.LoadNodes(CURRENT_ENTITY_ID)
|
||
DT_STRUCTURE_NODES = oTable
|
||
|
||
Dim oNodeConfigSql = String.Format("select T.* from TBPMO_STRUCTURE_NODES_CONFIGURATION T INNER JOIN VWPMO_CONSTRUCTOR_FORMS T1 ON T.ENTITY_ID = T1.FORM_ID WHERE T.ENTITY_ID = {0}", CURRENT_ENTITY_ID)
|
||
Dim DT_TREEVIEW_CONFIGURATION = MYDB_ECM.GetDatatable(oNodeConfigSql)
|
||
For Each row As DataRow In DT_TREEVIEW_CONFIGURATION.Rows
|
||
Try
|
||
Dim bimage = row.ItemEx(Of Object)("NODE_IMAGE", Nothing)
|
||
If bimage Is Nothing Then
|
||
Continue For
|
||
End If
|
||
|
||
Dim oNodeImage = ByteArrayToBitmap(bimage)
|
||
ImageCollection1.AddImage(oNodeImage, row.Item("GUID"))
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
End Try
|
||
Next
|
||
|
||
TreeListDevexpress.DataSource = DT_STRUCTURE_NODES
|
||
TreeListDevexpress.KeyFieldName = "GUID"
|
||
TreeListDevexpress.ParentFieldName = "PARENT_GUID"
|
||
TreeListDevexpress.Columns("SEQUENCE").SortOrder = SortOrder.Ascending
|
||
TreeListDevexpress.StateImageList = ImageCollection1
|
||
|
||
Dim oVisibleColumns = New List(Of String) From {"NODE_CAPTION"} ', "NAVIGATION_PATH"}
|
||
For Each oColumn In TreeListDevexpress.Columns
|
||
If oVisibleColumns.Contains(oColumn.FieldName) = False Then
|
||
oColumn.Visible = False
|
||
End If
|
||
Next
|
||
|
||
JumptoNode()
|
||
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
Finally
|
||
SplashScreenManager.CloseOverlayForm(oHandle)
|
||
End Try
|
||
End Function
|
||
Private Sub TreeListDevexpress_ColumnFilterChanged(sender As Object, e As EventArgs)
|
||
Dim tree As TreeList = TryCast(sender, TreeList)
|
||
Dim filteredColumns As List(Of TreeListColumn) = tree.Columns.Cast(Of TreeListColumn)().Where(Function(c) c.FilterInfo.AutoFilterRowValue IsNot Nothing).ToList()
|
||
If filteredColumns.Count = 0 Then
|
||
tree.CollapseAll()
|
||
Return
|
||
End If
|
||
|
||
tree.BeginUpdate()
|
||
For Each col As TreeListColumn In filteredColumns
|
||
Dim op As New CollapseChildrenOperation(col.FilterInfo.AutoFilterRowValue.ToString(), col)
|
||
tree.NodesIterator.DoOperation(op)
|
||
Next col
|
||
tree.EndUpdate()
|
||
End Sub
|
||
Public Class CollapseChildrenOperation
|
||
Inherits TreeListOperation
|
||
|
||
Private filterValue As String
|
||
Private column As TreeListColumn
|
||
|
||
Public Sub New(ByVal filter As String, ByVal col As TreeListColumn)
|
||
filterValue = filter
|
||
column = col
|
||
End Sub
|
||
|
||
Private Function IsNodeMatchFilter(ByVal node As TreeListNode, ByVal column As TreeListColumn) As Boolean
|
||
Return node.GetDisplayText(column).Contains(filterValue)
|
||
End Function
|
||
Public Overrides Sub Execute(ByVal node As TreeListNode)
|
||
If IsNodeMatchFilter(node, column) Then
|
||
node.TreeList.MakeNodeVisible(node)
|
||
CollapseChildren(node)
|
||
End If
|
||
End Sub
|
||
|
||
Public Sub CollapseChildren(ByVal node As TreeListNode)
|
||
'node.Visible = true;
|
||
For Each childNode As TreeListNode In node.Nodes
|
||
CollapseChildren(childNode)
|
||
Next childNode
|
||
node.Expanded = False
|
||
End Sub
|
||
End Class
|
||
|
||
Private Async Sub TreeListDevexpress_FocusedNodeChanged(sender As Object, e As FocusedNodeChangedEventArgs) Handles TreeListDevexpress.FocusedNodeChanged
|
||
CURRENT_NODE_GUID = 0
|
||
If FORM_SHOWN = False Or oCollapseInAction Then
|
||
Exit Sub
|
||
End If
|
||
MyFocusedNode = Nothing
|
||
If btnCreateNewNode.Visibility = DevExpress.XtraBars.BarItemVisibility.Always Then
|
||
btnCreateNewNode.Enabled = False
|
||
End If
|
||
|
||
|
||
If RIGHT_RECORD_AND_FILE_READ_ONLY = True Then
|
||
Exit Sub
|
||
End If
|
||
|
||
If e.Node Is Nothing Then
|
||
Exit Sub
|
||
End If
|
||
|
||
'For Each treeListNode As TreeListNode In TreeListDevexpress.Selection
|
||
'FocusedNode = TreeListNode
|
||
|
||
MyFocusedNode = e.Node
|
||
|
||
RPGNodes.Enabled = True
|
||
|
||
Dim oNodeId = e.Node.Id
|
||
Console.Write($"Node ID: {oNodeId}")
|
||
|
||
|
||
|
||
Dim oRowObject = TreeListDevexpress.GetRow(oNodeId)
|
||
|
||
If TypeOf oRowObject IsNot DataRowView Then
|
||
Exit Sub
|
||
End If
|
||
|
||
'If oNodeId = 0 Then
|
||
' Exit Sub
|
||
'End If
|
||
|
||
Dim oRowView As DataRowView = oRowObject
|
||
Dim oRow As DataRow = oRowView.Row
|
||
Dim oGuid = oRow.Item("GUID")
|
||
Dim oNodeCaption = oRow.Item("NODE_CAPTION")
|
||
Dim oNodeConfigId = oRow.Item("NODE_CONFIG_ID")
|
||
Dim oRecordId = oRow.ItemEx("RECORD_ID", 0)
|
||
Dim oHasRecordId = (oRecordId > 0)
|
||
Dim oIsConfigNode = (oNodeConfigId = 1000)
|
||
Dim oParentNode = e.Node.ParentNode
|
||
Dim oLoadRecordData As Boolean = True
|
||
|
||
NodeGroupEnable(True)
|
||
Record_Group_Enable(False)
|
||
|
||
If ENTITY_TYPE = "Personal file" And oNodeConfigId <> PA_NODE_CONFIG_USER_STAMM Then
|
||
oLoadRecordData = False
|
||
End If
|
||
|
||
|
||
CURRENT_NODE_GUID = oNodeId
|
||
CURRENT_RECORD_ID = oRecordId
|
||
CURRENT_ENTITY_ID = _EntityId
|
||
SELECTED_NODE_CAPTION = oNodeCaption
|
||
|
||
' BEGIN NEW NODE
|
||
Dim oConfigNodeChildren = MyFocusedNode.Nodes.Where(Function(n) n.Item("TYPE_NODE") = 1000)
|
||
Dim oHasConfigNodeChildren = oConfigNodeChildren.Any()
|
||
Dim oConfigNodeChildrenList = oConfigNodeChildren.ToList()
|
||
|
||
CurrentNodeConfigId = oNodeConfigId
|
||
|
||
AvailableConfigNodes.Clear()
|
||
If btnCreateNewNode.Visibility = DevExpress.XtraBars.BarItemVisibility.Always And
|
||
Not IsNothing(NODE_CONFIGURABLE_NODES_DT) Then
|
||
Dim oNodeConfigList = NODE_CONFIGURABLE_NODES_DT.Select($"PARENT_NODE = {oNodeConfigId}").
|
||
Cast(Of DataRow).
|
||
Select(Function(row) New frmNewNode.NodeConfig() With {
|
||
.Id = row.Item("GUID"),
|
||
.Name = row.Item("NAME")
|
||
}).ToList()
|
||
AvailableConfigNodes = oNodeConfigList
|
||
|
||
If AvailableConfigNodes.Count > 0 Then
|
||
btnCreateNewNode.Enabled = True
|
||
Else
|
||
btnCreateNewNode.Enabled = False
|
||
End If
|
||
End If
|
||
|
||
|
||
' END NEW NODE
|
||
CURRENT_NODEID = oGuid
|
||
If oHasRecordId Then
|
||
Update_Status_Label(True, $"NodeID {oGuid} - RecordID {CURRENT_RECORD_ID}", EditState.None)
|
||
|
||
Node_AfterSelect = True
|
||
|
||
ClassHelper.GetDocrecordLinks(CURRENT_RECORD_ID)
|
||
|
||
|
||
CURRENT_SEARCH_TYPE = "RECORD"
|
||
DisableEditMode()
|
||
' muss vor show selected record data kommen,
|
||
' sodass die datasource für die angehakten werte existiert (checked list box)
|
||
CtrlBuilder.WatchRecordChanges = False
|
||
ClassControlValues.LoadControlValuesListWithPlaceholders(_EntityId, CURRENT_RECORD_ID, 0, CtrlBuilder.AllControls, _EntityId)
|
||
CtrlBuilder.WatchRecordChanges = True
|
||
|
||
Await Show_Selected_Record_Data(CURRENT_RECORD_ID, oLoadRecordData)
|
||
|
||
|
||
DocView_DisplaySelectedDoc(True)
|
||
ClassRightManagement.Check_Set_Rights(CURRENT_RECORD_ID, _EntityId)
|
||
CONTROL_HANDLING()
|
||
|
||
If RIGHT_RECORD_AND_FILE_READ_ONLY = False And CtrlCommandUI.IsInsert = False Then
|
||
If DT_CONTROLS_ENTITY.Rows.Count = COUNT_RO_CONTROLS Then
|
||
bbtnitmRecEdit.Enabled = False
|
||
bbtnitmRecSave.Enabled = False
|
||
Else
|
||
bbtnitmRecEdit.Enabled = True
|
||
End If
|
||
|
||
End If
|
||
|
||
If RIGHT_RECORD_AND_FILE_READ_ONLY = True Or oLoadRecordData = False Then
|
||
bbtnitmRecEdit.Enabled = False
|
||
bbtnitmRecSave.Enabled = False
|
||
btnCreateNewNode.Enabled = False
|
||
Else
|
||
Record_Group_Enable(True)
|
||
|
||
|
||
' btnCreateNewNode.Enabled = True
|
||
End If
|
||
|
||
If RIGHT_READ_ONLY_DOC = False Then
|
||
Doc_ReadOnlyHandler(True)
|
||
|
||
End If
|
||
'Liste der geänderten Control Values leeren
|
||
CtrlBuilder.ControlsChanged.Clear()
|
||
|
||
Load_DocGrid_Layout()
|
||
'Load_Grid_Layout()
|
||
'Load_Variants_Grid_Layout()
|
||
|
||
'swAll.Done()
|
||
Node_AfterSelect = False
|
||
|
||
Else
|
||
Update_Status_Label(True, $"NodeID {oGuid}", EditState.None)
|
||
|
||
ClassControlValues.ClearControlValues(pnlControls.Controls)
|
||
|
||
Await Show_Selected_Record_Data(0, oLoadRecordData)
|
||
End If
|
||
If ParentNodeChangeinAction = True And CURRENT_NODEID <> 0 Then
|
||
Dim result As DialogResult = Await ShowDialogAsync()
|
||
If result = DialogResult.Yes Then
|
||
Dim oSQL = $"UPDATE TBPMO_STRUCTURE_NODES SET PARENT_GUID = {CURRENT_NODEID} , CHANGED_WHO = '{USER_USERNAME}' WHERE GUID = {ChildNodeGuid}"
|
||
If MYDB_ECM.ExecuteNonQuery(oSQL) = True Then
|
||
ShowDialogAsync2()
|
||
Else
|
||
Console.WriteLine("Fehler")
|
||
End If
|
||
ParentNodeChangeinAction = False
|
||
Else
|
||
MessageBox.Show("Abgebrochen!", "Info")
|
||
End If
|
||
End If
|
||
End Sub
|
||
Public Async Function ShowDialogAsync() As Task(Of DialogResult)
|
||
Return Await Task.Run(Function()
|
||
Return MessageBox.Show("Der Parent-Node wird nun getauscht? Wollen Sie fortfahren?",
|
||
"Bestätigung erforderlich",
|
||
MessageBoxButtons.YesNo,
|
||
MessageBoxIcon.Question)
|
||
End Function)
|
||
End Function
|
||
Public Async Sub ShowDialogAsync2()
|
||
Await Task.Run(Sub()
|
||
MsgBox("Der Parent-Node wurde erfolgreich getauscht. Aktualisieren Sie nun die Ansicht!", MsgBoxStyle.Information)
|
||
End Sub)
|
||
End Sub
|
||
|
||
Public Sub Update_Document_Label(pDocumentCount As Integer)
|
||
Dim oMessage
|
||
|
||
If pDocumentCount = 0 Then
|
||
oMessage = "Keine Dateien für '"
|
||
|
||
If CURRENT_SEARCH_TYPE = "ENTITY" Then
|
||
oMessage &= " Sicht gefunden"
|
||
If USER_LANGUAGE <> "de-DE" Then
|
||
oMessage = "No files found for view: "
|
||
End If
|
||
|
||
ElseIf CURRENT_SEARCH_TYPE = "RECORD" Then
|
||
|
||
oMessage &= SELECTED_NODE_CAPTION & "' gefunden"
|
||
If USER_LANGUAGE <> "de-DE" Then
|
||
oMessage = "No files found for object '" & SELECTED_NODE_CAPTION & "'"
|
||
End If
|
||
|
||
If USER_LANGUAGE <> "de-DE" Then
|
||
oMessage = "No files found for record " & SELECTED_NODE_RECORD_ID
|
||
End If
|
||
|
||
ElseIf CURRENT_SEARCH_TYPE = "NODE_DOWN" Then
|
||
oMessage = "Keine Dateien für Knotenunterstruktur gefunden"
|
||
If USER_LANGUAGE <> "de-DE" Then
|
||
oMessage = "No files found in Node-Substructure"
|
||
End If
|
||
|
||
Else
|
||
oMessage = "Keine Dateien für Volltextsuche (" & CURRENT_FULLTEXT_PATTERN & ") gefunden"
|
||
If USER_LANGUAGE <> "de-DE" Then
|
||
oMessage = "No files found for fulltext-search (" & CURRENT_FULLTEXT_PATTERN & ")"
|
||
End If
|
||
|
||
End If
|
||
Else
|
||
oMessage = "Dateien für Record: " & SELECTED_NODE_RECORD_ID
|
||
|
||
If CURRENT_SEARCH_TYPE = "ENTITY" Then
|
||
|
||
oMessage = "Dateien für Sicht: "
|
||
If USER_LANGUAGE <> "de-DE" Then
|
||
oMessage = "files for view: "
|
||
End If
|
||
oMessage &= " (" & pDocumentCount.ToString & ")"
|
||
|
||
ElseIf CURRENT_SEARCH_TYPE = "RECORD" Then
|
||
oMessage = String.Format("Dateien für Objekt '{0}' ", SELECTED_NODE_CAPTION)
|
||
If USER_LANGUAGE <> "de-DE" Then
|
||
oMessage = String.Format("Files for Object '{0}'", SELECTED_NODE_CAPTION)
|
||
End If
|
||
oMessage &= " (" & pDocumentCount.ToString & ")"
|
||
|
||
ElseIf CURRENT_SEARCH_TYPE = "NODE_DOWN" Then
|
||
oMessage = "Dateien für Knotenunterstruktur"
|
||
If USER_LANGUAGE <> "de-DE" Then
|
||
oMessage = "files found in Node-Substructure"
|
||
End If
|
||
oMessage &= " (" & pDocumentCount.ToString & ")"
|
||
|
||
Else
|
||
oMessage = String.Format("Ergebnis der Volltextsuche")
|
||
If USER_LANGUAGE <> "de-DE" Then
|
||
oMessage = String.Format("Result of Fulltext-Search")
|
||
End If
|
||
oMessage &= " (" & pDocumentCount.ToString & ")"
|
||
|
||
End If
|
||
End If
|
||
|
||
GridViewDoc_Search.ViewCaption = oMessage
|
||
End Sub
|
||
|
||
Public Sub Update_Status_Label(visible As Boolean, Optional text As String = "", Optional state As EditState = EditState.None)
|
||
bsiInfo.Caption = text
|
||
If visible = True Then
|
||
bsiInfo.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
|
||
Else
|
||
bsiInfo.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
||
End If
|
||
|
||
|
||
Select Case state
|
||
Case EditState.Insert
|
||
bsiInfo.ItemAppearance.Normal.BackColor = Color.Yellow
|
||
Case EditState.Update
|
||
bsiInfo.ItemAppearance.Normal.BackColor = Color.LightBlue
|
||
Case Else
|
||
bsiInfo.ItemAppearance.Normal.BackColor = Color.LightGray
|
||
End Select
|
||
End Sub
|
||
Public Async Sub Update_Notification_Label(visible As Boolean, pMessage As String, pColor As String)
|
||
bsiNotification.Caption = pMessage + $" - {Now.ToLongTimeString}"
|
||
If visible = True Then
|
||
bsiNotification.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
|
||
Else
|
||
bsiNotification.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
||
End If
|
||
|
||
|
||
Select Case pColor
|
||
Case "Yellow"
|
||
bsiNotification.ItemAppearance.Normal.BackColor = Color.Yellow
|
||
Case "Blue"
|
||
bsiNotification.ItemAppearance.Normal.BackColor = Color.LightBlue
|
||
Case "Lime"
|
||
bsiNotification.ItemAppearance.Normal.BackColor = Color.LimeGreen
|
||
Case Else
|
||
bsiNotification.ItemAppearance.Normal.BackColor = Color.Transparent
|
||
End Select
|
||
End Sub
|
||
Public Sub Update_DocID_Label(visible As Boolean, Optional text As String = "", Optional state As EditState = EditState.None)
|
||
bsiDocID.Caption = text
|
||
If visible = True Then
|
||
bsiDocID.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
|
||
Else
|
||
bsiDocID.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
||
Exit Sub
|
||
End If
|
||
|
||
|
||
Select Case state
|
||
Case EditState.Insert
|
||
bsiDocID.ItemAppearance.Normal.BackColor = Color.Yellow
|
||
Case EditState.Update
|
||
bsiDocID.ItemAppearance.Normal.BackColor = Color.LightBlue
|
||
Case Else
|
||
bsiDocID.ItemAppearance.Normal.BackColor = Color.LightGray
|
||
End Select
|
||
End Sub
|
||
Private Sub TreeListDevexpress_GetStateImage(sender As Object, e As GetStateImageEventArgs) Handles TreeListDevexpress.GetStateImage
|
||
Dim Column_Config_ID As DevExpress.XtraTreeList.Columns.TreeListColumn = TreeListDevexpress.Columns("NODE_CONFIG_ID")
|
||
Dim configid = e.Node.GetDisplayText(Column_Config_ID)
|
||
|
||
e.Node.StateImageIndex = ImageCollection1.Images.Keys.IndexOf(configid)
|
||
End Sub
|
||
Sub Load_Adding_users()
|
||
Try
|
||
Dim oSql = String.Format("SELECT * FROM TBPMO_ENTITY_USERRIGHT_ADDING where ENTITY_ID IN (SELECT FORM_ID FROM VWPMO_CONSTRUCTOR_FORMS WHERE CONSTRUCT_ID = {0})", oConstructID)
|
||
DT_ADDING_USERS = MYDB_ECM.GetDatatable(oSql)
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", ex.Message, "Error in Load_Adding_users")
|
||
End Try
|
||
End Sub
|
||
Private Sub Load_Configurable_Nodes()
|
||
Try
|
||
btnCreateNewNode.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
||
Dim oSql = String.Format("SELECT * FROM TBPMO_STRUCTURE_NODES_CONFIGURATION where TYPE_NODE = 1000 AND ENTITY_ID IN (SELECT FORM_ID FROM VWPMO_CONSTRUCTOR_FORMS WHERE CONSTRUCT_ID = {0})", oConstructID)
|
||
NODE_CONFIGURABLE_NODES_DT = MYDB_ECM.GetDatatable(oSql)
|
||
If Not IsNothing(NODE_CONFIGURABLE_NODES_DT) Then
|
||
If NODE_CONFIGURABLE_NODES_DT.Rows.Count > 0 Then
|
||
btnCreateNewNode.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
|
||
End If
|
||
End If
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
NNLogger.Error(ex)
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", ex.Message, "Error in Load_Configurable_Nodes")
|
||
End Try
|
||
End Sub
|
||
Sub Load_Datafor_Entity()
|
||
NNLogger.Debug("Loading Data for Entity [{0}]", _EntityId)
|
||
|
||
Try
|
||
|
||
If _EntityId <> CURRENT_ENTITY_ID Then
|
||
NNLogger.Info("Entity-Data needs to be reloaded...")
|
||
|
||
CURRENT_ENTITY_ID = _EntityId
|
||
CURRENT_CONSTRUCTOR_ID = oConstructID
|
||
Load_Adding_users()
|
||
Load_Configurable_Nodes()
|
||
|
||
End If
|
||
|
||
|
||
Dim sw As New SW("Load_Datafor_Entity")
|
||
|
||
|
||
Dim result = (From form In DT_VWPMO_CONSTRUCTOR_FORMS.AsEnumerable()
|
||
Select form
|
||
Where form.Item("FORM_ID") = _EntityId).Single()
|
||
CONSTRUCTOR_DETAIL_ID = result.Item("GUID")
|
||
' CONSTRUCT_EXPAND = result.Item("EXPAND")
|
||
Dim FORM_DATE_FORMAT = result.Item("DATE_FORMAT")
|
||
If FORM_DATE_FORMAT <> USER_DATE_FORMAT Then
|
||
CURRENT_DATE_FORMAT = USER_DATE_FORMAT
|
||
Else
|
||
CURRENT_DATE_FORMAT = FORM_DATE_FORMAT
|
||
End If
|
||
'LOCK_CONTROLS_BG_LOAD = result.Item("LOCK_CONTROLS_BG_LOAD")
|
||
|
||
|
||
FAU_AD_DOMAIN = ""
|
||
FAU_AD_SERVER = ""
|
||
FAU_AD_USER = ""
|
||
FAU_AD_USER_PW = ""
|
||
If IsNothing(DT_ADDING_USERS) Then
|
||
Load_Adding_users()
|
||
End If
|
||
If DT_ADDING_USERS.Rows.Count > 0 Then
|
||
'Überprüfen ob für diese Entität ein spezifischer windream-User verwendet wird, wenn Dateien abgelegt werden?
|
||
Dim query1 = From _user In DT_ADDING_USERS.AsEnumerable()
|
||
Select _user Where _user.Item("ENTITY_ID") = _EntityId
|
||
Dim Rows1 = query1.ToList()
|
||
For Each _row In Rows1
|
||
FAU_AD_DOMAIN = _row.Item("AD_DOMAIN").ToString()
|
||
FAU_AD_SERVER = _row.Item("AD_SERVER").ToString()
|
||
FAU_AD_USER = _row.Item("AD_USER").ToString()
|
||
Dim wrapper As New ClassEncryption("!35452didalog=")
|
||
Dim PWplainText As String
|
||
' DecryptData throws if the wrong password is used.
|
||
Try
|
||
PWplainText = wrapper.DecryptData(_row.Item("AD_USER_PW").ToString())
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
NNLogger.Warn("- the Password for FileAddingUser '" & FAU_AD_USER & "' could not be decrypted")
|
||
PWplainText = ""
|
||
End Try
|
||
FAU_AD_USER_PW = PWplainText
|
||
Next
|
||
End If
|
||
sw.Done()
|
||
Load_Entity_Data_CONTROLS_RECORDS()
|
||
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", ex.Message, "Load_Datafor_Entity: " & ex.StackTrace)
|
||
End Try
|
||
|
||
End Sub
|
||
Sub Load_Entity_Data_CONTROLS_RECORDS()
|
||
Try
|
||
NNLogger.Debug("START Load_Entity_Data")
|
||
Dim sw As New SW("Load_Entity_Data")
|
||
' Me.Cursor = Cursors.WaitCursor
|
||
RECORD_CHANGED = False
|
||
SELECTED_NODE_RECORD_ID = 0
|
||
Dim expression As String
|
||
Dim sql
|
||
'Dim sql = "SELECT CONTROL_ID, CONTROL_READ_ONLY FROM VWPMO_CONTROL_SCREEN WHERE CTRLTYPE_ID NOT IN (1) AND CONTROL_ENTITY_ID = " & oEntityID
|
||
DT_CONTROLS_ENTITY = ClassHelper.FILTER_DATATABLE(DT_VWPMO_CONTROL_SCREEN, "CTRLTYPE_ID NOT IN (1) AND CONTROL_ENTITY_ID = " & _EntityId, "")
|
||
|
||
|
||
expression = "CONTROL_READ_ONLY = " & 1
|
||
Dim CONTROLS_ROW() As DataRow
|
||
CONTROLS_ROW = DT_CONTROLS_ENTITY.Select(expression)
|
||
Dim i As Integer
|
||
' Count the locked controls
|
||
For i = 0 To CONTROLS_ROW.GetUpperBound(0)
|
||
COUNT_RO_CONTROLS += 1
|
||
Next
|
||
If DT_CONTROLS_ENTITY.Rows.Count = COUNT_RO_CONTROLS Then
|
||
bbtnitmRecEdit.Enabled = False
|
||
bbtnitmRecSave.Enabled = False
|
||
'tsButtonDelete.Enabled = False
|
||
Else
|
||
bbtnitmRecEdit.Enabled = True
|
||
bbtnitmRecSave.Enabled = True
|
||
' tsButtonDelete.Enabled = True
|
||
End If
|
||
|
||
Dim oRow = (From form In DT_VWPMO_CONSTRUCTOR_FORMS.AsEnumerable()
|
||
Select form
|
||
Where form.Item("FORM_ID") = _EntityId).Single()
|
||
|
||
|
||
CURRENT_CONSTRUCTOR_DETAIL_ID = oRow.Item("GUID")
|
||
CONTROL_DOCTYPE_MATCH = oRow.Item("CONTROL_DOCTYPE_MATCH")
|
||
SQL_RECORD_AND_FILE_READ_ONLY = oRow.Item("SQL_RIGHT_READ_AND_VIEW_ONLY")
|
||
SQL_DOC_READ_ONLY = oRow.Item("SQL_RIGHT_WINDREAM_VIEW")
|
||
ENTITY_TYPE = oRow.Item("FORM_TYPE")
|
||
Try
|
||
ADD_RECORDS_CONSTR = oRow.Item("ADD_RECORDS")
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
ADD_RECORDS_CONSTR = True
|
||
End Try
|
||
If ENTITY_TYPE = "Personal file" Then
|
||
Dim oSQL = "SELECT CAT_STRING FROM TBDD_CATALOG WHERE CAT_TITLE = 'PA_NODE_GUID_STAMM'"
|
||
PA_NODE_GUID_STAMM = MYDB_ECM.GetScalarValue(oSQL)
|
||
oSQL = "SELECT CAT_STRING FROM TBDD_CATALOG WHERE CAT_TITLE = 'PA_NODE_CONFIG_USER_STAMM'"
|
||
PA_NODE_CONFIG_USER_STAMM = MYDB_ECM.GetScalarValue(oSQL)
|
||
End If
|
||
|
||
|
||
expression = String.Format("ENTITY_ID = {0} AND LANGUAGE = '{1}'", _EntityId, USER_LANGUAGE)
|
||
DT_COLUMNS_GRID_ENTITY = ClassHelper.FILTER_DATATABLE(DT_DOCSEARCH_RESULTLIST_CONFIG, expression, "SEQUENCE")
|
||
expression = String.Format("ENTITY_ID = {0} AND TYPE_ID = 10 AND LANGUAGE = '{1}'", _EntityId, USER_LANGUAGE)
|
||
DT_DOCRESULT_DROPDOWN_ITEMS = ClassHelper.FILTER_DATATABLE(CURRENT_TBPMO_DOCRESULT_DROPDOWN_ITEMS, expression, "SEQUENCE")
|
||
NNLogger.Debug($"Found {DT_DOCRESULT_DROPDOWN_ITEMS.Rows.Count} DT_DOCRESULT_DROPDOWN_ITEMS!")
|
||
DT_RESULTLIST_OPTIONS = ClassHelper.FILTER_DATATABLE(CURRENT_VARIABLE_CONTROLS, "ENTITY_ID = " & _EntityId, "")
|
||
expression = String.Format("ENTITY_ID = {0} AND LANGUAGE = '{1}' AND COLUMN_VIEW LIKE 'VALUE%'", _EntityId, USER_LANGUAGE)
|
||
DT_RESULTLIST_VARIABLE_VALUE = ClassHelper.FILTER_DATATABLE(DT_DOCSEARCH_RESULTLIST_CONFIG, expression, "SEQUENCE")
|
||
Dim ENTITY_ROW = (From form In DT_ENTITY_DATA.AsEnumerable()
|
||
Select form
|
||
Where form.Item("GUID") = _EntityId).Single()
|
||
|
||
|
||
'sql = String.Format("select * from TBPMO_RIGHT_USER WHERE USER_ID = {0} AND oEntityID = {1}", USER_GUID, oEntityID)
|
||
DT_RIGHTS_USER = ClassHelper.FILTER_DATATABLE(CURRENT_TBPMO_RIGHT_USER, "ENTITY_ID = " & _EntityId, "")
|
||
expression = String.Format("")
|
||
sql = String.Format("SELECT DISTINCT EDIT_REC,ADD_REC,DELETE_REC,ADD_DOC,VIEW_DOC,DELETE_DOC FROM TBPMO_RIGHT_GROUP WHERE ENTITY_ID = {0} AND GROUP_ID IN (SELECT GROUP_ID FROM TBDD_GROUPS_USER WHERE USER_ID = {1})", _EntityId, USER_GUID)
|
||
DT_RIGHTS_GROUP = MYDB_ECM.GetDatatable(sql)
|
||
sql = String.Format("SELECT VIEW_ID FROM TBPMO_USER_CONSTR_VIEW_TYPE WHERE CONSTRUCTOR_DETAIL_ID = {0} AND [ENTITY_ID] = {1} AND USER_ID = {2}", CURRENT_CONSTRUCTOR_DETAIL_ID, _EntityId, USER_GUID)
|
||
|
||
|
||
SELECTED_NODE_RECORD_ID = 0
|
||
|
||
' LINQ für Zugriff auf DT_VWPMO_CONSTRUCTOR_FORMS
|
||
Dim result1 = (From form In DT_VWPMO_CONSTRUCTOR_FORMS.AsEnumerable()
|
||
Select form
|
||
Where form.Item("FORM_ID") = _EntityId).Single()
|
||
CURRENT_PARENT_ENTITY_ID = 0
|
||
|
||
|
||
' LINQ für Zugriff auf DT_VWPMO_CONSTRUCTOR_FORMS
|
||
Dim query = From form In DT_VWPMO_CONSTRUCTOR_FORMS.AsEnumerable()
|
||
Select form
|
||
Where form.Item("FORM_ID") = _EntityId
|
||
|
||
Dim QuickViewSQL = query.Single().Item("SQL_QUICK_VIEW")
|
||
|
||
CURRENT_ENTITYSQL = Get_Grid_Sql_NODE_NAV(CONSTRUCTORID, _EntityId, CURRENT_CONSTRUCTOR_DETAIL_ID, USER_GUID)
|
||
|
||
ClassDOC_SEARCH.Get_DOC_RESULTTABLE(DT_RESULTLIST_OPTIONS, DT_RESULTLIST_VARIABLE_VALUE, DT_COLUMNS_GRID_ENTITY, _EntityId, SELECTED_NODE_RECORD_ID, True, True)
|
||
|
||
DT_TBPMO_FORM_VIEW = ClassHelper.FILTER_DATATABLE(CURRENT_TBPMO_FORM_VIEW, "FORM_ID = " & _EntityId & " AND SCREEN_ID = " & CURRENT_SCREEN_ID, "")
|
||
CURRENT_ENTITYSTRING = DT_TBPMO_FORM_VIEW.Rows(0).Item("FORM_TITLE")
|
||
|
||
FORMVIEW_ID = DT_TBPMO_FORM_VIEW.Rows(0).Item("GUID")
|
||
|
||
Load_Controls(FORMVIEW_ID)
|
||
|
||
Try
|
||
Dim async As New ClassAsyncSQL(CURRENT_ENTITYSQL)
|
||
async.bw.RunWorkerAsync()
|
||
While async.bw.IsBusy
|
||
Application.DoEvents()
|
||
End While
|
||
CURRENT_DT_ENTITY_RECORDS = async.dt
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error Async EntitySQL", ex.Message, ex.StackTrace)
|
||
End Try
|
||
|
||
|
||
If IsNothing(CURRENT_DT_ENTITY_RECORDS) Then
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", "Error in getting Entity-Data - Check logfile")
|
||
Else
|
||
CURRENT_DT_ENTITY_RECORDS.TableName = "VWPMO_ENTITY_TABLE" & _EntityId
|
||
' Dim SQL_AutoValues = "SELECT GUID AS CONTROL_ID, CONNECTION_ID_1 AS CONNECTION_ID, SQL_COMMAND_1 AS SQL_COMMAND FROM TBPMO_CONTROL WHERE CONNECTION_ID_1 <> '' AND SQL_COMMAND_1 <> '' AND FORM_ID = " & oEntityID
|
||
|
||
Dim DT_AUTOVALUES = ClassHelper.FILTER_DATATABLE(CURRENT_TBPMO_CONTROL, "CONNECTION_ID_1 > 0 AND SQL_COMMAND_1 <> '' AND FORM_ID = " & _EntityId, "")
|
||
|
||
|
||
CURRENT_SQL_AUTO_VALUES_DT = DT_AUTOVALUES
|
||
|
||
Try
|
||
Dim primaryKey(1) As DataColumn
|
||
primaryKey(0) = CURRENT_DT_ENTITY_RECORDS.Columns("Record-ID")
|
||
CURRENT_DT_ENTITY_RECORDS.PrimaryKey = primaryKey
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
NNLogger.Warn("Could not set the primary Key(Record-ID): " & ex.Message)
|
||
End Try
|
||
|
||
CtrlBuilder.WatchRecordChanges = False
|
||
ClassControlValues.LoadControlValuesList(_EntityId, CtrlBuilder.MasterPanel.Controls)
|
||
CtrlBuilder.WatchRecordChanges = True
|
||
|
||
'Zurücksetzen
|
||
ENTITY_LOADING_PROCESS = True
|
||
Dim RecLoaded As Boolean = False
|
||
|
||
End If
|
||
Load_Splitter_Layout()
|
||
sw.Done()
|
||
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error in Load_Entity_Data", ex.Message, ex.StackTrace)
|
||
Finally
|
||
'Me.Cursor = Cursors.Default
|
||
ENTITY_LOADING_PROCESS = True
|
||
End Try
|
||
|
||
|
||
End Sub
|
||
Sub Update_Record_Label(RecordId As Integer)
|
||
Try
|
||
Dim oSql As String = $"SELECT
|
||
ADDED_WHO,
|
||
CONVERT(VARCHAR(16),ADDED_WHEN,20) AS ADDED_WHEN,
|
||
COALESCE(CHANGED_WHO,'') AS CHANGED_WHO,
|
||
COALESCE(CONVERT(VARCHAR(16),CHANGED_WHEN,20),'') AS CHANGED_WHEN
|
||
FROM TBPMO_RECORD WHERE GUID = {RecordId}"
|
||
|
||
Dim oTable As DataTable
|
||
oTable = MYDB_ECM.GetDatatable(oSql)
|
||
|
||
If Not IsNothing(oTable) Then
|
||
If oTable.Rows.Count = 0 Then
|
||
bsitmRecordID.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
||
Exit Sub
|
||
End If
|
||
|
||
Dim oRow As DataRow = oTable.Rows(0)
|
||
|
||
bsitmRecordID.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
|
||
|
||
Dim oAddedWho = oRow.Item(0)
|
||
Dim oAddedWhen = oRow.Item(1)
|
||
Dim oChangedWho = oRow.Item(2)
|
||
Dim oChangedWhen = oRow.Item(3)
|
||
|
||
Dim CreateChangeString = String.Format("Added by '{0}', when: {1}", oAddedWho, oAddedWhen)
|
||
|
||
If CtrlCommandUI.IsInsert = False AndAlso (oRow.ItemEx(2, "") <> "") Then
|
||
CreateChangeString += String.Format(" - Changed by '{0}', when: {1}", oChangedWho, oChangedWhen)
|
||
End If
|
||
|
||
'bsitmRecordID.Caption = String.Format("Record ({0}) - {1}", RecordId, CreateChangeString.ToString)
|
||
bsitmRecordID.Caption = String.Format("{0}", CreateChangeString.ToString)
|
||
|
||
|
||
End If
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", ex.Message, ex.StackTrace)
|
||
End Try
|
||
|
||
End Sub
|
||
Private Async Function Show_Selected_Record_Data(pRecordId As Integer, pLoadRecordData As Boolean) As Task
|
||
Dim oHandle = SplashScreenManager.ShowOverlayForm(Me)
|
||
|
||
Try
|
||
NNLogger.Debug("Show_Selected_Record_Data: " & pRecordId.ToString)
|
||
Dim ENTITY_ROW = (From form In DT_ENTITY_DATA.AsEnumerable()
|
||
Select form
|
||
Where form.Item("GUID") = _EntityId).Single()
|
||
|
||
'Update_Status_Label(False, "")
|
||
NNLogger.Debug("RECORD ID: " & pRecordId.ToString)
|
||
'Me.pnlControls.Visible = True
|
||
|
||
SELECTED_NODE_RECORD_ID = pRecordId
|
||
CURRENT_PARENT_RECORD_ID = 0
|
||
|
||
RIGHT_CONTROL_CHANGED = False
|
||
|
||
ENTITY_RELOAD_AFT_CONTROL_LOAD = False
|
||
CtrlBuilder.WatchRecordChanges = False
|
||
If pnlControls.Enabled = False Then pnlControls.Enabled = True
|
||
If pLoadRecordData = True Then
|
||
ClassControlValues.LoadControlValues(SELECTED_NODE_RECORD_ID, 0, _EntityId, CtrlBuilder.AllControls, _EntityId)
|
||
CtrlBuilder.WatchRecordChanges = True
|
||
End If
|
||
|
||
|
||
Dim sw As New SW("Show Selected RecordData 2")
|
||
' Laden der Daten bedeutet nicht dass Daten vom Benutzer geändert wurden!
|
||
RECORD_CHANGED = False
|
||
'Refresh_Navpane()
|
||
Update_Record_Label(SELECTED_NODE_RECORD_ID)
|
||
|
||
Dim oDocumentsFound = Await RUN_DOCSEARCH(True)
|
||
|
||
If DocViewInitialized Then
|
||
If oDocumentsFound = 0 Then
|
||
Close_Document_Viewer()
|
||
RibbonPageGroupDocResult.Enabled = False
|
||
SplitContainerDocView.Collapsed = True
|
||
Else
|
||
RibbonPageGroupDocResult.Enabled = True
|
||
If Node_AfterSelect = False Then
|
||
SplitContainerDocView.Collapsed = Not CONFIG.Config.DocumentViewerShown
|
||
Else
|
||
SplitContainerDocView.Collapsed = True
|
||
End If
|
||
|
||
End If
|
||
End If
|
||
|
||
|
||
|
||
Update_Document_Label(oDocumentsFound)
|
||
|
||
sw.Done()
|
||
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", "Error in SelectedRecord_ShowData: ", ex.Message)
|
||
Finally
|
||
SplashScreenManager.CloseOverlayForm(oHandle)
|
||
End Try
|
||
End Function
|
||
|
||
#Region "Controls"
|
||
Sub Load_Controls(frmview_id As Integer)
|
||
Dim sw As New SW("Load_Controls")
|
||
FORMVIEW_ID = frmview_id
|
||
_EntityId = DT_TBPMO_FORM_VIEW.Rows(0).Item("FORM_ID")
|
||
CURRENT_ENTITY_ID = _EntityId
|
||
CtrlBuilder = New ClassControlBuilder(pnlControls)
|
||
CtrlCommandUI = New ClassControlCommandsUI(CtrlBuilder,
|
||
ContextMenuDetails,
|
||
AddressOf NewEditAppointment)
|
||
|
||
CtrlCommandUI.LoadControls(_EntityId)
|
||
Lock_RecordControls(True)
|
||
|
||
AddHandler CtrlBuilder.OnRecordChanged, AddressOf OnRecordChanged
|
||
' AddHandler CtrlBuilder.OnMouseHover, AddressOf HandleToolTip
|
||
sw.Done()
|
||
End Sub
|
||
Private Sub OnRecordChanged(sender As Object, e As System.EventArgs)
|
||
If ENTITY_LOADING_PROCESS Then
|
||
RECORD_CHANGED = True
|
||
End If
|
||
|
||
End Sub
|
||
'Private Sub HandleToolTip(sender As Object, e As EventArgs)
|
||
' Dim control As Windows.Forms.Control = DirectCast(sender, Windows.Forms.Control)
|
||
' Dim id As Integer = DirectCast(control.Tag, ClassControlMetadata).Id
|
||
|
||
' Dim hint = ClassControlValueCache.LoadHint(id)
|
||
' If Not IsNothing(hint) Then
|
||
' 'show hint
|
||
' Console.WriteLine("Showing hint: " & hint)
|
||
' ToolTipController.ShowHint(hint.ToString, ToolTipLocation.RightCenter)
|
||
' Else
|
||
' ToolTipController.HideHint()
|
||
' End If
|
||
|
||
'End Sub
|
||
Sub Lock_RecordControls(state As Boolean)
|
||
Lock_Record_Controls_Recursive(state, pnlControls.Controls)
|
||
End Sub
|
||
Sub Lock_Record_Controls_Recursive(state As Boolean, controls As System.Windows.Forms.Control.ControlCollection)
|
||
For Each Control As System.Windows.Forms.Control In controls
|
||
Dim controlId As Integer = DirectCast(Control.Tag, ClassControlMetadata).Id
|
||
Select Case Control.GetType()
|
||
Case GetType(System.Windows.Forms.GroupBox)
|
||
Lock_Record_Controls_Recursive(state, DirectCast(Control, GroupBox).Controls)
|
||
Case GetType(System.Windows.Forms.TextBox)
|
||
Dim txt As System.Windows.Forms.TextBox = CType(Control, System.Windows.Forms.TextBox)
|
||
txt.ReadOnly = CHECK_CONTROL_CONFIGURED_RO(controlId, state)
|
||
Case Else
|
||
Control.Enabled = Not CHECK_CONTROL_CONFIGURED_RO(controlId, state) 'state
|
||
|
||
End Select
|
||
Next
|
||
End Sub
|
||
Private Function CHECK_CONTROL_CONFIGURED_RO(CONTROL_ID As Integer, state As Boolean)
|
||
Try
|
||
' LINQ für Zugriff auf DT_VWPMO_CONSTRUCTOR_FORMS
|
||
Dim result1 = (From form In DT_CONTROLS_ENTITY.AsEnumerable()
|
||
Select form
|
||
Where form.Item("CONTROL_ID") = CONTROL_ID).SingleOrDefault()
|
||
If Not IsNothing(result1) Then
|
||
Dim locked = result1.Item("CONTROL_READ_ONLY")
|
||
If state = False And locked = True Then
|
||
state = True
|
||
End If
|
||
End If
|
||
|
||
Return state
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
Return state
|
||
End Try
|
||
End Function
|
||
Sub CONTROL_HANDLING()
|
||
Dim sw As New SW("CONTROL_HANDLING")
|
||
bbtnitmRecSave.Enabled = True
|
||
|
||
|
||
bbtnitmRecEdit.Enabled = True
|
||
'tsButtonDelete.Enabled = True
|
||
|
||
'tslblLocked.Visible = False
|
||
'tslblFileslocked.Visible = False
|
||
|
||
'pnlPositions.Enabled = True
|
||
|
||
|
||
If SQL_RECORD_AND_FILE_READ_ONLY <> "" Or SQL_DOC_READ_ONLY <> "" Then
|
||
If RIGHT_RECORD_AND_FILE_READ_ONLY = True Then
|
||
|
||
bbtnitmRecEdit.Enabled = False
|
||
bbtnitmRecSave.Enabled = False
|
||
'tsButtonDelete.Enabled = False
|
||
'tslblLocked.Visible = True
|
||
'TabFollowUp.PageEnabled = False
|
||
'tsmiMassChanges.Enabled = False
|
||
|
||
End If
|
||
If RIGHT_READ_ONLY_DOC = True Then
|
||
' tslblFileslocked.Visible = True
|
||
Doc_ReadOnlyHandler(False)
|
||
End If
|
||
|
||
Else
|
||
If DT_RIGHTS_GROUP.Rows.Count > 0 Or DT_RIGHTS_USER.Rows.Count > 0 Then
|
||
'DATENSATZ-RECHTE
|
||
If RIGHT_ADD_R = False Then
|
||
' tsButtonAdd.Enabled = False
|
||
|
||
End If
|
||
If RIGHT_EDIT_R = False Then
|
||
' tslblLocked.Visible = True
|
||
bbtnitmRecEdit.Enabled = False
|
||
bbtnitmRecSave.Enabled = False
|
||
' tsButtonDelete.Enabled = False
|
||
' tsmiMassChanges.Enabled = False
|
||
If RIGHT_ADD_R = False Then
|
||
bbtnitmRecSave.Enabled = False
|
||
End If
|
||
End If
|
||
If RIGHT_DELETE_R = False Then
|
||
' tsButtonDelete.Enabled = False
|
||
End If
|
||
'DATEI-RECHTE
|
||
If RIGHT_READ_ONLY_DOC = True Then
|
||
' tslblFileslocked.Visible = True
|
||
End If
|
||
End If
|
||
End If
|
||
sw.Done()
|
||
End Sub
|
||
#End Region
|
||
#Region "Appointments"
|
||
Sub NewEditAppointment(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
|
||
Try
|
||
Dim ctrl As Windows.Forms.Control = sender
|
||
ClassFunctionCommandsUI.NewEditAppointment(ctrl.Name, _EntityId, SELECTED_NODE_RECORD_ID, pnlControls.Controls)
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", ex.Message, ex.StackTrace)
|
||
End Try
|
||
End Sub
|
||
|
||
Sub EditAppointment(ByVal sender As Windows.Forms.Control, FormID As Integer)
|
||
Try
|
||
' Load All appointments first
|
||
frmCalendar.TBPMO_RESOURCESTableAdapter.Fill(frmCalendar.DD_DMSDataSetCalendar.TBPMO_RESOURCES)
|
||
frmCalendar.TBPMO_APPOINTMENTSTableAdapter.Fill(frmCalendar.DD_DMSDataSetCalendar.TBPMO_APPOINTMENTS)
|
||
|
||
Dim apt As Appointment = frmCalendar.SchedulerStorage1.Appointments.Items.Find(AddressOf FindAppointment)
|
||
If apt IsNot Nothing Then
|
||
frmCalendar.SchedulerControl1.ShowEditAppointmentForm(apt)
|
||
End If
|
||
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", ex.Message, ex.StackTrace)
|
||
End Try
|
||
End Sub
|
||
|
||
Private Function FindAppointment(ByVal apt As Appointment) As Boolean
|
||
Return Convert.ToInt32(apt.CustomFields("RecordID")) = SELECTED_NODE_RECORD_ID
|
||
End Function
|
||
#End Region
|
||
|
||
Sub Doc_ReadOnlyHandler(state As Boolean)
|
||
Dim sw As New SW("Doc_ReadOnlyHandler")
|
||
If state = False Then
|
||
GridControlDocSearch.ContextMenuStrip = cmsResultFilesBasic
|
||
'tslblDocViewLocked.Visible = True
|
||
ElseIf state = True Then
|
||
GridControlDocSearch.ContextMenuStrip = cmsResultFileDetail
|
||
' tslblDocViewLocked.Visible = False
|
||
End If
|
||
sw.Done()
|
||
End Sub
|
||
|
||
Private LastFindFilterText As String = ""
|
||
|
||
Private Sub TreeListDevexpress_ColumnFilterChanged_1(sender As Object, e As EventArgs) Handles TreeListDevexpress.ColumnFilterChanged
|
||
'oFilterActive = True
|
||
'If TreeListDevexpress.FindFilterText <> "" Then
|
||
Dim oFilterText As String = TreeListDevexpress.FindFilterText
|
||
'Dim oNode = TreeListDevexpress.FocusedNode
|
||
|
||
If LastFindFilterText <> "" And oFilterText = "" Then
|
||
If Not IsNothing(MyFocusedNode) Then
|
||
oCollapseInAction = True
|
||
TreeListDevexpress.CollapseAll()
|
||
TreeListDevexpress.FocusedNode = MyFocusedNode
|
||
TreeListDevexpress.MakeNodeVisible(MyFocusedNode)
|
||
oCollapseInAction = False
|
||
End If
|
||
ElseIf oFilterText <> "" Then
|
||
TreeListDevexpress.OptionsView.ShowFilterPanelMode = ShowFilterPanelMode.ShowAlways
|
||
ElseIf oFilterText = "" Then
|
||
TreeListDevexpress.OptionsView.ShowFilterPanelMode = ShowFilterPanelMode.Never
|
||
|
||
End If
|
||
|
||
LastFindFilterText = oFilterText
|
||
' End If
|
||
End Sub
|
||
Private Sub TreeListDevexpress_ParseFindPanelText(sender As Object, e As ParseFindPanelTextEventArgs) Handles TreeListDevexpress.ParseFindPanelText
|
||
' Exit if the search text is empty
|
||
If String.IsNullOrWhiteSpace(e.FindPanelText) Then
|
||
Return
|
||
End If
|
||
|
||
Dim oInput As String = e.FindPanelText
|
||
|
||
' Split the search text into individual criteria
|
||
Dim criteriaStrings As String() = New String() {oInput} '.Split(New Char() {" "c}, StringSplitOptions.RemoveEmptyEntries)
|
||
|
||
' Construct the filter string by searching in the desired fields
|
||
Dim filterConditions As IEnumerable(Of String) = criteriaStrings.Select(Function(str) _
|
||
$"Contains([NODE_CAPTION], '{str}') OR Contains([NAVIGATION_PATH], '{str}')")
|
||
|
||
' Join the conditions with OR
|
||
Dim filterString As String = String.Join(" OR ", filterConditions)
|
||
|
||
' Parse the filter string into a CriteriaOperator
|
||
Dim findCriteria As CriteriaOperator = CriteriaOperator.Parse(filterString)
|
||
|
||
' Set the find criteria for the TreeList
|
||
e.SetFindCriteria(findCriteria)
|
||
' TreeListDevexpress.ActiveFilterCriteria = findCriteria
|
||
' Mark the event as handled
|
||
e.Handled = True
|
||
End Sub
|
||
'Private Sub TreeListDevexpress_DoubleClick(sender As Object, e As EventArgs) Handles TreeListDevexpress.DoubleClick
|
||
' If TreeListDevexpress.FindFilterText <> "" Then
|
||
' TreeListDevexpress.FindFilterText = ""
|
||
' End If
|
||
' MyFocusedNode = Nothing
|
||
' Dim oMyTreeList As TreeList = sender
|
||
' Dim oTlHI As TreeListHitInfo = oMyTreeList.CalcHitInfo(oMyTreeList.PointToClient(MousePosition))
|
||
' If Not IsNothing(oTlHI.Node) Then
|
||
' MyFocusedNode = sender
|
||
' End If
|
||
|
||
|
||
'End Sub
|
||
'Private Async Sub LoadRecord(pRecord As Integer)
|
||
' Try
|
||
' CURRENT_RECORD_ID = pRecord
|
||
' CURRENT_SEARCH_TYPE = "RECORD"
|
||
' ClassHelper.GetDocrecordLinks(CURRENT_RECORD_ID)
|
||
|
||
' 'Wird jetzt bei BeforeRowChange überprüft
|
||
|
||
' DisableEditMode()
|
||
|
||
' ' muss vor show selected record data kommen,
|
||
' ' sodass die datasource für die angehakten werte existiert (checked list box)
|
||
' CtrlBuilder.WatchRecordChanges = False
|
||
|
||
' ClassControlValues.LoadControlValuesListWithPlaceholders(CURRENT_ENTITY_ID, CURRENT_RECORD_ID, 0, CtrlBuilder.AllControls, _EntityId)
|
||
' CtrlBuilder.WatchRecordChanges = True
|
||
' If CURRENT_RECORD_ID > 0 Then
|
||
' Await Show_Selected_Record_Data(CURRENT_RECORD_ID)
|
||
' End If
|
||
|
||
|
||
' ClassRightManagement.Check_Set_Rights(CURRENT_RECORD_ID, _EntityId)
|
||
' CONTROL_HANDLING()
|
||
|
||
|
||
|
||
' If CURRENT_RECORD_ID > 0 Then
|
||
' If RIGHT_RECORD_AND_FILE_READ_ONLY = False And CtrlCommandUI.IsInsert = False Then
|
||
' If DT_CONTROLS_ENTITY.Rows.Count = COUNT_RO_CONTROLS Then
|
||
' bbtnitmRecEdit.Enabled = False
|
||
' bbtnitmRecSave.Enabled = False
|
||
' 'tsButtonDelete.Enabled = False
|
||
' Else
|
||
' ' bbtnitmEditRec.Enabled = True
|
||
' End If
|
||
|
||
' End If
|
||
' If RIGHT_RECORD_AND_FILE_READ_ONLY = True Then
|
||
' ' bbtniCopyRecord.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
||
' ' bbtniNewVariant2.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
||
' ' bbtniParentLink.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
||
' ' bbtniWFTask.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
||
' Else
|
||
' ' bbtniCopyRecord.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
|
||
' ' bbtniNewVariant2.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
|
||
' ' bbtniParentLink.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
|
||
' ' bbtniWFTask.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
|
||
' End If
|
||
|
||
' 'tsButtonAdd.Enabled = False
|
||
' 'MsgBox(SplitContainerFORM.Collapsed)
|
||
' 'MsgBox(SplitContainerMain.Collapsed)
|
||
' 'MsgBox(SplitContainerTop.Collapsed)
|
||
|
||
|
||
|
||
|
||
' End If
|
||
' 'Liste der geänderten Control Values leeren
|
||
' CtrlBuilder.ControlsChanged.Clear()
|
||
|
||
|
||
' Catch ex As Exception
|
||
'NNLogger.Error(ex)
|
||
' ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error:", ex.Message & vbNewLine & ex.StackTrace)
|
||
' End Try
|
||
'End Sub
|
||
|
||
Private Sub DateiÖffnenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DateiÖffnenToolStripMenuItem.Click
|
||
Open_File()
|
||
End Sub
|
||
|
||
Private Sub frmNodeNavigation_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
|
||
If TrySave_Automatic() = False Then
|
||
e.Cancel = True
|
||
End If
|
||
|
||
Save_Splitter_Layout()
|
||
|
||
ClassWindowLocation.SaveFormLocationSize(Me, CONSTRUCTORID, CURRENT_SCREEN_ID, "NODE_NAVIGATION")
|
||
|
||
CURRENT_OPEN_CONSTRUCTOR_FORMS.Remove(CONSTRUCTORID)
|
||
|
||
' Verhindert, das noch geöffnete Records für immer gelockt sind
|
||
If Not IsNothing(CURRENT_DOCVIEW) Then
|
||
Try
|
||
CURRENT_DOCVIEW.CloseView(CURRENT_DOCVIEW_PATH, 0)
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
End Try
|
||
End If
|
||
End Sub
|
||
|
||
Private Sub pnlControls_Enter(sender As Object, e As EventArgs) Handles pnlControls.Enter
|
||
Record_Group_Enable(True)
|
||
NodeGroupEnable(False)
|
||
End Sub
|
||
|
||
Private Sub pnlControls_Leave(sender As Object, e As EventArgs) Handles pnlControls.Leave
|
||
If RECORD_ENABLED = True Then
|
||
If TrySave_Automatic() = True Then
|
||
DisableEditMode()
|
||
End If
|
||
Else
|
||
Record_Group_Enable(False)
|
||
End If
|
||
|
||
|
||
End Sub
|
||
|
||
Private Sub GridControlDocSearch_MouseDown(sender As Object, e As MouseEventArgs) Handles GridControlDocSearch.MouseDown
|
||
Record_Group_Enable(False)
|
||
NodeGroupEnable(False)
|
||
End Sub
|
||
|
||
Sub Record_Group_Enable(oBool As Boolean)
|
||
RibbonPageGroupRecord.Enabled = oBool
|
||
If oBool = True Then
|
||
bbtnitmRecSave.Enabled = False
|
||
End If
|
||
End Sub
|
||
Sub NodeGroupEnable(pBool As Boolean)
|
||
RPGNodes.Enabled = pBool
|
||
End Sub
|
||
|
||
Private Sub bbtnitmEditRec_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtnitmRecEdit.ItemClick
|
||
If RECORD_ENABLED = False Then
|
||
EnableEditMode()
|
||
Else
|
||
|
||
If TrySave_Automatic() = True Then
|
||
DisableEditMode()
|
||
End If
|
||
End If
|
||
End Sub
|
||
|
||
Sub EnableEditMode()
|
||
Dim EditingUser = ClassRecordState.IsRecordLocked(SELECTED_NODE_RECORD_ID)
|
||
' Überprüfen, ob der Record gerade bearbeitet wird
|
||
If Not IsNothing(EditingUser) And EditingUser <> USER_USERNAME Then
|
||
If USER_IS_ADMIN = True Then
|
||
Dim msg = "Record is in work: " & vbNewLine & $"Dieser Datensatz wird gerade vom Benutzer '{EditingUser}' bearbeitet. Wollen Sie diesen entsperren?"
|
||
Dim msg1 = "Achtung"
|
||
If USER_LANGUAGE <> "de-DE" Then
|
||
msg = "Record is in work: " & vbNewLine & $"This Record is currently being edited by User '{EditingUser}'. Do You want to unlock the record?"
|
||
msg1 = "Attention"
|
||
End If
|
||
Dim result As DialogResult = MessageBox.Show(msg, msg1, MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||
If result = System.Windows.Forms.DialogResult.Yes Then
|
||
ClassRecordState.UnlockRecord(SELECTED_NODE_RECORD_ID)
|
||
Exit Sub
|
||
End If
|
||
BarStaticItemLocked.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
||
|
||
Else
|
||
BarStaticItemLocked.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
|
||
If USER_LANGUAGE = "de-DE" Then
|
||
ClassHelper.MSGBOX_Handler("INFO", "Achtung", "Record is in work: " & vbNewLine & String.Format("Dieser Datensatz wird gerade vom Benutzer '{0}' bearbeitet und kann nur lesend abgerufen werden.", EditingUser))
|
||
Else
|
||
ClassHelper.MSGBOX_Handler("INFO", "Attention", "Record is in work: " & vbNewLine & String.Format("This Record is currently being edited by User '{0}' and only available in Read-Only mode.", EditingUser))
|
||
End If
|
||
' Wenn Record bearbeitet wird, EnableEditMode abbrechen!
|
||
Exit Sub
|
||
End If
|
||
|
||
|
||
Else
|
||
'Wenn Record bearbeitet werden kann, IN_WORK auf 1 setzen, um Bearbeitung durch andere zu verhindern!
|
||
ClassRecordState.LockRecord(SELECTED_NODE_RECORD_ID)
|
||
End If
|
||
|
||
' Alle Tabs außer Detailsicht deaktivieren
|
||
'DeactivateTabs()
|
||
|
||
CURRENT_CHANGE_STEP += 1
|
||
Lock_RecordControls(False)
|
||
Me.bbtnitmRecSave.Enabled = True
|
||
|
||
Dim stg As String
|
||
If USER_LANGUAGE = "de-DE" Then
|
||
stg = "Bearbeiten beenden"
|
||
Else
|
||
stg = "End Edit"
|
||
End If
|
||
bbtnitmRecEdit.Caption = stg
|
||
|
||
If RIGHT_RECORD_AND_FILE_READ_ONLY = False Then
|
||
' tsButtonDelete.Enabled = True
|
||
End If
|
||
|
||
CURRENT_RECORD_ID = SELECTED_NODE_RECORD_ID
|
||
ClassHelper.GetDocrecordLinks(CURRENT_RECORD_ID)
|
||
CtrlCommandUI.IsEdit = True
|
||
' Abhängige Listen laden
|
||
CtrlBuilder.WatchRecordChanges = False
|
||
'ClassControlValues.LoadControlValuesListWithPlaceholders(ENTITY_ID, RECORD_ID, PARENT_ID, CtrlBuilder.AllControls, ENTITY_ID)
|
||
ClassControlValues.Enable_Depending_Controls(_EntityId, SELECTED_NODE_RECORD_ID, 0, CtrlBuilder.AllControls, _EntityId)
|
||
CtrlBuilder.WatchRecordChanges = True
|
||
|
||
RECORD_ENABLED = True
|
||
CURRENT_RECORD_ENABLED = True
|
||
If RIGHT_READ_ONLY_DOC = False Then
|
||
Doc_ReadOnlyHandler(True)
|
||
End If
|
||
pnlControls.Focus()
|
||
'If RECORD_ENABLED = False Then
|
||
' ClassControlValues.LoadControlValuesList(SELECTED_RECORD_ID, ENTITY_ID, CtrlBuilder.AllControls)
|
||
'End If
|
||
End Sub
|
||
Sub DisableEditMode()
|
||
If SELECTED_NODE_RECORD_ID = 0 Then Exit Sub
|
||
|
||
Dim sw As New SW("DisableEditMode")
|
||
ClassRecordState.UnlockRecord(SELECTED_NODE_RECORD_ID)
|
||
Dim isinsert As Boolean
|
||
If IsNothing(CtrlCommandUI) Then
|
||
isinsert = 0
|
||
Else
|
||
isinsert = CtrlCommandUI.IsInsert
|
||
End If
|
||
ClassRecordCommands.CHECK_RECORD_FINAL(SELECTED_NODE_RECORD_ID, isinsert)
|
||
|
||
Lock_RecordControls(True)
|
||
RECORD_ENABLED = False
|
||
CURRENT_RECORD_ENABLED = False
|
||
|
||
|
||
'If ADD_RECORDS_CONSTR = False Then
|
||
' tsButtonAdd.Enabled = False
|
||
'Else
|
||
' tsButtonAdd.Enabled = True
|
||
'End If
|
||
Dim stg As String
|
||
If USER_LANGUAGE = "de-DE" Then
|
||
stg = "Bearbeiten"
|
||
Else
|
||
stg = "Edit"
|
||
End If
|
||
bbtnitmRecEdit.Caption = stg
|
||
bbtnitmRecSave.Enabled = False
|
||
|
||
If Not IsNothing(CtrlCommandUI) Then
|
||
'ActivateAllTabs()
|
||
End If
|
||
If RECORD_ENABLED = True Then
|
||
ClassControlValues.UnloadControlValuesList(SELECTED_NODE_RECORD_ID, _EntityId, CtrlBuilder.AllControls)
|
||
End If
|
||
If Not IsNothing(CtrlCommandUI) Then
|
||
'If CtrlCommandUI.IsInsert Then
|
||
' CtrlCommandUI.IsInsert = False
|
||
'End If
|
||
If CtrlCommandUI.IsEdit Then
|
||
CtrlCommandUI.IsEdit = False
|
||
End If
|
||
End If
|
||
If RIGHT_READ_ONLY_DOC = False Then
|
||
Doc_ReadOnlyHandler(True)
|
||
End If
|
||
sw.Done()
|
||
End Sub
|
||
|
||
#Region "Record Funktionen"
|
||
Sub Focus_Control(name As String)
|
||
Dim controls As Windows.Forms.Control.ControlCollection = pnlControls.Controls
|
||
|
||
For Each c As Windows.Forms.Control In controls
|
||
|
||
Dim tag As Object = c.Tag
|
||
Dim controlName As String = DirectCast(tag, ClassControlMetadata).Name
|
||
If controlName = name Then
|
||
|
||
c.Focus()
|
||
Exit Sub
|
||
|
||
End If
|
||
|
||
Next
|
||
End Sub
|
||
Public Function TrySave_RequiredControlsFilled() As Boolean
|
||
Dim missingValues As New List(Of String)
|
||
missingValues = ClassControlValues.CheckRequiredControlValues(CtrlBuilder.MasterPanel.Controls)
|
||
|
||
If missingValues.Count > 0 Then
|
||
Dim RequiredControlNames = String.Join(vbNewLine, missingValues)
|
||
|
||
If (USER_LANGUAGE = "de-DE") Then
|
||
Dim message = String.Format("Die folgenden Steuerelemente müssen ausgefüllt sein: {0}{1}", vbNewLine, RequiredControlNames)
|
||
MessageBox.Show(message, "Muss-Felder ausfüllen", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
|
||
Else
|
||
Dim message = String.Format("The following controls must be filled with values: {0}{1}", vbNewLine, RequiredControlNames)
|
||
MessageBox.Show(message, "Fill Required Controls", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
|
||
End If
|
||
|
||
Focus_Control(missingValues.First())
|
||
|
||
' Muss-Felder sind noch nicht ausgefüllt worden
|
||
Return False
|
||
Else
|
||
' Muss-Felder sind alle ausgefüllt
|
||
Return True
|
||
End If
|
||
End Function
|
||
''' <summary>
|
||
''' Überprüft beim manuellen Speichern, ob Datensatz verändert wurde und
|
||
''' ob alle Muss-Felder ausgefüllt wurden
|
||
''' </summary>
|
||
''' <returns>
|
||
''' Gibt False zurück, wenn nicht alle Muss-Felder gefüllt wurde,
|
||
''' ansonsten True
|
||
''' </returns>
|
||
Public Function TrySave_User() As Boolean
|
||
Try
|
||
'EDIT_STATE = EditState.None
|
||
Update_Status_Label(False)
|
||
Dim RequiredControlsFilled As Boolean = TrySave_RequiredControlsFilled()
|
||
|
||
If RECORD_CHANGED = False And RequiredControlsFilled = True Then
|
||
' Datensatz wurde nicht verändert
|
||
Return True
|
||
Else
|
||
If RequiredControlsFilled = False Then
|
||
Return False
|
||
End If
|
||
End If
|
||
|
||
If RequiredControlsFilled = True Then
|
||
TrySave_DoSave()
|
||
|
||
Return True
|
||
Else
|
||
Return False
|
||
End If
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
MessageBox.Show("Error in TrySave_User: " & vbNewLine & ex.Message)
|
||
Return False
|
||
End Try
|
||
End Function
|
||
|
||
Public Sub TrySave_DoSave()
|
||
ERROR_WHILE_SAVING = False
|
||
' Record Speichern
|
||
Dim ResultMessage = CtrlCommandUI.SaveRecord(SELECTED_NODE_RECORD_ID, _EntityId)
|
||
If ResultMessage <> "ERROR" Then
|
||
' Status anzeigen
|
||
Update_Status_Label(True, ResultMessage)
|
||
Else
|
||
ERROR_WHILE_SAVING = True
|
||
End If
|
||
'Jetzt die für die Entität notwendigen Prroceduren ausführen
|
||
Customer_Run_Procedures()
|
||
' RECORD_CHANGED zurücksetzen
|
||
RECORD_CHANGED = False
|
||
'Liste der geänderten Control Values leeren
|
||
CtrlBuilder.ControlsChanged.Clear()
|
||
End Sub
|
||
|
||
''' <summary>
|
||
''' Fragt den Benutzer beim Datensatzwechsel, ob Änderungen gespeichert werden sollen. Gibt False zurück, wenn Mussfelder ausgefüllt werden müssen, ansonsten True.
|
||
''' </summary>
|
||
Public Function TrySave_Automatic() As Boolean
|
||
Try
|
||
EDIT_STATE = EditState.None
|
||
Update_Status_Label(False)
|
||
|
||
If RECORD_CHANGED = True Then
|
||
Dim ShouldSave As DialogResult
|
||
If USER_LANGUAGE = "de-DE" Then
|
||
ShouldSave = MessageBox.Show("Sie haben ungespeicherte Änderungen. Wollen Sie diese speichern?", "Ungespeicherte Änderungen", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||
Else
|
||
ShouldSave = MessageBox.Show("There are unsaved changes. Would You like to save?", "Unsaved changes", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||
End If
|
||
|
||
' Änderungen sollen gespeichert werden
|
||
If ShouldSave = DialogResult.Yes Then
|
||
|
||
If CtrlCommandUI.IsInsert Then
|
||
EDIT_STATE = EditState.None
|
||
End If
|
||
|
||
Dim RequiredControlsFilled As Boolean = TrySave_RequiredControlsFilled()
|
||
|
||
If RequiredControlsFilled = True Then
|
||
' Änderungen sollen gespeichert werden,
|
||
' Muss-Felder sind alle ausgefüllt
|
||
TrySave_DoSave()
|
||
' Hinzufügen Button wieder aktivieren
|
||
'If ADD_RECORDS_CONSTR = False Then
|
||
' tsButtonAdd.Enabled = False
|
||
'Else
|
||
' tsButtonAdd.Enabled = True
|
||
'End If
|
||
If CtrlCommandUI.IsInsert Then
|
||
Lock_RecordControls(True)
|
||
End If
|
||
Return True
|
||
Else
|
||
' Änderungen sollen gespeichert werden,
|
||
' aber Muss-Felder sind noch nicht ausgefüllt worden
|
||
Return False
|
||
End If
|
||
Else ' Änderungen sollen nicht gespeichert werden
|
||
' Angelegten Record löschen
|
||
If CtrlCommandUI.IsInsert Then
|
||
If ClassHelper.DeleteRecord(SELECTED_NODE_RECORD_ID, "TrySave - UserdecidedNotToSave - ENTITY-ID: " & CURRENT_ENTITY_ID) = True Then
|
||
CtrlCommandUI.IsInsert = False
|
||
INSERT_IN_ACTION = False
|
||
End If
|
||
End If
|
||
|
||
' Änderungen sollen nicht gespeichert werden
|
||
RECORD_CHANGED = False
|
||
|
||
' Hinzufügen Button wieder aktivieren
|
||
'If ADD_RECORDS_CONSTR = False Then
|
||
' tsButtonAdd.Enabled = False
|
||
'Else
|
||
' tsButtonAdd.Enabled = True
|
||
'End If
|
||
|
||
Return True
|
||
End If
|
||
Else
|
||
|
||
' Datensatz wurde nicht verändert
|
||
Return True
|
||
End If
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
MessageBox.Show("Error in TrySave_Automatic: " & vbNewLine & ex.Message)
|
||
Return False
|
||
End Try
|
||
End Function
|
||
#End Region
|
||
Private Sub Customer_Run_Procedures()
|
||
Try
|
||
Dim DT As DataTable = MYDB_ECM.GetDatatable("SELECT * FROM TBPMO_RUN_PROCEDURES WHERE FORM_ID = " & _EntityId)
|
||
If Not DT Is Nothing Then
|
||
For Each row As DataRow In DT.Rows
|
||
Dim prsql As String = row.Item("EXECUTE_COMMAND")
|
||
prsql = prsql.ToUpper.Replace("@FORM_ID", _EntityId)
|
||
prsql = prsql.ToUpper.Replace("@ENTITY_ID", _EntityId)
|
||
prsql = prsql.ToUpper.Replace("@RECORD_ID", SELECTED_NODE_RECORD_ID)
|
||
MYDB_ECM.ExecuteNonQuery(prsql)
|
||
Next
|
||
End If
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", "Error in Customer_Run_Procedures: ", ex.Message)
|
||
End Try
|
||
End Sub
|
||
Private Async Function RUN_DOCSEARCH(pShowSplashscreen As Boolean) As Task(Of Integer)
|
||
Dim oHandle As IOverlaySplashScreenHandle
|
||
If pShowSplashscreen Then
|
||
oHandle = SplashScreenManager.ShowOverlayForm(Me)
|
||
End If
|
||
|
||
Dim sw As New SW("RUN_WDSEARCH_GRID")
|
||
Dim oFilesFound As Integer = 0
|
||
|
||
Try
|
||
|
||
If CURRENT_RECORD_ID = 0 Then
|
||
GridControlDocSearch.DataSource = Nothing
|
||
Return 0
|
||
End If
|
||
|
||
bsitmtInfoDoc.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
|
||
If CURRENT_SEARCH_TYPE = "NODE_DOWN" Then
|
||
|
||
Dim sql = String.Format("DECLARE @return_value int " & vbNewLine &
|
||
"EXEC @return_value = [dbo].[PRPMO_NODES_GET_CHILD_RECORDS] @USER_ID = {0}, @NODE_ID = {1} " & vbNewLine &
|
||
"SELECT 'Return Value' = @return_value", USER_GUID, CURRENT_NODE_GUID)
|
||
Dim DT_ASYNC As DataTable = Await MYDB_ECM.GetDatatableAsync(sql)
|
||
|
||
If Not IsNothing(DT_ASYNC) Then
|
||
Dim result = DT_ASYNC.Rows(0).Item(0)
|
||
If result <> 0 Then
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", "Error in Getting SubNodes-Structure", "Check the logfile")
|
||
End If
|
||
End If
|
||
|
||
End If
|
||
Dim DT_RESULT As DataTable
|
||
DT_RESULT = ClassDOC_SEARCH.Get_DOC_RESULTTABLE(DT_RESULTLIST_OPTIONS, DT_RESULTLIST_VARIABLE_VALUE, DT_COLUMNS_GRID_ENTITY, _EntityId, SELECTED_NODE_RECORD_ID, True)
|
||
|
||
If IsNothing(DT_RESULT) Then
|
||
Dim msg = "wrong DocSearch-Configuration or unexpected Error in Get_DOC_RESULTTABLE - Check logfile and contact Digital Data"
|
||
GridViewDoc_Search.ViewCaption = msg
|
||
oFilesFound = 0
|
||
Else
|
||
If DT_RESULT.Rows.Count > 0 Then 'Es gibt Suchergebnisse
|
||
|
||
If DT_RESULT.Rows.Count > 0 Then
|
||
If CURRENT_SEARCH_TYPE = "FULLTEXT" Then
|
||
GridViewDoc_Search.ShowFindPanel()
|
||
GridViewDoc_Search.FindFilterText = CURRENT_FULLTEXT_PATTERN
|
||
End If
|
||
If Not IsNothing(DT_DOCRESULT_DROPDOWN_ITEMS) Then
|
||
If DT_DOCRESULT_DROPDOWN_ITEMS.Rows.Count > 0 Then
|
||
NNLogger.Info($"RUN_WDSEARCH_GRID - DT_DOCRESULT_DROPDOWN_ITEMS [{DT_DOCRESULT_DROPDOWN_ITEMS.Rows.Count}]!")
|
||
End If
|
||
End If
|
||
|
||
|
||
ClassDocGrid.FillColumns(
|
||
GridViewDoc_Search,
|
||
DT_RESULT,
|
||
DT_COLUMNS_GRID_ENTITY,
|
||
DT_DOCRESULT_DROPDOWN_ITEMS,
|
||
AddressOf OnCBSelectedValueChanged,
|
||
AddressOf OnDateSelectedValueChanged,
|
||
AddressOf OnTextSelectedValueChanged,
|
||
AddressOf OnCheckboxValueChanged,
|
||
CURRENT_SEARCH_TYPE, SELECTED_NODE_RECORD_ID)
|
||
|
||
End If
|
||
'BbtnitmDocSearch.Enabled = TruefRe
|
||
|
||
oFilesFound = DT_RESULT.Rows.Count
|
||
Else
|
||
|
||
GridControlDocSearch.DataSource = Nothing
|
||
oFilesFound = 0
|
||
End If
|
||
End If
|
||
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", "Error in Run WD-Search Database: ", ex.Message)
|
||
Finally
|
||
sw.Done()
|
||
bsitmtInfoDoc.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
||
Update_Notification_Label(False, "", "")
|
||
If pShowSplashscreen Then
|
||
SplashScreenManager.CloseOverlayForm(oHandle)
|
||
End If
|
||
|
||
End Try
|
||
|
||
Return oFilesFound
|
||
End Function
|
||
Private Sub RUN_ENTITY_DOC_SEARCH()
|
||
Dim sw As New SW("RUN_ENTITY_DOC_SEARCH")
|
||
Try
|
||
Dim oSQL = $"SELECT ENTITY_DOC_SEARCH FROM TBPMO_FORM WHERE GUID = {_EntityId}"
|
||
CURRENT_DOCSEARCH_SQL = MYDB_ECM.GetScalarValue(oSQL)
|
||
If CURRENT_DOCSEARCH_SQL <> String.Empty Then
|
||
Dim oText = $"Die sichtweite Suche wird im Hintergrund ausgeführt und in einem separaten Fenster angezeigt sobald sie fertig ist."
|
||
If USER_LANGUAGE <> "de-DE" Then
|
||
oText = $"The view-wide search will be started in background. The result will be displayed when ready."
|
||
End If
|
||
Update_Notification_Label(True, oText, "Yellow")
|
||
|
||
CURRENT_DOCSEARCH_SQL = CURRENT_DOCSEARCH_SQL.Replace("@ENTITY_ID", _EntityId)
|
||
CURRENT_DOCSEARCH_SQL = CURRENT_DOCSEARCH_SQL.Replace("@USER_LANGUAGE", USER_LANGUAGE)
|
||
CURRENT_DOCSEARCH_SQL = CURRENT_DOCSEARCH_SQL.Replace("@USER_ECM_ID", USERID_FK_INT_ECM)
|
||
CURRENT_DOCSEARCH_SQL = CURRENT_DOCSEARCH_SQL.Replace("@USER_ID", USER_GUID)
|
||
|
||
|
||
If USER_LANGUAGE <> "de-DE" Then
|
||
CURRENT_DOCSEARCH_CAPTION = "view-wide search"
|
||
Else
|
||
CURRENT_DOCSEARCH_CAPTION = "Sichtweite Suche"
|
||
End If
|
||
Dim myformThread = New Thread(Sub()
|
||
Using frm As New frmDocSearchResult
|
||
Application.Run(frm)
|
||
|
||
End Using
|
||
End Sub)
|
||
myformThread.SetApartmentState(ApartmentState.STA)
|
||
myformThread.Start()
|
||
myformThread.Join()
|
||
Update_Notification_Label(False, "", "")
|
||
Else
|
||
MsgBox("Please config the entity-search properly! " & vbNewLine & oSQL, vbOKOnly, "Information")
|
||
End If
|
||
|
||
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error RUN_ENTITY_DOC_SEARCH", ex.Message, ex.StackTrace)
|
||
End Try
|
||
sw.Done()
|
||
End Sub
|
||
Private Sub OnCBSelectedValueChanged(sender As Object, e As EventArgs)
|
||
Try
|
||
Dim oDocID = Focused_Row_GetDocID()
|
||
If oDocID = 0 Then
|
||
Exit Sub
|
||
End If
|
||
Dim ComboBox As ComboBoxEdit = sender
|
||
'Dim ItemComboBox As RepositoryItemComboBox
|
||
'ItemComboBox = sender
|
||
Dim item As ClassDocGrid.WindreamDocGridComboboxItem = ComboBox.SelectedItem
|
||
Dim value As String = item.Value
|
||
If value.ToUpper = "Not displayable in Group-Search".ToUpper Then
|
||
Exit Sub
|
||
End If
|
||
Dim configId As Integer = item.ConfigID
|
||
|
||
Dim mainView As GridView = GridControlDocSearch.MainView
|
||
Dim detailView As GridView = mainView.GetDetailView(mainView.FocusedRowHandle, mainView.GetRelationIndex(mainView.FocusedRowHandle, "docIdDetails"))
|
||
Dim detailRow As DataRowView = detailView.GetRow(detailView.FocusedRowHandle)
|
||
'Dim configid = detailRow.Item("CONFIG_ID")
|
||
Dim oHeader = detailRow.Item("HEADER_CAPTION")
|
||
|
||
|
||
Dim user As String = USER_USERNAME
|
||
|
||
Dim Sql As String = String.Format("EXEC PRPMO_DOC_VALUE_UPD_INS {0}, {1}, {2}, '{3}', '{4}'", oDocID, SELECTED_NODE_RECORD_ID, configId, value, user)
|
||
If MYDB_ECM.ExecuteNonQuery(Sql) = False Then
|
||
MsgBox("The Update-Command was not successful! Check the log!",, MsgBoxStyle.Critical)
|
||
Else
|
||
RefreshDocValueinDatagrid(oDocID, oHeader, value)
|
||
End If
|
||
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", "Error in OnCBSelectedValueChanged: ", ex.Message)
|
||
End Try
|
||
End Sub
|
||
|
||
Private Sub OnDateSelectedValueChanged(sender As Object, e As EventArgs)
|
||
Try
|
||
Dim oDocID = Focused_Row_GetDocID()
|
||
If oDocID = 0 Then
|
||
Exit Sub
|
||
End If
|
||
Dim DatePicker As DateEdit = sender
|
||
Dim value As DateTime = DatePicker.EditValue
|
||
|
||
Dim oldValue As Date
|
||
Dim validDate As Boolean = False
|
||
|
||
Try
|
||
validDate = Date.TryParse(DatePicker.OldEditValue, oldValue)
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
oldValue = Date.MinValue
|
||
End Try
|
||
If Not validDate Then
|
||
oldValue = Date.MinValue
|
||
End If
|
||
|
||
If oldValue = DatePicker.EditValue Then
|
||
Exit Sub
|
||
End If
|
||
'Dim colTitle = DirectCast(GridControlDocSearch.MainView, DevExpress.XtraGrid.Views.Grid.GridView).FocusedColumn.FieldName
|
||
'Dim configId As Integer = ClassWindreamDocGrid.RESULT_CONFIG_IDS.Item(colTitle)
|
||
' Config id über mainView -> detailView herausfinden
|
||
Dim mainView As GridView = GridControlDocSearch.MainView
|
||
Dim detailView As GridView = mainView.GetDetailView(mainView.FocusedRowHandle, mainView.GetRelationIndex(mainView.FocusedRowHandle, "docIdDetails"))
|
||
Dim detailRow As DataRowView = detailView.GetRow(detailView.FocusedRowHandle)
|
||
Dim configid = detailRow.Item("CONFIG_ID")
|
||
Dim oHeader = detailRow.Item("HEADER_CAPTION")
|
||
|
||
Dim dateString = value.ToString("yyyy-MM-dd") 'hh:mm:ss.fff
|
||
Dim Sql As String = String.Format("EXEC PRPMO_DOC_VALUE_UPD_INS {0}, {1}, {2}, '{3}', '{4}'", oDocID, SELECTED_NODE_RECORD_ID, configid, dateString, USER_USERNAME)
|
||
|
||
If MYDB_ECM.ExecuteNonQuery(Sql) = False Then
|
||
ClassHelper.MSGBOX_Handler("ERROR", "UnexpectedError:", "Error updating doc-metadata (date): " & vbNewLine & "Check the log for further information!")
|
||
Else
|
||
RefreshDocValueinDatagrid(oDocID, oHeader, value)
|
||
End If
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", "Error in OnDateSelectedValueChanged: ", ex.Message)
|
||
End Try
|
||
End Sub
|
||
|
||
Private Sub OnTextSelectedValueChanged(sender As Object, e As EventArgs)
|
||
Try
|
||
Dim oDocID = Focused_Row_GetDocID()
|
||
If oDocID = 0 Then
|
||
Exit Sub
|
||
End If
|
||
Dim TextBox As TextEdit = sender
|
||
Dim value = TextBox.EditValue
|
||
|
||
'Dim colTitle = DirectCast(GridControlDocSearch.MainView, DevExpress.XtraGrid.Views.Grid.GridView).FocusedColumn.FieldName
|
||
'Dim configId As Integer = ClassWindreamDocGrid.RESULT_CONFIG_IDS.Item(colTitle)
|
||
' Config id über mainView -> detailView herausfinden
|
||
Dim mainView As GridView = GridControlDocSearch.MainView
|
||
If Not IsNothing(mainView) Then
|
||
Dim detailView As GridView = mainView.GetDetailView(mainView.FocusedRowHandle, mainView.GetRelationIndex(mainView.FocusedRowHandle, "docIdDetails"))
|
||
Dim detailRow As DataRowView = detailView.GetRow(detailView.FocusedRowHandle)
|
||
Dim configid = detailRow.Item("CONFIG_ID")
|
||
Dim oHeader = detailRow.Item("HEADER_CAPTION")
|
||
|
||
Dim Sql As String = String.Format("EXEC PRPMO_DOC_VALUE_UPD_INS {0}, {1}, {2},'{3}','{4}'", oDocID, SELECTED_NODE_RECORD_ID, configid, value, USER_USERNAME)
|
||
If MYDB_ECM.ExecuteNonQuery(Sql) = False Then
|
||
ClassHelper.MSGBOX_Handler("ERROR", "UnexpectedError:", "Error updating doc-metadata (textbox): " & vbNewLine & "Check the log for further information!")
|
||
Else
|
||
RefreshDocValueinDatagrid(oDocID, oHeader, value)
|
||
End If
|
||
End If
|
||
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", "Error in OnTextSelectedValueChanged: ", ex.Message)
|
||
End Try
|
||
End Sub
|
||
|
||
Private Sub OnCheckboxValueChanged(sender As Object, e As EventArgs)
|
||
'TODO Save Checkboxvalue
|
||
Try
|
||
Dim oDocID = Focused_Row_GetDocID()
|
||
If oDocID = 0 Then
|
||
Exit Sub
|
||
End If
|
||
Dim CheckBox As CheckEdit = sender
|
||
Dim value As Boolean = CheckBox.EditValue
|
||
|
||
'Config id über mainView -> detailView herausfinden
|
||
Dim mainView As GridView = GridControlDocSearch.MainView
|
||
Dim detailView As GridView = mainView.GetDetailView(mainView.FocusedRowHandle, mainView.GetRelationIndex(mainView.FocusedRowHandle, "docIdDetails"))
|
||
Dim detailRow As DataRowView = detailView.GetRow(detailView.FocusedRowHandle)
|
||
Dim configid = detailRow.Item("CONFIG_ID")
|
||
Dim oHeader = detailRow.Item("HEADER_CAPTION")
|
||
|
||
|
||
Dim Sql As String = String.Format("EXEC PRPMO_DOC_VALUE_UPD_INS {0}, {1}, {2},'{3}','{4}'", oDocID, SELECTED_NODE_RECORD_ID, configid, value, USER_USERNAME)
|
||
If MYDB_ECM.ExecuteNonQuery(Sql) = False Then
|
||
ClassHelper.MSGBOX_Handler("ERROR", "UnexpectedError:", "Error updating doc-metadata (checkbox): " & vbNewLine & "Check the log for further information!")
|
||
Else
|
||
RefreshDocValueinDatagrid(oDocID, oHeader, value)
|
||
End If
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", "Error in OnCheckboxValueChanged: ", ex.Message)
|
||
End Try
|
||
End Sub
|
||
#Region "GridViewEvents"
|
||
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 RefreshDocValueinDatagrid(pDocID As Integer, pHeader As String, pValue As String)
|
||
Try
|
||
Dim oDatatable As DataTable = TryCast(GridControlDocSearch.DataSource, DataTable)
|
||
For Each ORow As DataRow In oDatatable.Rows
|
||
If ORow.Item("DocID") = pDocID Then
|
||
ORow.Item(pHeader) = pValue
|
||
Update_Notification_Label(True, $"Document value {pHeader} saved", "Lime")
|
||
Exit For
|
||
End If
|
||
Next
|
||
Catch ex As Exception
|
||
|
||
End Try
|
||
End Sub
|
||
Private Sub GridViewDoc_Search_FocusedRowChanged(sender As Object, e As DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs) Handles GridViewDoc_Search.FocusedRowChanged
|
||
Focused_Row_GetDocID()
|
||
|
||
End Sub
|
||
|
||
Private Function Focused_Row_GetDocID() As Int64
|
||
Try
|
||
If FORM_SHOWN = False Then
|
||
Return 0
|
||
End If
|
||
If Node_AfterSelect = True Then
|
||
SplitContainerDocView.Collapsed = True
|
||
GridViewDoc_Search.ClearSelection()
|
||
GridViewDoc_Search.FocusedRowHandle = DevExpress.XtraGrid.GridControl.InvalidRowHandle
|
||
|
||
Return 0
|
||
End If
|
||
Update_DocID_Label(False)
|
||
Update_Notification_Label(False, "", "")
|
||
If GridViewDoc_Search.FocusedRowHandle >= 0 Then
|
||
Dim oDocID = GridViewDoc_Search.GetRowCellValue(GridViewDoc_Search.FocusedRowHandle, "DocID")
|
||
If Not IsNothing(oDocID) Then
|
||
Dim omsg = "Doc-ID: " & oDocID
|
||
Update_DocID_Label(True, omsg, EditState.Update)
|
||
If SELECTED_DOC_ID <> oDocID Then
|
||
SELECTED_DOC_ID = oDocID
|
||
If checkShowPreview.Checked = False Then
|
||
SplitContainerDocView.Collapsed = True
|
||
Else
|
||
If SplitContainerDocView.Collapsed Then
|
||
SplitContainerDocView.Collapsed = False
|
||
End If
|
||
End If
|
||
|
||
DocView_DisplaySelectedDoc(False)
|
||
End If
|
||
Update_DocID_Label(True, omsg, EditState.Update)
|
||
Return SELECTED_DOC_ID
|
||
Else
|
||
Update_DocID_Label(True, "DocRow not selected", EditState.None)
|
||
Return 0
|
||
End If
|
||
Else
|
||
Return 0
|
||
End If
|
||
Catch ex As Exception
|
||
Return 0
|
||
End Try
|
||
End Function
|
||
|
||
Private Sub GridViewDoc_Search_MasterRowExpanded(sender As Object, e As CustomMasterRowEventArgs) Handles GridViewDoc_Search.MasterRowExpanded
|
||
Focused_Row_GetDocID()
|
||
End Sub
|
||
|
||
Sub Save_DocGrid_Layout()
|
||
Try
|
||
If FORM_LOADED And Node_AfterSelect = False Then
|
||
Dim XMLPath = Get_DocGrid_Layout_Filename()
|
||
GridViewDoc_Search.SaveLayoutToXml(XMLPath)
|
||
Update_Notification_Label(True, "Grid Document - Layout Saved", "")
|
||
End If
|
||
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", ex.Message, ex.StackTrace)
|
||
End Try
|
||
End Sub
|
||
Sub Load_DocGrid_Layout()
|
||
Try
|
||
|
||
Dim XMLPath = Get_DocGrid_Layout_Filename()
|
||
If File.Exists(XMLPath) Then
|
||
|
||
GridViewDoc_Search.RestoreLayoutFromXml(XMLPath)
|
||
GridViewDoc_Search.GuessAutoFilterRowValuesFromFilter()
|
||
GridViewDoc_Search.ClearColumnsFilter()
|
||
GridViewDoc_Search.ClearFindFilter()
|
||
End If
|
||
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", ex.Message, ex.StackTrace)
|
||
End Try
|
||
End Sub
|
||
Private Function Get_DocGrid_Layout_Filename()
|
||
Dim EntityRegex As New RegularExpressions.Regex("\s+\(\d+\)")
|
||
Dim Filename As String = String.Format("GridViewDoc_Search_{0}_{1}_UserLayout.xml", "Entity" & _EntityId, CONSTRUCTOR_DETAIL_ID)
|
||
LAYOUT_DOC_GRIDVIEW = System.IO.Path.Combine(Application.UserAppDataPath(), Filename)
|
||
Return LAYOUT_DOC_GRIDVIEW
|
||
End Function
|
||
#End Region
|
||
Function GetSafeFilename(filename As String)
|
||
Return String.Join("_", filename.Split(Path.GetInvalidFileNameChars()))
|
||
End Function
|
||
Private Async Function Reset_View_layout() As Task
|
||
Try
|
||
Dim XMLPath = Get_DocGrid_Layout_Filename()
|
||
If File.Exists(XMLPath) Then
|
||
Me.Cursor = Cursors.WaitCursor
|
||
File.Delete(XMLPath)
|
||
GridControlDocSearch.DataSource = Nothing
|
||
GridViewDoc_Search.Columns.Clear()
|
||
|
||
Await RUN_DOCSEARCH(True)
|
||
|
||
Else
|
||
MsgBox("Resetting the layout was not successful - File not existing!", MsgBoxStyle.Information)
|
||
End If
|
||
Catch ex As Exception
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", "Error in Resetting Layout DocGrid: ", ex.Message)
|
||
End Try
|
||
Me.Cursor = Cursors.Default
|
||
End Function
|
||
|
||
Private Async Sub bbtnitmDocResultLayoutReset_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtnitmDocResultLayoutReset.ItemClick
|
||
Await Reset_View_layout()
|
||
End Sub
|
||
|
||
Private Sub bbtnitmDocResultLayoutSave_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtnitmDocResultLayoutSave.ItemClick
|
||
Save_DocGrid_Layout()
|
||
End Sub
|
||
|
||
Private Sub GridControlDocSearch_DoubleClick(sender As Object, e As EventArgs) Handles GridControlDocSearch.DoubleClick
|
||
Open_File()
|
||
End Sub
|
||
#Region "Dropping Files"
|
||
Sub Drag_Enter(e As DragEventArgs)
|
||
If _EntityId <> 0 Then
|
||
If WM_READ_ONLY = False Then
|
||
ClassDragDrop.Drag_enter(e)
|
||
Else
|
||
Update_Notification_Label(True, "READ ONLY ACCESS", "Yellow")
|
||
End If
|
||
Else
|
||
Update_Notification_Label(True, "No entity selected", "Yellow")
|
||
End If
|
||
End Sub
|
||
Private Async Function Drag_Drop(e As DragEventArgs) As Task
|
||
Try
|
||
If ClassDragDrop.Drop_File(e) = False Then
|
||
Exit Function
|
||
End If
|
||
If USER_PERSONIFIED_TEST = True Then
|
||
ClassHelper.MSGBOX_Handler("INFO", "Attention", "You are using orgFLOW in personified mode! Adding files is not allowed!")
|
||
Exit Function
|
||
End If
|
||
If WMMOD.SessionLoggedin = False Then
|
||
ClassHelper.MSGBOX_Handler("INFO", "Attention", "Check Your windream-connection and restart orgFLOW afterwards.", "Could not create a windream session!")
|
||
Exit Function
|
||
End If
|
||
If _EntityId <> 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 = MYDB_ECM.GetScalarValue(sql)
|
||
If count_DT = 0 And CURRENT_ENTITY_REDUNDANT_ID = 0 Then
|
||
MsgBox("No documenttypes for this entity configured! Indexing is not possible!" & vbNewLine & "Please check the configuration!", MsgBoxStyle.Exclamation)
|
||
Exit Function
|
||
ElseIf count_DT = 0 And CURRENT_ENTITY_REDUNDANT_ID <> 0 Then
|
||
sql = "select count(*) from VWPMO_DOKUMENTTYPES where FORM_ID = " & CURRENT_ENTITY_REDUNDANT_ID
|
||
count_DT = MYDB_ECM.GetScalarValue(sql)
|
||
If count_DT = 0 Then
|
||
MsgBox("No documenttypes for this entity configured! Indexing is not possible!" & vbNewLine & "Please check the configuration!", MsgBoxStyle.Exclamation)
|
||
Exit Function
|
||
End If
|
||
End If
|
||
If RECORD_CHANGED = True Then
|
||
If Save_Record() = False Then
|
||
Exit Function
|
||
End If
|
||
End If
|
||
CURRENT_CONTROL_DOCTYPE_MATCH = 0
|
||
If CONTROL_DOCTYPE_MATCH <> 0 Then
|
||
Try
|
||
CURRENT_CONTROL_DOCTYPE_MATCH = ""
|
||
CURRENT_CONTROL_DOCTYPE_MATCH = ClassControlValues.GetControlValuesREC_CONTROL(CURRENT_RECORD_ID, CONTROL_DOCTYPE_MATCH)
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
CURRENT_CONTROL_DOCTYPE_MATCH = 0
|
||
CURRENT_CONTROL_DOCTYPE_MATCH = ""
|
||
End Try
|
||
|
||
End If
|
||
|
||
DROPPED_CHECKED = False
|
||
If e.Data.GetDataPresent(DataFormats.StringFormat) Then
|
||
Dim Wert As String = CType(e.Data.GetData(DataFormats.StringFormat), Object)
|
||
Console.WriteLine("DragDrop-Wert: " & Wert)
|
||
If Wert.Contains("SCAN") Then
|
||
Dim split() = Wert.Split(";")
|
||
If IsNumeric(split(1)) Then
|
||
CURRENT_FILEID = split(1)
|
||
|
||
CURRENT_FORMVIEW_ID = FORMVIEW_ID
|
||
ClassHelper.Create_USER_FILE_TABLE()
|
||
If Not IsNothing(CURRENT_TBPMO_FILES_USER) Then
|
||
If CURRENT_TBPMO_FILES_USER.Rows.Count > 0 Then
|
||
frmWM_IndexFile.ShowDialog()
|
||
End If
|
||
End If
|
||
|
||
'RUN_WD_SEARCH(WD_Suche, "RECORD")
|
||
End If
|
||
ElseIf (e.Data.GetDataPresent("FileGroupDescriptor")) AndAlso (e.Data.GetDataPresent("FileContents")) Then
|
||
If ClassDragDrop.Drop_File(e) = True Then
|
||
Check_Dropped_Files()
|
||
End If
|
||
ElseIf e.Data.GetDataPresent("FileGroupDescriptor") Then
|
||
If ClassDragDrop.Drop_File(e) = True Then
|
||
Check_Dropped_Files()
|
||
End If
|
||
End If
|
||
Else
|
||
If ClassDragDrop.Drop_File(e) = True Then
|
||
Check_Dropped_Files()
|
||
End If
|
||
|
||
End If
|
||
'Nur wenn neue Dateien abgelegt wurden muss die Prozedur zur aktualisierung der windream Dateien ausgeführt werden...ansonsten muss nichts passieren
|
||
If NEW_FILES_ADDED = True Then
|
||
Me.Cursor = Cursors.WaitCursor
|
||
Await RUN_DOCSEARCH(True)
|
||
ClassHelper.GetDocrecordLinks(CURRENT_RECORD_ID)
|
||
TimerClearResultfiles.Start()
|
||
Else
|
||
NNLogger.Debug("No new files were added or windream tab is not focused!")
|
||
End If
|
||
Me.Cursor = Cursors.Default
|
||
Else
|
||
'If RIGHT_RECORD_AND_FILE_READ_ONLY = True Then
|
||
' NNLogger.Warn("RIGHT_RECORD_AND_FILE_READ_ONLY is set! No DragDrop allowed")
|
||
'End If
|
||
If RIGHT_READ_ONLY_DOC = True Then
|
||
NNLogger.Warn("RIGHT_WD_FORBIDDEN is set! No DragDrop allowed")
|
||
Else
|
||
NNLogger.Warn("No DragDrop allowed - ELSE")
|
||
End If
|
||
|
||
End If
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
NNLogger.Warn("Unexpected Error in Drag_Drop: " & ex.Message)
|
||
MsgBox("Unexpected Error in DragDrop - Please check the log for further information!", MsgBoxStyle.Exclamation)
|
||
Finally
|
||
|
||
End Try
|
||
End Function
|
||
Private DROPPED_CHECKED As Boolean = False
|
||
Sub Check_Dropped_Files()
|
||
Try
|
||
NEW_FILES_ADDED = False
|
||
If RECORD_CHANGED = True Then
|
||
If Save_Record() = False Then
|
||
Exit Sub
|
||
End If
|
||
End If
|
||
If CURRENT_RECORD_ID = 0 Then
|
||
ClassHelper.MSGBOX_Handler("INFO", "Attention", "Input missing: ", "Please choose a record.")
|
||
Exit Sub
|
||
End If
|
||
If DROPPED_CHECKED = False Then
|
||
For Each Str As Object In ClassDragDrop.files_dropped
|
||
If Not IsNothing(Str) Then
|
||
Dim DropType = Str.Substring(0, Str.LastIndexOf("@") + 1)
|
||
If DropType.ToString.Contains("SCAN") = False Then
|
||
NNLogger.Info("Check_Dropped_Files:" & Str.ToString)
|
||
Dim CURRENT_WORKFILE = Str.Substring(Str.LastIndexOf("@") + 1)
|
||
If CURRENT_WORKFILE.ToString.Contains("@") Then
|
||
MsgBox("File contains invalid operator @!" & vbNewLine & "Please rename file and try again!", MsgBoxStyle.Exclamation)
|
||
Continue For
|
||
End If
|
||
If CURRENT_WORKFILE.ToString.Contains("'") Then
|
||
MsgBox("File contains invalid operator '!" & vbNewLine & "Please rename file and try again!", MsgBoxStyle.Exclamation)
|
||
Continue For
|
||
End If
|
||
If ClassHelper.Insert_USER_File(CURRENT_WORKFILE, DropType) = False Then
|
||
Exit Sub
|
||
End If
|
||
End If
|
||
End If
|
||
Next
|
||
DROPPED_CHECKED = True
|
||
End If
|
||
|
||
Dim sql = "select count(*) from VWPMO_DOKUMENTTYPES where FORMVIEW_ID = " & FORMVIEW_ID
|
||
Dim count_DT = MYDB_ECM.GetScalarValue(sql)
|
||
If count_DT = 0 And CURRENT_ENTITY_REDUNDANT_ID = 0 Then
|
||
ClassHelper.MSGBOX_Handler("INFO", "Attention", "Configuration missing: ", "No documenttypes for this entity (" & FORMVIEW_ID.ToString & ") configured! Indexing is not possible! Please check the configuration.")
|
||
Exit Sub
|
||
ElseIf count_DT = 0 And CURRENT_ENTITY_REDUNDANT_ID <> 0 Then
|
||
sql = "select count(*) from VWPMO_DOKUMENTTYPES where FORM_ID = " & CURRENT_ENTITY_REDUNDANT_ID
|
||
count_DT = MYDB_ECM.GetScalarValue(sql)
|
||
If count_DT = 0 Then
|
||
ClassHelper.MSGBOX_Handler("INFO", "Attention", "Configuration missing: ", "No documenttypes for the redundant entity (" & CURRENT_ENTITY_REDUNDANT_ID.ToString & ") configured! Indexing is not possible! Please check the configuration.")
|
||
Exit Sub
|
||
End If
|
||
End If
|
||
ClassHelper.Create_USER_FILE_TABLE()
|
||
If Not IsNothing(CURRENT_TBPMO_FILES_USER) Then
|
||
If CURRENT_TBPMO_FILES_USER.Rows.Count > 0 Then
|
||
For Each Filerow As DataRow In CURRENT_TBPMO_FILES_USER.Rows
|
||
If CBool(Filerow.Item("WORKED")) = False Then
|
||
'Dim datei = Str.ToString.Replace("@DROPFROMFSYSTEM@", "")
|
||
CURRENT_FILEID = Filerow.Item("GUID")
|
||
' CURRENT_PARENT_ENTITY_ID = PARENT_ENTITYID
|
||
'CURRENT_RECORD_ID = RECORD_ID
|
||
'CURRENT_ENTITY_ID = ENTITY_ID
|
||
CURRENT_FORMVIEW_ID = FORMVIEW_ID
|
||
frmWM_IndexFile.ShowDialog()
|
||
|
||
Else
|
||
|
||
End If
|
||
Next
|
||
End If
|
||
End If
|
||
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", "Error in Check_Dropped_Files: ", ex.Message)
|
||
End Try
|
||
|
||
End Sub
|
||
Private Async Sub GridControlDocSearch_DragDrop(sender As Object, e As DragEventArgs) Handles GridControlDocSearch.DragDrop
|
||
Await Drag_Drop(e)
|
||
End Sub
|
||
|
||
Private Sub GridControlDocSearch_DragEnter(sender As Object, e As DragEventArgs) Handles GridControlDocSearch.DragEnter
|
||
Drag_Enter(e)
|
||
End Sub
|
||
|
||
Private Async Sub pnlControls_DragDrop(sender As Object, e As DragEventArgs) Handles pnlControls.DragDrop
|
||
Await Drag_Drop(e)
|
||
End Sub
|
||
|
||
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)
|
||
Drag_Enter(e)
|
||
End Sub
|
||
|
||
Private Async Sub SplitContainer1_DragDrop(sender As Object, e As DragEventArgs)
|
||
Await Drag_Drop(e)
|
||
End Sub
|
||
#End Region
|
||
|
||
Function Save_Record()
|
||
Try
|
||
Me.Cursor = Cursors.WaitCursor
|
||
SAVE_ROUTINE_ACTIVE = True
|
||
|
||
Dim RequiredControlsFilled As Boolean = TrySave_RequiredControlsFilled()
|
||
If RequiredControlsFilled = False Then
|
||
Return False
|
||
End If
|
||
If CtrlCommandUI.IsInsert Then
|
||
EDIT_STATE = EditState.Insert
|
||
Else
|
||
EDIT_STATE = EditState.Update
|
||
NEW_RECORD_ID = 0
|
||
If RECORD_CHANGED = False Then
|
||
Update_Notification_Label(True, "NO CHANGES in Record.", "")
|
||
|
||
DisableEditMode()
|
||
EDIT_STATE = EditState.None
|
||
Me.Cursor = Cursors.Default
|
||
Return True
|
||
End If
|
||
|
||
End If
|
||
|
||
|
||
|
||
If TrySave_User() = False Then
|
||
' Cursor zurücksetzen
|
||
Me.Cursor = Cursors.Default
|
||
Return False
|
||
Else
|
||
If RECORD_CHANGED = True Then
|
||
RECORD_CHANGED = False
|
||
End If
|
||
|
||
|
||
'ClassProxy.PRPROXY_RECORD_UPD_INS(CURRENT_ENTITY_ID, CURRENT_RECORD_ID)
|
||
End If
|
||
|
||
Dim recid As Integer
|
||
'If EDIT_STATE = EditState.Update Then
|
||
' recid = RECORD_ID
|
||
'Else
|
||
' recid = NEW_RECORD_ID
|
||
'End If
|
||
recid = CURRENT_RECORD_ID
|
||
|
||
|
||
If recid = 0 Then
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Attention:", "No Current row selected")
|
||
Me.Cursor = Cursors.Default
|
||
Return False
|
||
End If
|
||
If EDIT_STATE = EditState.Insert Then
|
||
|
||
Dim exec = String.Format("EXEC PRPMO_CLIENT_AFTER_RECORD_INSERT {0}", CURRENT_RECORD_ID)
|
||
MYDB_ECM.ExecuteNonQuery(exec)
|
||
ElseIf EDIT_STATE = EditState.Update Then
|
||
'Weil es ein Insert war müssen noch die Daten gespeichert/erneuert werden
|
||
|
||
End If
|
||
CtrlCommandUI.IsInsert = False
|
||
CtrlCommandUI.IsEdit = False
|
||
INSERT_IN_ACTION = False
|
||
'Jetzt den Record nochmal laden
|
||
' Show_Selected_Record_Data(SELECTED_RECORD_ID)
|
||
Update_Notification_Label(True, "Record saved", "Lime")
|
||
Update_Record_Label(CURRENT_RECORD_ID)
|
||
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error Saving Record", ex.Message, ex.StackTrace)
|
||
Return False
|
||
End Try
|
||
'If ADD_RECORDS_CONSTR = False Then
|
||
' tsButtonAdd.Enabled = False
|
||
'Else
|
||
' tsButtonAdd.Enabled = True
|
||
'End If
|
||
|
||
|
||
If CtrlCommandUI.IsInsert Then
|
||
bbtnitmRecSave.Enabled = False
|
||
'
|
||
End If
|
||
|
||
|
||
'If CtrlCommandUI.IsInsert Then
|
||
' tsButtonSave.Enabled = False
|
||
' tsButtonCancel.Visible = False
|
||
'End If
|
||
DisableEditMode()
|
||
|
||
CtrlCommandUI.IsInsert = False
|
||
INSERT_IN_ACTION = False
|
||
EDIT_STATE = EditState.None
|
||
RECORD_CHANGED = False
|
||
SAVE_ROUTINE_ACTIVE = False
|
||
Me.Cursor = Cursors.Default
|
||
Return True
|
||
End Function
|
||
Private Sub cmsResultFileDetail_Opening(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles cmsResultFileDetail.Opening
|
||
Try
|
||
If WMMOD.SessionLoggedin = False Then
|
||
ClassHelper.MSGBOX_Handler("INFO", "Attention", "Check Your windream-connection and restart orgFLOW afterwards.", "Could not create a windream session!")
|
||
e.Cancel = True
|
||
End If
|
||
Me.Cursor = Cursors.WaitCursor
|
||
|
||
mySelectedDocs = ClassDocGrid.GetSelectedDocuments(GridViewDoc_Search)
|
||
|
||
If ClassDocGrid.HasNoSelectedDocuments(GridViewDoc_Search) Then
|
||
e.Cancel = True
|
||
Exit Sub
|
||
End If
|
||
|
||
If mySelectedDocs.First.DocId = 0 Then
|
||
e.Cancel = True
|
||
Exit Sub
|
||
End If
|
||
tsmiFileInWorkMultiple_Free.Visible = False
|
||
tsmiFileInWorkMultiple_Lock.Visible = False
|
||
INWORK_MULTIPLE_FILES_SET_FREE = False
|
||
If mySelectedDocs.Count > 1 Then
|
||
ContextMenu_Multiplefiles()
|
||
For Each oDoc As ClassDocGrid.clsWMDoc In mySelectedDocs
|
||
If oDoc.InWork = True Then
|
||
If oDoc.InWorkUser = USER_USERNAME.ToUpper Or USER_IS_ADMIN Or USER_IS_SUPERVISOR Then
|
||
INWORK_MULTIPLE_FILES_SET_FREE = True
|
||
End If
|
||
End If
|
||
Next
|
||
End If
|
||
If INWORK_MULTIPLE_FILES_SET_FREE = True Then
|
||
tsmiFileInWorkMultiple_Free.Visible = True
|
||
End If
|
||
If mySelectedDocs.Count = 1 Then
|
||
File_in_Work()
|
||
If WM_READ_ONLY Then
|
||
ContextMenu_Read()
|
||
ElseIf WM_ADD_NO_DELETE Then
|
||
ContextMenu_ADD()
|
||
Else
|
||
Dim oSelectedDocument = mySelectedDocs.First
|
||
Dim Result = ClassDOC_SEARCH.Get_File_Rights(oSelectedDocument.DocId)
|
||
If Not IsNothing(Result) Then
|
||
_RowReadOnly = False
|
||
Select Case Result.ToString
|
||
Case "R"
|
||
ContextMenu_Read()
|
||
Case "RW"
|
||
ContextMenu_Write()
|
||
Case "RWA"
|
||
ContextMenu_Write()
|
||
Case ""
|
||
If USER_IS_ADMIN = False Then
|
||
ContextMenu_Read()
|
||
Else
|
||
NNLogger.Warn("FileRight is '' but User is Admin!! - Check the configuration!")
|
||
End If
|
||
_RowReadOnly = True
|
||
End Select
|
||
CURRENT_FILE_RIGHT = Result.ToString
|
||
Else
|
||
ContextMenu_Read()
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", "Error in Getting rights - check the log")
|
||
e.Cancel = True
|
||
End If
|
||
If _RowReadOnly = False Then
|
||
If RIGHT_READ_ONLY_DOC = True Then
|
||
If USER_IS_ADMIN = False Then
|
||
ContextMenu_Read()
|
||
Else
|
||
NNLogger.Warn("RIGHT_READ_ONLY_DOC = True but User is Admin!! - Check the configuration!")
|
||
End If
|
||
End If
|
||
End If
|
||
End If
|
||
|
||
If mySelectedDocs.First.DisplayName <> "" Then
|
||
tsmiFileRenameDisplayname.Visible = True
|
||
Else
|
||
tsmiFileRenameDisplayname.Visible = False
|
||
End If
|
||
If CURRENT_ENTITY_ID <> OF_FILESTORE_ENTITY Then
|
||
TsmitmJumpToFilestore.Visible = True
|
||
Else
|
||
TsmitmJumpToFilestore.Visible = False
|
||
End If
|
||
Else
|
||
tsmiFileRenameDisplayname.Visible = False
|
||
End If
|
||
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", "Error in Opening DocContextMenu: ", ex.Message)
|
||
e.Cancel = True
|
||
Finally
|
||
Me.Cursor = Cursors.Default
|
||
End Try
|
||
End Sub
|
||
|
||
Sub ContextMenu_Multiplefiles()
|
||
tsmiFileProperties.Enabled = False
|
||
tsmiFileOpen.Enabled = False
|
||
tsmiFileFolderOpen.Enabled = False
|
||
tsmiFileInWork.Enabled = False
|
||
tsmiFileLink_Add.Enabled = True
|
||
tsmiFileLink_ShowAll.Enabled = True
|
||
tsmiFileLinkRemove.Enabled = True
|
||
|
||
tsmiFileRename.Enabled = False
|
||
tsmiFileVersion.Enabled = False
|
||
tsmiFileRightsShow.Enabled = False
|
||
|
||
tsmiFileDelete.Enabled = False
|
||
tsmiFileInWorkMultiple_Lock.Visible = True
|
||
End Sub
|
||
|
||
Sub ContextMenu_Read()
|
||
tsmiFileProperties.Enabled = True
|
||
|
||
tsmiFileOpen.Enabled = True
|
||
tsmiFileFolderOpen.Enabled = True
|
||
|
||
tsmiFileInWork.Enabled = False
|
||
|
||
tsmiFileLink_Add.Enabled = False
|
||
tsmiFileLink_ShowAll.Enabled = True
|
||
tsmiFileLinkRemove.Enabled = False
|
||
|
||
tsmiFileRename.Enabled = False
|
||
tsmiFileVersion.Enabled = True
|
||
tsmiFileRightsShow.Enabled = True
|
||
|
||
tsmiFileDelete.Enabled = False
|
||
|
||
End Sub
|
||
Sub ContextMenu_ADD()
|
||
tsmiFileProperties.Enabled = True
|
||
|
||
tsmiFileOpen.Enabled = True
|
||
tsmiFileFolderOpen.Enabled = True
|
||
|
||
tsmiFileInWork.Enabled = True
|
||
|
||
tsmiFileLink_Add.Enabled = True
|
||
tsmiFileLink_ShowAll.Enabled = True
|
||
tsmiFileLinkRemove.Enabled = True
|
||
|
||
tsmiFileRename.Enabled = False
|
||
tsmiFileVersion.Enabled = False
|
||
tsmiFileRightsShow.Enabled = True
|
||
|
||
tsmiFileDelete.Enabled = False
|
||
|
||
End Sub
|
||
Sub ContextMenu_Write()
|
||
tsmiFileProperties.Enabled = True
|
||
|
||
tsmiFileOpen.Enabled = True
|
||
tsmiFileFolderOpen.Enabled = True
|
||
|
||
tsmiFileInWork.Enabled = True
|
||
|
||
tsmiFileLink_Add.Enabled = True
|
||
tsmiFileLink_ShowAll.Enabled = True
|
||
tsmiFileLinkRemove.Enabled = True
|
||
|
||
tsmiFileRename.Enabled = True
|
||
tsmiFileVersion.Enabled = True
|
||
tsmiFileRightsShow.Enabled = True
|
||
|
||
tsmiFileDelete.Enabled = True
|
||
End Sub
|
||
Sub Open_File()
|
||
Me.Cursor = Cursors.WaitCursor
|
||
Dim allow_Open As Boolean = False
|
||
|
||
Dim oDocuments = Current_DocList.SelectedDocuments
|
||
If Not IsNothing(oDocuments) Then
|
||
If oDocuments.Count <> 1 Then
|
||
MsgBox("Sorry, but no document has been selected! Please select the docúment row again!", MsgBoxStyle.Exclamation)
|
||
Exit Sub
|
||
End If
|
||
End If
|
||
Dim Result = ClassDOC_SEARCH.Get_File_Rights(oDocuments.First.DocId)
|
||
|
||
|
||
If Not IsNothing(Result) Then
|
||
Select Case Result.ToString
|
||
Case "R"
|
||
allow_Open = True
|
||
Case "RW"
|
||
allow_Open = True
|
||
Case "RWA"
|
||
allow_Open = True
|
||
End Select
|
||
End If
|
||
If allow_Open = True Then
|
||
'If IsNothing(ClassWindreamDocGrid.DT_RESULTFILES) Then
|
||
' MsgBox("Could not read File Parameters(5)!", MsgBoxStyle.Exclamation)
|
||
' Exit Sub
|
||
'End If
|
||
If ClassDocGrid.HasNoSelectedDocuments(GridViewDoc_Search) Then
|
||
MsgBox("Could not read File Parameters(5)!", MsgBoxStyle.Exclamation)
|
||
Exit Sub
|
||
End If
|
||
'For Each row As DataRow In ClassWindreamDocGrid.DT_RESULTFILES.Rows
|
||
' If ClassHelper.File_open(row.Item("DOC_PATH"), row.Item("DOC_ID")) = True Then
|
||
' TimerFileHandle.Enabled = True
|
||
' End If
|
||
'Next
|
||
For Each oDoc As ClassDocGrid.clsWMDoc In ClassDocGrid.GetSelectedDocuments(GridViewDoc_Search)
|
||
If ClassHelper.File_open(oDoc.DocPath, oDoc.DocId, oDoc.ParentID) = True Then
|
||
TimerFileHandle.Enabled = True
|
||
End If
|
||
Next
|
||
Else
|
||
If WMMOD.TestFileExists(oDocuments.First.DocPath) = True Then
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Right-Management", "File is existing, but you do not have the rights to open this file! " & vbNewLine & "Please contact your admin!" & vbNewLine & "DOC-ID: " & oDocuments.First.DocId.ToString)
|
||
Else
|
||
ClassHelper.MSGBOX_Handler("ERROR", "", "File does not exist! Please contact your admin!")
|
||
End If
|
||
End If
|
||
Me.Cursor = Cursors.Default
|
||
End Sub
|
||
Sub File_in_Work()
|
||
IW_USER = ""
|
||
IW_COMMENT = ""
|
||
INWORK_FILE = False
|
||
tsmiFileInWork.Enabled = True
|
||
Try
|
||
'Dim expression As String
|
||
'expression = "DocID = " & ClassWindreamDocGrid.SELECTED_DOC_ID
|
||
'Dim foundRowsLevel0() As DataRow
|
||
' Use the Select method to find all rows matching the filter.
|
||
'foundRowsLevel0 = CURRENT_DOC_RESULTS.Select(expression)
|
||
|
||
Dim oDocuments = Current_DocList.SelectedDocuments
|
||
If oDocuments.Count = 1 Then
|
||
Try
|
||
Dim oSQLDRList = $"Select COALESCE(IN_WORK_USER,'') IN_WORK_USER, COALESCE(IN_WORK_COMMENT,'') IN_WORK_COMMENT,IN_WORK FROM TBPMO_DOCRESULT_LIST where DocID = {oDocuments.First.DocId}"
|
||
Dim oDT As DataTable = MYDB_ECM.GetDatatable(oSQLDRList)
|
||
If Not IsNothing(oDT) Then
|
||
If oDT.Rows.Count = 1 Then
|
||
IW_USER = oDT.Rows(0).Item("IN_WORK_USER")
|
||
IW_COMMENT = oDT.Rows(0).Item("IN_WORK_COMMENT")
|
||
INWORK_FILE = CBool(oDT.Rows(0).Item("IN_WORK"))
|
||
End If
|
||
End If
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
IW_USER = ""
|
||
IW_COMMENT = ""
|
||
End Try
|
||
|
||
|
||
Dim displ As String
|
||
If INWORK_FILE = True Then
|
||
If IW_USER.ToUpper = USER_USERNAME.ToUpper Or USER_IS_ADMIN Or USER_IS_SUPERVISOR Then
|
||
displ = "Datei wieder freigeben"
|
||
If USER_LANGUAGE <> "de-DE" Then
|
||
displ = "Set file free"
|
||
End If
|
||
Else
|
||
displ = "Datei in Bearbeitung (zeige Info)"
|
||
If USER_LANGUAGE <> "de-DE" Then
|
||
displ = "File is in work (show details)"
|
||
End If
|
||
End If
|
||
Else
|
||
displ = "Datei in Bearbeitung nehmen"
|
||
If USER_LANGUAGE <> "de-DE" Then
|
||
displ = "Lock file for working"
|
||
End If
|
||
End If
|
||
tsmiFileInWork.Text = displ
|
||
Else
|
||
MsgBox("Bitte nur eine Datei wählen!", MsgBoxStyle.Exclamation)
|
||
End If
|
||
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
NNLogger.Warn("Unexpected Error in File-Work Info: " & ex.Message)
|
||
tsmiFileInWork.Enabled = False
|
||
End Try
|
||
End Sub
|
||
|
||
Private Async Sub tsmiFileInWork_Click(sender As Object, e As EventArgs) Handles tsmiFileInWork.Click
|
||
If ClassDocGrid.HasNoSelectedDocuments(GridViewDoc_Search) Then
|
||
MsgBox("Could not read File Parameters (3)!", MsgBoxStyle.Exclamation)
|
||
Exit Sub
|
||
End If
|
||
Dim oDocuments = Current_DocList.SelectedDocuments
|
||
|
||
If oDocuments.Count >= 1 Then
|
||
ClassFileResult.DocID = oDocuments.First.DocId
|
||
If INWORK_FILE = True Then ' Datei ist in Bearbeitung
|
||
Dim msglbl As String
|
||
Dim msg1 As String
|
||
If IW_USER.ToUpper = USER_USERNAME.ToUpper Or USER_IS_ADMIN Or USER_IS_SUPERVISOR Then
|
||
If ClassFileResult.Set_InWork(0, "") = True Then
|
||
Await RUN_DOCSEARCH(True)
|
||
End If
|
||
Else
|
||
msglbl = "In Bearbeitung durch User '" & IW_USER & "' - Kommentar:"
|
||
msg1 = IW_COMMENT
|
||
If USER_LANGUAGE <> "de-DE" Then
|
||
msglbl = "File being edited by user '" & IW_USER & "' - Comment:"
|
||
End If
|
||
ClassHelper.MSGBOX_Handler("INFO", "Information file", msglbl, msg1)
|
||
End If
|
||
Else
|
||
frmFileInWork.myDocuments = mySelectedDocs
|
||
frmFileInWork.ShowDialog()
|
||
ClassDocGrid.SELECTED_INWORK = ClassFileResult.InWork
|
||
Await RUN_DOCSEARCH(True)
|
||
End If
|
||
End If
|
||
|
||
End Sub
|
||
|
||
Private Sub frmNodeNavigation_Shown(sender As Object, e As EventArgs) Handles Me.Shown
|
||
Me.BringToFront()
|
||
TreeListDevexpress.CollapseAll()
|
||
FORM_SHOWN = True
|
||
End Sub
|
||
Public Sub JumptoNode()
|
||
If JUMP_ID > 0 Then
|
||
If TreeListDevexpress.DataSource Is Nothing OrElse TreeListDevexpress.Nodes.Count = 0 Then
|
||
NNLogger.Debug("JumptoNode: TreeList noch nicht geladen. Warte bis Load_nodes fertig ist.")
|
||
' Frühzeitiger Exit – Load_nodes springt später
|
||
Exit Sub
|
||
End If
|
||
Dim targetGuid As Integer = Convert.ToInt32(JUMP_ID)
|
||
' Suche über Datenfeld "GUID" statt über die interne Node-Id
|
||
Dim oFindNode As TreeListNode = TreeListDevexpress.FindNodeByFieldValue("GUID", targetGuid)
|
||
If oFindNode IsNot Nothing Then
|
||
' Sichtbar machen (expandiert ggf. Eltern)
|
||
TreeListDevexpress.MakeNodeVisible(oFindNode)
|
||
' Fokus setzen
|
||
TreeListDevexpress.SetFocusedNode(oFindNode)
|
||
' Optional: markieren
|
||
TreeListDevexpress.FocusedNode = oFindNode
|
||
Else
|
||
NNLogger.Warn($"JumpToNode: kein Knoten mit GUID={JUMP_ID} gefunden.")
|
||
End If
|
||
JUMP_ID = 0
|
||
End If
|
||
End Sub
|
||
Private Async Sub tsmiFileRenameDisplayname_Click(sender As Object, e As EventArgs) Handles tsmiFileRenameDisplayname.Click
|
||
Try
|
||
Dim oDocuments = Current_DocList.SelectedDocuments
|
||
If oDocuments.Count = 1 Then
|
||
ClassFileResult.DocID = oDocuments.First.DocId
|
||
ClassFileResult.DocumentPath = oDocuments.First.DocPath
|
||
ClassFileResult.OldDisplayName = oDocuments.First.DisplayName
|
||
If oDocuments.First.DisplayName <> "" And ClassFileResult.DocID > 0 Then
|
||
Dim oRowHandle As Integer = GridViewDoc_Search.FocusedRowHandle
|
||
Dim frm As New frmFileRename(ClassFileResult.DocID, oDocuments.First.DisplayName, "Displayname", ClassFileResult.DocumentPath)
|
||
frm.ShowDialog()
|
||
Await RUN_DOCSEARCH(True)
|
||
If Not IsNothing(oRowHandle) Then
|
||
GridViewDoc_Search.FocusedRowHandle = oRowHandle
|
||
End If
|
||
Else
|
||
MsgBox("Bitte eine Datei auswählen!", MsgBoxStyle.Information)
|
||
End If
|
||
End If
|
||
|
||
|
||
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", "Unexpected Error in getting the Displayname: ", ex.Message)
|
||
End Try
|
||
End Sub
|
||
|
||
Private Async Sub tsmiFileRenameFilename_Click(sender As Object, e As EventArgs) Handles tsmiFileRenameFilename.Click
|
||
Try
|
||
Dim RENAME_DOC_PATH
|
||
Try
|
||
RENAME_DOC_PATH = GridViewDoc_Search.GetFocusedRowCellValue(GridViewDoc_Search.Columns("FULLPATH"))
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
NNLogger.Warn("Attention: Could not set DocVariable RENAME_DOC_PATH: " & ex.Message)
|
||
RENAME_DOC_PATH = Nothing
|
||
End Try
|
||
If ClassDocGrid.HasNoSelectedDocuments(GridViewDoc_Search) Then
|
||
MsgBox("Could not read File Parameters!", MsgBoxStyle.Exclamation)
|
||
Exit Sub
|
||
End If
|
||
Dim oDocuments = Current_DocList.SelectedDocuments
|
||
If oDocuments.Count = 1 Then
|
||
ClassFileResult.DocID = oDocuments.First.DocId
|
||
End If
|
||
|
||
|
||
|
||
|
||
If RENAME_DOC_PATH <> "" And ClassFileResult.DocID > 0 Then
|
||
Dim FileToRename As String
|
||
FileToRename = Path.GetFileNameWithoutExtension(RENAME_DOC_PATH)
|
||
Dim oRowHandle As Integer = GridViewDoc_Search.FocusedRowHandle
|
||
Dim frm As New frmFileRename(ClassFileResult.DocID, FileToRename, "Filename", RENAME_DOC_PATH)
|
||
frm.ShowDialog()
|
||
Await RUN_DOCSEARCH(True)
|
||
If Not IsNothing(oRowHandle) Then
|
||
GridViewDoc_Search.FocusedRowHandle = oRowHandle
|
||
End If
|
||
End If
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
MsgBox("Unexpected Error in getting the filename: " & ex.Message, MsgBoxStyle.Critical)
|
||
End Try
|
||
End Sub
|
||
|
||
Private Sub frmNodeNavigation_Click(sender As Object, e As EventArgs) Handles MyBase.Click
|
||
|
||
End Sub
|
||
|
||
Private Sub tsmiFileOpen_Click(sender As Object, e As EventArgs) Handles tsmiFileOpen.Click
|
||
Open_File()
|
||
End Sub
|
||
|
||
Private Sub tsmiFileFolderOpen_Click(sender As Object, e As EventArgs) Handles tsmiFileFolderOpen.Click
|
||
'If IsNothing(ClassWindreamDocGrid.DT_RESULTFILES) Then
|
||
' MsgBox("Could not read File Parameters(5)!", MsgBoxStyle.Exclamation)
|
||
' Exit Sub
|
||
'End If
|
||
If ClassDocGrid.HasNoSelectedDocuments(GridViewDoc_Search) Then
|
||
MsgBox("Could not read File Parameters(5)!", MsgBoxStyle.Exclamation)
|
||
Exit Sub
|
||
End If
|
||
'For Each row As DataRow In ClassWindreamDocGrid.DT_RESULTFILES.Rows
|
||
' ClassHelper.Open_Folder(row.Item("DOC_PATH"), row.Item("DOC_ID"))
|
||
'Next
|
||
For Each oDoc As ClassDocGrid.clsWMDoc In ClassDocGrid.GetSelectedDocuments(GridViewDoc_Search)
|
||
ClassHelper.Open_Folder(oDoc.DocPath, oDoc.DocId)
|
||
Next
|
||
End Sub
|
||
|
||
Private Sub tsmiFileLink_Add_Click(sender As Object, e As EventArgs) Handles tsmiFileLink_Add.Click
|
||
Try
|
||
Dim oDocuments = Current_DocList.SelectedDocuments
|
||
|
||
If oDocuments.Count = 0 Or ClassDocGrid.HasNoSelectedDocuments(GridViewDoc_Search) Then
|
||
MsgBox("Could not read File Parameters (LinkRecord)!", MsgBoxStyle.Exclamation)
|
||
Exit Sub
|
||
End If
|
||
Refresh_Selected_Table()
|
||
|
||
Dim oForm As New frmDocRecordLink With {.myDocuments = oDocuments}
|
||
oForm.Show()
|
||
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
NNLogger.Error(ex)
|
||
MsgBox("Unexpected Error in Showing DocRecordLink-Form (NodeNavigation): " & ex.Message, MsgBoxStyle.Critical)
|
||
End Try
|
||
End Sub
|
||
Sub Refresh_Selected_Table()
|
||
Dim table As New DataTable With {
|
||
.TableName = "SelectedFiles"
|
||
}
|
||
|
||
' Create two columns, ID and Name.
|
||
Dim idColumn As DataColumn = table.Columns.Add("ID", GetType(System.Int32))
|
||
idColumn.AutoIncrement = True
|
||
idColumn.AutoIncrementSeed = 0
|
||
idColumn.AutoIncrementStep = 1
|
||
table.PrimaryKey = New DataColumn() {idColumn}
|
||
table.Columns.Add("FILEPATH", GetType(System.String))
|
||
table.Columns.Add("DOC_ID", GetType(System.Int32))
|
||
table.Columns.Add("OBJECTTYPE", GetType(System.String))
|
||
For Each oDoc As ClassDocGrid.clsWMDoc In ClassDocGrid.GetSelectedDocuments(GridViewDoc_Search)
|
||
If oDoc.DocPath <> String.Empty Then
|
||
'Set the ID column as the primary key column.
|
||
Dim newRow As DataRow = table.NewRow()
|
||
newRow("FILEPATH") = oDoc.DocPath
|
||
newRow("DOC_ID") = oDoc.DocId
|
||
newRow("OBJECTTYPE") = oDoc.DocType
|
||
table.Rows.Add(newRow)
|
||
End If
|
||
Next
|
||
table.AcceptChanges()
|
||
CURRENT_DT_SELECTED_FILES = table
|
||
End Sub
|
||
|
||
Private Sub tsmiFileLink_ShowAll_Click(sender As Object, e As EventArgs) Handles tsmiFileLink_ShowAll.Click
|
||
Try
|
||
Dim oDocID = GridViewDoc_Search.GetRowCellValue(GridViewDoc_Search.FocusedRowHandle, "DocID")
|
||
If IsNothing(oDocID) Then
|
||
MsgBox("Could not get DocID!", MsgBoxStyle.Exclamation)
|
||
Exit Sub
|
||
End If
|
||
CURRENT_DOC_ID = GridViewDoc_Search.GetRowCellValue(GridViewDoc_Search.FocusedRowHandle, "DocID")
|
||
|
||
Dim oDocuments = Current_DocList.SelectedDocuments
|
||
Dim oForm As New frmDoc_Links With {.Documents = oDocuments}
|
||
oForm.Show()
|
||
oForm.BringToFront()
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
MsgBox("Unexpected Error in Showing DocLinks: " & ex.Message, MsgBoxStyle.Critical)
|
||
End Try
|
||
End Sub
|
||
|
||
Private Async Sub tsmiFileLinkRemove_Click(sender As Object, e As EventArgs) Handles tsmiFileLinkRemove.Click
|
||
If CURRENT_RECORD_ID = 0 Then
|
||
ClassHelper.MSGBOX_Handler("INFO", "Attention", "Missing Selection:", "Please select a record!")
|
||
Exit Sub
|
||
End If
|
||
If ClassDocGrid.HasNoSelectedDocuments(GridViewDoc_Search) Then
|
||
Exit Sub
|
||
End If
|
||
|
||
Dim msg = "Wollen Sie die Verknüpfung der gewählten Datei/en wirklich entfernen?" & vbNewLine & "Datei/en bleibt/bleiben im DMS/Archiv/Explorer erhalten!"
|
||
If USER_LANGUAGE <> "de-DE" Then
|
||
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, CAPTION_CONFIRMATION, MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||
If result = MsgBoxResult.Yes Then
|
||
Try
|
||
For Each oDoc As ClassDocGrid.clsWMDoc In ClassDocGrid.GetSelectedDocuments(GridViewDoc_Search)
|
||
If ClassFileResult.Delete_ResultFile(oDoc.DocId, CURRENT_RECORD_ID, 0) = True Then
|
||
ClassHelper.InsertEssential_Log(oDoc.DocId, "DOC-ID", "RECORD LINK REMOVED FROM DOC-SEARCH")
|
||
Cursor = Cursors.WaitCursor
|
||
Await RUN_DOCSEARCH(True)
|
||
End If
|
||
|
||
|
||
Next
|
||
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", "Error in Removing links from file:", ex.Message)
|
||
End Try
|
||
End If
|
||
End Sub
|
||
|
||
Private Async Sub tsmiFileVersion_Click(sender As Object, e As EventArgs) Handles tsmiFileVersion.Click
|
||
Refresh_Selected_Table()
|
||
Dim oDocuments = Current_DocList.SelectedDocuments
|
||
If oDocuments.Count = 1 Then
|
||
ClassFileResult.DocID = oDocuments.First.DocId
|
||
ClassFileResult.ParentID = oDocuments.First.ParentID
|
||
ClassFileResult.FileName = oDocuments.First.Filename
|
||
frmWM_CreateVersion.ShowDialog()
|
||
Await RUN_DOCSEARCH(True)
|
||
Else
|
||
MsgBox("Please choose only one document!", MsgBoxStyle.Exclamation)
|
||
End If
|
||
|
||
|
||
|
||
End Sub
|
||
|
||
Private Sub tsmiFileRightsShow_Click(sender As Object, e As EventArgs) Handles tsmiFileRightsShow.Click
|
||
Dim oDocuments = Current_DocList.SelectedDocuments
|
||
|
||
Dim result = ClassDOC_SEARCH.Get_File_Rights(oDocuments.First.DocId)
|
||
If Not IsNothing(result) Then
|
||
Dim msg = "Das aktuelle Recht für Sie (" & USER_USERNAME & ") ist: "
|
||
If USER_LANGUAGE <> "de-DE" Then
|
||
msg = "Your (" & USER_USERNAME & ") current right is: "
|
||
End If
|
||
msg = msg & result.ToString
|
||
msg = msg & vbNewLine & vbNewLine & "R:" & vbTab & "Read" & vbNewLine & "W:" & vbTab & "Write" & vbNewLine & "A:" & vbTab & "Admin"
|
||
MsgBox(msg, MsgBoxStyle.Information)
|
||
Else
|
||
MsgBox("Could not read the rights for selected file! Check the log for further infomation!", MsgBoxStyle.Exclamation)
|
||
End If
|
||
End Sub
|
||
|
||
Private Sub tsmiFileProperties_Click(sender As Object, e As EventArgs) Handles tsmiFileProperties.Click
|
||
Show_File_Properties()
|
||
End Sub
|
||
Sub Show_File_Properties()
|
||
If ClassDocGrid.HasNoSelectedDocuments(GridViewDoc_Search) Then
|
||
MsgBox("Could not read File Parameters(4)!", MsgBoxStyle.Exclamation)
|
||
Exit Sub
|
||
End If
|
||
Cursor = Cursors.WaitCursor
|
||
For Each oDoc As ClassDocGrid.clsWMDoc In ClassDocGrid.GetSelectedDocuments(GridViewDoc_Search)
|
||
If oDoc.DocPath <> "" Then
|
||
Dim oFileFullPath = ClassHelper.FORMAT_WM_PATH(oDoc.DocPath)
|
||
Try
|
||
If Not WindowsEx.OpenFileProperties(oFileFullPath) Then
|
||
Dim ex As New System.ComponentModel.Win32Exception(System.Runtime.InteropServices.Marshal.GetLastWin32Error())
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", "Error in Open file propertys:", ex.Message)
|
||
End If
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
NNLogger.Error(ex)
|
||
End Try
|
||
End If
|
||
Next
|
||
Cursor = Cursors.Default
|
||
End Sub
|
||
|
||
Private Sub EigenschaftenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles EigenschaftenToolStripMenuItem.Click
|
||
Show_File_Properties()
|
||
End Sub
|
||
|
||
Private Async Sub bbtnitmDocResultRefresh_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtnitmDocResultRefresh.ItemClick
|
||
Await RUN_DOCSEARCH(True)
|
||
End Sub
|
||
|
||
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
|
||
CURRENT_SEARCH_TYPE = "ENTITY"
|
||
RUN_ENTITY_DOC_SEARCH()
|
||
End Sub
|
||
|
||
Private Async Function bbtnitmReloadView_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) As Task Handles bbtnitmReloadView.ItemClick
|
||
Await ReloadTreeView()
|
||
End Function
|
||
Async Function ReloadTreeView() As Task
|
||
TreeListDevexpress.Nodes.Clear()
|
||
Await Load_nodes()
|
||
End Function
|
||
|
||
Private Async Function UnterknotenNeuOrdnenToolStripMenuItem_Click(sender As Object, e As EventArgs) As Task
|
||
MyTreeListViewState = New ClassTreeListViewState(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 Function
|
||
End If
|
||
Cursor = Cursors.WaitCursor
|
||
Dim oSQL = $"EXEC PRCUST_REORDER_CHILD_NODES "
|
||
Dim oNodeGUID As Integer = 0
|
||
Dim oID = MyFocusedNode.Id
|
||
Dim PID = MyFocusedNode.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} "
|
||
MYDB_ECM.ExecuteNonQuery(oSQL)
|
||
Await ReloadTreeView()
|
||
MyTreeListViewState.LoadState()
|
||
TreeListDevexpress.FocusedNode = MyFocusedNode
|
||
|
||
End If
|
||
|
||
Cursor = Cursors.Default
|
||
|
||
End Function
|
||
|
||
'Private Sub TreeListDevexpress_MouseUp(sender As Object, e As MouseEventArgs) Handles TreeListDevexpress.MouseUp
|
||
' Dim tree As TreeList = TryCast(sender, TreeList)
|
||
' Dim oLocation = e.Location
|
||
' '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
|
||
|
||
Private Sub GridViewDoc_Search_RowStyle(sender As Object, e As RowStyleEventArgs) Handles GridViewDoc_Search.RowStyle
|
||
If FORM_SHOWN = False Then
|
||
Exit Sub
|
||
End If
|
||
If e.RowHandle = DevExpress.XtraGrid.GridControl.AutoFilterRowHandle Then
|
||
e.Appearance.BackColor = Color.Yellow
|
||
Else
|
||
If e.RowHandle = -1 Then
|
||
Exit Sub
|
||
End If
|
||
Try
|
||
Dim rowCellValue = GridViewDoc_Search.GetRowCellValue(e.RowHandle, "in work?")
|
||
If Not IsNothing(rowCellValue) Then
|
||
Dim inwork = rowCellValue
|
||
If inwork = True Then
|
||
e.Appearance.BackColor = Color.Orchid
|
||
e.HighPriority = True
|
||
End If
|
||
End If
|
||
Catch ex As Exception
|
||
NNLogger.Warn("Unexpected Error in Checking Value In Work: " & ex.Message)
|
||
End Try
|
||
|
||
Try
|
||
Dim DROPDOWN_VALUE
|
||
If Not IsNothing(DT_DOCRESULT_DROPDOWN_ITEMS) Then
|
||
'Den ColumnTitle aus ConfigTableholen
|
||
If DT_DOCRESULT_DROPDOWN_ITEMS.Rows.Count > 0 Then
|
||
For Each confrow As DataRow In DT_DOCRESULT_DROPDOWN_ITEMS.Rows
|
||
Dim CAPTION = confrow.Item("HEADER_CAPTION")
|
||
DROPDOWN_VALUE = GridViewDoc_Search.GetRowCellValue(e.RowHandle, CAPTION)
|
||
If Not IsNothing(DROPDOWN_VALUE) Then
|
||
Exit For
|
||
End If
|
||
Next
|
||
|
||
If Not IsNothing(DROPDOWN_VALUE) Then
|
||
Dim ColorRow As Color
|
||
Dim expression As String = String.Format("VALUE = '{0}'", DROPDOWN_VALUE)
|
||
Dim matchingRows() As DataRow = DT_DOCRESULT_DROPDOWN_ITEMS.Select(expression, "SEQUENCE")
|
||
Dim rowcolorname As String = ""
|
||
'Die Color für den value auswählen
|
||
For Each matchingRow As DataRow In matchingRows
|
||
rowcolorname = ""
|
||
If Not IsDBNull(matchingRow.Item("COLOR")) Then
|
||
rowcolorname = matchingRow.Item("COLOR")
|
||
End If
|
||
|
||
If rowcolorname <> "" Then
|
||
Exit For
|
||
End If
|
||
Next
|
||
If rowcolorname <> "" Then
|
||
ColorRow = Color.FromName(rowcolorname)
|
||
e.Appearance.BackColor = ColorRow
|
||
e.HighPriority = True
|
||
End If
|
||
|
||
|
||
'Dim c As Color = DirectCast(rowCellValue, Color)
|
||
|
||
End If
|
||
End If
|
||
|
||
|
||
End If
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
NNLogger.Warn("Unexpected Error in RowStyle-Color Dropdown: " & ex.Message)
|
||
End Try
|
||
|
||
End If
|
||
End Sub
|
||
|
||
Private Async Function BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) As Task Handles BbtnitmNodeReorder.ItemClick
|
||
MyTreeListViewState = New ClassTreeListViewState(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 Function
|
||
End If
|
||
Cursor = Cursors.WaitCursor
|
||
Dim oSQL = $"EXEC PRCUST_REORDER_CHILD_NODES "
|
||
Dim oNodeGUID As Integer = 0
|
||
Dim oID = MyFocusedNode.Id
|
||
Dim PID = MyFocusedNode.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} "
|
||
MYDB_ECM.ExecuteNonQuery(oSQL)
|
||
Await ReloadTreeView()
|
||
MyTreeListViewState.LoadState()
|
||
TreeListDevexpress.FocusedNode = MyFocusedNode
|
||
Update_Notification_Label(True, "Nodes reordered", "Lime")
|
||
End If
|
||
|
||
Cursor = Cursors.Default
|
||
End Function
|
||
|
||
Private Sub bbtnItm_TV_Collape_Expand_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtnItm_TV_Collape_Expand.ItemClick
|
||
If TV_Collapse_ExpandState = "Collapse" Then
|
||
TreeListDevexpress.CollapseAll()
|
||
TV_Collapse_ExpandState = "Expand"
|
||
Else
|
||
TreeListDevexpress.ExpandAll()
|
||
TV_Collapse_ExpandState = "Collapse"
|
||
End If
|
||
End Sub
|
||
|
||
Private Sub bbtnitmRecSave_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtnitmRecSave.ItemClick
|
||
Save_Record()
|
||
End Sub
|
||
|
||
Private Sub checkShowPreview_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles checkShowPreview.CheckedChanged
|
||
If FORM_LOADED = False Then
|
||
Exit Sub
|
||
End If
|
||
If DocViewInitialized Then
|
||
CONFIG.Config.DocumentViewerShown = checkShowPreview.Checked
|
||
CONFIG.Save()
|
||
SplitContainerDocView.Collapsed = Not checkShowPreview.Checked
|
||
If checkShowPreview.Checked Then
|
||
DocView_DisplaySelectedDoc(False)
|
||
End If
|
||
Else
|
||
SplitContainerDocView.Collapsed = True
|
||
|
||
End If
|
||
|
||
End Sub
|
||
|
||
Private Sub GridViewDoc_Search_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles GridViewDoc_Search.SelectionChanged
|
||
DocView_DisplaySelectedDoc(False)
|
||
End Sub
|
||
Private Async Sub DocView_DisplaySelectedDoc(AfterNodeChange As Boolean)
|
||
If AfterNodeChange Then
|
||
Exit Sub
|
||
End If
|
||
Dim oHandle = SplashScreenManager.ShowOverlayForm(Me)
|
||
Try
|
||
Dim oSelectedDoc = ClassDocGrid.GetSingleSelectedDocument(GridViewDoc_Search)
|
||
If Not IsNothing(oSelectedDoc) Then
|
||
If checkShowPreview.Checked Then
|
||
If DocViewInitialized Then
|
||
If oSelectedDoc.Count = 1 Then
|
||
Close_Document_Viewer()
|
||
System.Threading.Thread.Sleep(400)
|
||
Dim oDocument As ClassDocGrid.clsWMDoc = oSelectedDoc.First()
|
||
Dim oPath = ClassHelper.FORMAT_WM_PATH(oDocument.DocPath)
|
||
|
||
DocumentViewer.LoadFile(oPath)
|
||
Else
|
||
NNLogger.Debug("Show_SelectedDoc - oSelectedDocs.Count not = 1 ")
|
||
Close_Document_Viewer()
|
||
End If
|
||
Else
|
||
NNLogger.Info("DocumentViewer not inited. No Show_SelectedDoc")
|
||
End If
|
||
End If
|
||
|
||
Else
|
||
NNLogger.Debug("Show_SelectedDoc - oSelectedDocs is nothing")
|
||
End If
|
||
|
||
|
||
|
||
|
||
|
||
|
||
' If AfterNodeChange Then Exit Sub
|
||
|
||
'Dim oHandle = SplashScreenManager.ShowOverlayForm(Me)
|
||
|
||
'Try
|
||
' Dim oSelectedDoc = ClassDocGrid.GetSingleSelectedDocument(GridViewDoc_Search)
|
||
|
||
' If oSelectedDoc Is Nothing OrElse oSelectedDoc.Count <> 1 Then
|
||
' NNLogger.Debug("Kein oder mehrere Dokumente ausgewählt.")
|
||
' Close_Document_Viewer()
|
||
' Return
|
||
' End If
|
||
|
||
' If Not checkShowPreview.Checked OrElse Not DocViewInitialized Then
|
||
' NNLogger.Info("Vorschau deaktiviert oder Viewer nicht initialisiert.")
|
||
' Return
|
||
' End If
|
||
|
||
' Close_Document_Viewer()
|
||
' Await Task.Delay(400)
|
||
|
||
' Dim oDocument As ClassDocGrid.clsWMDoc = oSelectedDoc.First()
|
||
' Dim oPath = ClassHelper.FORMAT_WM_PATH(oDocument.DocPath)
|
||
' NNLogger.Debug("Starte DocumentViewer.LoadFile...")
|
||
|
||
' ' Flag für Erfolg
|
||
' Dim fileLoadedSuccessfully As Boolean = False
|
||
|
||
' ' Starte Timeout-Überwachung
|
||
' Dim timeoutTask = Task.Delay(TimeSpan.FromSeconds(20))
|
||
|
||
' ' Starte Laden im UI-Thread
|
||
' Dim loadTask = Task.Run(Sub()
|
||
' Try
|
||
' ' Direkt im UI-Thread ausführen
|
||
' Me.Invoke(Sub()
|
||
' DocumentViewer.LoadFile(oPath)
|
||
' fileLoadedSuccessfully = True
|
||
' End Sub)
|
||
' Catch ex As Exception
|
||
' NNLogger.Error("Fehler beim Laden des Dokuments: " & ex.Message)
|
||
' End Try
|
||
' End Sub)
|
||
|
||
' ' Warte auf Timeout oder Ladeende
|
||
' Await Task.WhenAny(loadTask, timeoutTask)
|
||
|
||
' If Not fileLoadedSuccessfully Then
|
||
' NNLogger.Warn("Ladevorgang hat Timeout überschritten oder ist fehlgeschlagen.")
|
||
' ' Optional: Viewer zurücksetzen oder Meldung anzeigen
|
||
' Else
|
||
' NNLogger.Info("Dokument erfolgreich geladen.")
|
||
' End If
|
||
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
Finally
|
||
SplashScreenManager.CloseOverlayForm(oHandle)
|
||
End Try
|
||
End Sub
|
||
|
||
|
||
|
||
'Private Async Sub DocView_DisplaySelectedDoc(AfterNodeChange As Boolean)
|
||
' If AfterNodeChange Then
|
||
' Exit Sub
|
||
' End If
|
||
' Dim oHandle = SplashScreenManager.ShowOverlayForm(Me)
|
||
' Try
|
||
' Dim oSelectedDoc = ClassDocGrid.GetSingleSelectedDocument(GridViewDoc_Search)
|
||
' If Not IsNothing(oSelectedDoc) Then
|
||
' If checkShowPreview.Checked Then
|
||
' If DocViewInitialized Then
|
||
' If oSelectedDoc.Count = 1 Then
|
||
' Close_Document_Viewer()
|
||
' Await Task.Delay(400)
|
||
' Dim oDocument As ClassDocGrid.clsWMDoc = oSelectedDoc.First()
|
||
' Dim oPath = ClassHelper.FORMAT_WM_PATH(oDocument.DocPath)
|
||
' NNLogger.Debug("Now DocumentViewer.LoadFile...")
|
||
' Dim loadTask = Task.Run(Sub()
|
||
' DocumentViewer.LoadFile(oPath)
|
||
' End Sub)
|
||
|
||
' Dim timeoutTask = Task.Delay(TimeSpan.FromSeconds(20))
|
||
|
||
' Dim completedTask = Await Task.WhenAny(loadTask, timeoutTask)
|
||
|
||
' If completedTask Is timeoutTask Then
|
||
' NNLogger.Warn("Document loading timed out.")
|
||
' ' Optional: Cancel or reset viewer
|
||
' Else
|
||
' NNLogger.Info("Document loaded successfully.")
|
||
' End If
|
||
' Else
|
||
' NNLogger.Debug("Show_SelectedDoc - oSelectedDocs.Count not = 1 ")
|
||
' Close_Document_Viewer()
|
||
' End If
|
||
' Else
|
||
' NNLogger.Info("DocumentViewer not inited. No Show_SelectedDoc")
|
||
' End If
|
||
' End If
|
||
|
||
' Else
|
||
' NNLogger.Debug("Show_SelectedDoc - oSelectedDocs is nothing")
|
||
' End If
|
||
' Catch ex As Exception
|
||
' NNLogger.Error(ex)
|
||
' Finally
|
||
' SplashScreenManager.CloseOverlayForm(oHandle)
|
||
' End Try
|
||
|
||
|
||
|
||
'End Sub
|
||
Private Sub Close_Document_Viewer()
|
||
Try
|
||
DocumentViewer.CloseDocument()
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
End Try
|
||
End Sub
|
||
Private Async Sub btnCreateNewNode_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnCreateNewNode.ItemClick
|
||
Dim oForm As New frmNewNode() With {
|
||
.NodeConfigTypes = AvailableConfigNodes
|
||
}
|
||
|
||
If oForm.ShowDialog() <> DialogResult.OK Then
|
||
Exit Sub
|
||
End If
|
||
|
||
Dim oRow = NODE_CONFIGURABLE_NODES_DT.Select($"GUID = {oForm.Id}").First()
|
||
Dim oCreateRecord = oRow.Item("CREATE_RECORD")
|
||
|
||
Dim oParentNodeGuid As Integer = MyFocusedNode.Item("GUID")
|
||
Dim oIsExpanded As Boolean = MyFocusedNode.Expanded
|
||
Dim oNodeCreator = New ClassNodeCreator(LOGCONFIG, ImageCollection1)
|
||
Dim oSuccess = oNodeCreator.AddNode(_EntityId, oForm.Title, oParentNodeGuid, oForm.Id, oCreateRecord)
|
||
|
||
If oSuccess = True Then
|
||
Dim oMessage As String = "Der Knoten wurde erfolgreich angelegt! Wollen Sie die Sicht jetzt neu laden? Abhängig von der Anzahl der Knoten kann dies einige Sekunden dauern."
|
||
|
||
If MsgBox(oMessage, MsgBoxStyle.Question Or MsgBoxStyle.YesNo, Text) = MsgBoxResult.Yes Then
|
||
Await ReloadTreeView()
|
||
|
||
Dim oNode = TreeListDevexpress.FindNodeByFieldValue("GUID", oParentNodeGuid)
|
||
Dim oNodeIndex = TreeListDevexpress.MakeNodeVisible(oNode)
|
||
TreeListDevexpress.SetFocusedNode(oNode)
|
||
If oIsExpanded Then
|
||
oNode.Expand()
|
||
End If
|
||
End If
|
||
Else
|
||
MsgBox("Fehler beim Anlegen des neuen Knotens!", MsgBoxStyle.Critical, Text)
|
||
End If
|
||
|
||
|
||
End Sub
|
||
|
||
Private Sub DokumentartÄndernToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DokumentartÄndernToolStripMenuItem.Click
|
||
|
||
Try
|
||
Dim oSelectedDocs = ClassDocGrid.GetSelectedDocuments(GridViewDoc_Search)
|
||
|
||
If oSelectedDocs.Count = 0 Then
|
||
Exit Sub
|
||
End If
|
||
|
||
Dim oTable = MYDB_ECM.GetDatatable($"SELECT DOKUMENTTYPE_ID AS ID, DOKUMENTTYPE AS NAME FROM VWPMO_DOKUMENTTYPES WHERE FORM_ID = {CURRENT_ENTITY_ID} ORDER BY DOKUMENTTYPE")
|
||
Dim oDocTypes = oTable.Rows.Cast(Of DataRow).Select(AddressOf ToDocType).ToList()
|
||
Dim oFileNames = oSelectedDocs.Select(Function(d) d.Filename).ToList()
|
||
|
||
Dim oForm As New frmChangeDocType With {.DocTypes = oDocTypes, .FileNames = oFileNames}
|
||
'For Each oDoc As ClassWindreamDocGrid.WindreamDoc In oSelectedDocs
|
||
' oForm.FileNames = Nothing
|
||
' If oDoc.DocPath <> "" Then
|
||
' oForm.FileNames.Add(oDoc.DocPath)
|
||
' End If
|
||
'Next
|
||
If oForm.ShowDialog() = DialogResult.OK Then
|
||
If Not IsNothing(oForm.SelectedDocType) Then
|
||
For Each oDoc As ClassDocGrid.clsWMDoc In oSelectedDocs
|
||
If oDoc.DocPath <> "" Then
|
||
Dim oWMObject As WINDREAMLib.WMObject
|
||
Dim oReldocpath = ClassHelper.GetRelPath(oDoc.DocPath)
|
||
NNLogger.Info("oReldocpath: " & oReldocpath)
|
||
oWMObject = WMMOD.GetFileByPath(oReldocpath)
|
||
If Not IsNothing(oWMObject) Then
|
||
WMMOD.SetFileIndex(oReldocpath, WMINDEX_DOCTYPE, oForm.SelectedDocType.ToString, WMOBJECTTYPE)
|
||
Dim oupd = $"UPDATE TBPMO_DOCRESULT_LIST SET DOCTYPE = '{oForm.SelectedDocType.ToString}', CHANGED_WHO = '{USER_USERNAME}',Change_DateTime = GETDATE(),CHANGED_WHEN = GETDATE() WHERE DocID = {oDoc.DocId}"
|
||
MYDB_ECM.ExecuteNonQuery(oupd)
|
||
End If
|
||
|
||
|
||
End If
|
||
Next
|
||
RUN_DOCSEARCH(True)
|
||
|
||
|
||
End If
|
||
End If
|
||
Catch ex As Exception
|
||
NNLogger.Error(ex)
|
||
End Try
|
||
End Sub
|
||
|
||
Private Function ToDocType(pRow As DataRow) As frmChangeDocType.DocType
|
||
Return New frmChangeDocType.DocType() With {
|
||
.Id = pRow.ItemEx("ID", 0),
|
||
.Name = pRow.ItemEx("NAME", "")
|
||
}
|
||
End Function
|
||
|
||
Private Sub tsmiFileDelete_Click(sender As Object, e As EventArgs) Handles tsmiFileDelete.Click
|
||
If ClassDocGrid.HasNoSelectedDocuments(GridViewDoc_Search) Then
|
||
MsgBox("Could not read File Parameters (LinkRecord)!", MsgBoxStyle.Exclamation)
|
||
Exit Sub
|
||
End If
|
||
Refresh_Selected_Table()
|
||
|
||
Dim oDocuments = Current_DocList.SelectedDocuments
|
||
Dim oDocId As Integer = oDocuments.First.DocId
|
||
If oDocId = 0 Then
|
||
MsgBox("Sorry no document has been selected! Please try again!", MsgBoxStyle.Exclamation)
|
||
Exit Sub
|
||
End If
|
||
Dim msg = "Sind Sie sicher, dass Sie die Datei(en) endgültig löschen wollen?"
|
||
If USER_LANGUAGE <> "de-DE" Then
|
||
msg = "Are You sure You want to permanently delete this file(s)?"
|
||
End If
|
||
Dim result1 As MsgBoxResult
|
||
result1 = MessageBox.Show(msg, CAPTION_CONFIRMATION, MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||
If result1 = MsgBoxResult.Yes Then
|
||
For Each oDoc As ClassDocGrid.clsWMDoc In ClassDocGrid.GetSelectedDocuments(GridViewDoc_Search)
|
||
If oDoc.DocPath <> "" Then
|
||
Try
|
||
NNLogger.Info($"DocID {oDoc.DocPath} shall be deleted. User committed Delete-Start...")
|
||
Dim oDElWMFile As Boolean = False
|
||
Dim oCountLinks As Integer
|
||
If Not IsNothing(oDoc.DocId) Then
|
||
oCountLinks = MYDB_ECM.GetScalarValue("SELECT COUNT(GUID) FROM TBPMO_DOC_RECORD_LINK WHERE DOC_ID = " & oDoc.DocId)
|
||
If oCountLinks > 1 And CURRENT_SEARCH_TYPE = "RECORD" Then
|
||
msg = "Diese Datei ist noch mit anderen Datensätzen verknüpft! Wollen Sie diese Verknüpfungen ebenfalls löschen?"
|
||
If USER_LANGUAGE <> "de-DE" Then
|
||
msg = "This file is also linked to other records! Would You like to delete these links also?"
|
||
End If
|
||
Dim result2 As MsgBoxResult
|
||
result2 = MessageBox.Show(msg, CAPTION_CONFIRMATION, MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||
|
||
If result2 = MsgBoxResult.Yes Then
|
||
NNLogger.Info($">> File has other Record-Links. User committed to delete all!")
|
||
oDElWMFile = True
|
||
Else
|
||
oDElWMFile = False
|
||
NNLogger.Info($">> File has other Record-Links. links shall be kept!")
|
||
End If
|
||
Else
|
||
oDElWMFile = True
|
||
End If
|
||
If ClassFileResult.Delete_ResultFile(oDoc.DocId, CURRENT_RECORD_ID, oDElWMFile) = True Then
|
||
|
||
If oDElWMFile = True Then
|
||
If WMMOD.RemoveFile(oDoc.DocPath) Then
|
||
Update_Notification_Label(True, "File successfully deleted", "Yellow")
|
||
ClassHelper.InsertEssential_Log(oDoc.DocId, "DOC-ID", "FILE DELETED BY USER")
|
||
End If
|
||
|
||
Else
|
||
ClassHelper.InsertEssential_Log(oDoc.DocId, "DOC-ID", "FILE LINK DELETED BY USER")
|
||
Update_Notification_Label(True, "File-links successfully deleted", "Yellow")
|
||
End If
|
||
Else
|
||
Update_Notification_Label(True, "Error deleting file - Check log", "Red")
|
||
End If
|
||
|
||
End If
|
||
|
||
Catch ex As Exception
|
||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", "Error in delete file: ", ex.Message)
|
||
End Try
|
||
|
||
End If
|
||
Next
|
||
If CURRENT_SEARCH_TYPE = "ENTITY" Then
|
||
CURRENT_DT_DOC_ENTITY_SEARCH = Nothing
|
||
End If
|
||
RUN_DOCSEARCH(True)
|
||
End If
|
||
End Sub
|
||
|
||
Private Sub GridViewDoc_Search_DoubleClick(sender As Object, e As EventArgs) Handles GridViewDoc_Search.DoubleClick
|
||
|
||
End Sub
|
||
|
||
Private Sub TimerFileHandle_Tick(sender As Object, e As EventArgs) Handles TimerFileHandle.Tick
|
||
Try
|
||
Dim oSql = $"SELECT GUID FROM TBPMO_DOC_USER_REFRESH_VIEW WHERE USER_ID IN ({USER_GUID},0) AND REFRESHED_WHEN IS NULL"
|
||
Dim oDTGUID As DataTable = MYDB_ECM.GetDatatable(oSql)
|
||
If oDTGUID.Rows.Count >= 1 Then
|
||
Dim omsg = "Attention: The DocID of one document changed or a document has been versioned! The DocSearch has been refreshed!"
|
||
Update_Notification_Label(True, omsg, "Yellow")
|
||
For Each oROW As DataRow In oDTGUID.Rows
|
||
Dim oupd = $"UPDATE TBPMO_DOC_USER_REFRESH_VIEW Set REFRESHED_WHEN = GETDATE() WHERE GUID = {oROW.Item(0)}"
|
||
MYDB_ECM.ExecuteNonQuery(oupd)
|
||
Next
|
||
RUN_DOCSEARCH(True)
|
||
End If
|
||
|
||
|
||
Catch ex As Exception
|
||
NNLogger.Warn($"Unexpected Error In TimerFileHandleTick [{ex.Message}]!!")
|
||
End Try
|
||
End Sub
|
||
Private Function GetActiveGridControl() As GridControl
|
||
If _ActiveGrid Is Nothing Then
|
||
Return Nothing
|
||
End If
|
||
|
||
Return _ActiveGrid
|
||
End Function
|
||
Private Sub GridControlWK1_Enter(sender As Object, e As EventArgs) Handles GridControlDocSearch.Enter
|
||
_ActiveGrid = sender
|
||
End Sub
|
||
Private Sub bbtnitmDocResultExport_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtnitmDocResultExport.ItemClick
|
||
'Dim oActiveGrid = GetActiveGridControl()
|
||
'If oActiveGrid IsNot Nothing Then
|
||
' XtraSaveFileDialog1.FileName = DT_CONSTRUCT_VIEW.Rows(0).Item("FORM_TITLE")
|
||
' XtraSaveFileDialog1.DefaultExt = ".xlsx"
|
||
|
||
' If XtraSaveFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
|
||
' Dim oOptions As New XlsxExportOptions() With {
|
||
' .ExportMode = XlsxExportMode.SingleFile
|
||
' }
|
||
' oActiveGrid.ExportToXlsx(XtraSaveFileDialog1.FileName, oOptions)
|
||
' End If
|
||
'Else
|
||
' MessageBox.Show("Please Select a grid/table that you would Like To export.", Text, MessageBoxButtons.OK)
|
||
'End If
|
||
Dim saveFileDialogDocSearchResult As New SaveFileDialog With {
|
||
.Filter = "Excel File|*.xlsx",
|
||
.Title = "Export to Excel:"
|
||
}
|
||
saveFileDialogDocSearchResult.ShowDialog()
|
||
|
||
If saveFileDialogDocSearchResult.FileName <> "" Then
|
||
Dim oOptions As New XlsxExportOptionsEx With {
|
||
.ShowGridLines = True,
|
||
.AllowSortingAndFiltering = DevExpress.Utils.DefaultBoolean.True,
|
||
.ExportType = DevExpress.Export.ExportType.DataAware,
|
||
.ExportMode = XlsxExportMode.SingleFile,
|
||
.AllowFixedColumnHeaderPanel = DevExpress.Utils.DefaultBoolean.True
|
||
}
|
||
|
||
Cursor = Cursors.WaitCursor
|
||
GridViewDoc_Search.ExportToXlsx(saveFileDialogDocSearchResult.FileName, oOptions)
|
||
Dim result As MsgBoxResult
|
||
Dim msg = String.Format("Datei wurde erstellt! Wollen Sie diese nun öffnen?")
|
||
|
||
If USER_LANGUAGE <> "de-DE" Then
|
||
msg = String.Format("File was created. Do You want to open excel?")
|
||
End If
|
||
result = MessageBox.Show(msg, "Exporting result:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||
If result = MsgBoxResult.Yes Then
|
||
Process.Start(saveFileDialogDocSearchResult.FileName)
|
||
End If
|
||
End If
|
||
End Sub
|
||
|
||
Private Async Sub KnotenLöschenadminToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles KnotenLöschenadminToolStripMenuItem.Click
|
||
If CURRENT_NODEID <> 0 And Not IsNothing(MyFocusedNode) Then
|
||
Dim result As DialogResult = MessageBox.Show("Wollen Sie fortfahren? Der Knoten wird In Folge mit den Unterknoten als gelöscht markiert!", "Bestätigung erforderlich", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||
If result = System.Windows.Forms.DialogResult.Yes Then
|
||
Dim oSQL = $"EXEC [dbo].[PRPMO_DELETE_NODE] {CURRENT_NODEID}, '{USER_USERNAME}', 1, 0"
|
||
If MYDB_ECM.ExecuteNonQuery(oSQL) = True Then
|
||
TreeListDevexpress.DeleteNode(MyFocusedNode)
|
||
MsgBox("Knoten wurde erfolgreich gelöscht!", MsgBoxStyle.Information, "Erfolgsmeldung")
|
||
' result = MessageBox.Show("Wollen Sie die Ansicht aktualisieren?", "Knoten wurde erfolgreich gelöscht!", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||
' If result = System.Windows.Forms.DialogResult.Yes Then
|
||
'Await ReloadTreeView()
|
||
'End If
|
||
|
||
End If
|
||
End If
|
||
End If
|
||
|
||
End Sub
|
||
|
||
Private Sub KnotenVerschiebenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles KnotenVerschiebenToolStripMenuItem.Click
|
||
If CURRENT_NODEID <> 0 Then
|
||
Dim result As DialogResult = MessageBox.Show("Wollen Sie diesen Knoten verschieben?", "Bestätigung erforderlich", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||
If result = System.Windows.Forms.DialogResult.Yes Then
|
||
MessageBox.Show("Dann wählen Sie nun bitte den Knoten aus, welcher als Parent für den zu verschiebenden Knoten agieren soll!", "Bestätigung erforderlich", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation)
|
||
ParentNodeChangeinAction = True
|
||
ChildNodeGuid = CURRENT_NODEID
|
||
End If
|
||
End If
|
||
End Sub
|
||
|
||
Private Sub frmNodeNavigation_DragDrop(sender As Object, e As DragEventArgs) Handles Me.DragDrop
|
||
|
||
End Sub
|
||
|
||
Private Async Sub tsmiFileInWorkMultiple_Free_Click(sender As Object, e As EventArgs) Handles tsmiFileInWorkMultiple_Free.Click
|
||
|
||
For Each oDoc As ClassDocGrid.clsWMDoc In mySelectedDocs
|
||
If oDoc.InWork = True Then
|
||
If oDoc.InWorkUser = USER_USERNAME.ToUpper Or USER_IS_ADMIN Or USER_IS_SUPERVISOR Then
|
||
ClassFileResult.DocID = oDoc.DocId
|
||
ClassFileResult.Set_InWork(0, "")
|
||
End If
|
||
End If
|
||
Next
|
||
Await RUN_DOCSEARCH(True)
|
||
End Sub
|
||
|
||
Private Async Sub tsmiFileInWorkMultiple_Lock_Click(sender As Object, e As EventArgs) Handles tsmiFileInWorkMultiple_Lock.Click
|
||
frmFileInWork.myDocuments = mySelectedDocs
|
||
frmFileInWork.ShowDialog()
|
||
Await RUN_DOCSEARCH(True)
|
||
End Sub
|
||
|
||
Private Sub frmNodeNavigation_Activated(sender As Object, e As EventArgs) Handles Me.Activated
|
||
If CURRENT_ENTITY_ID <> CurrentEntityId Then
|
||
CURRENT_ENTITY_ID = CurrentEntityId
|
||
CURRENT_RECORD_ID = 0
|
||
End If
|
||
End Sub
|
||
|
||
Public ReadOnly Property CurrentEntityId As Short
|
||
Get
|
||
Return _EntityId
|
||
End Get
|
||
End Property
|
||
|
||
Private Sub TsmitmJumpToFilestore_Click(sender As Object, e As EventArgs) Handles TsmitmJumpToFilestore.Click
|
||
Try
|
||
If mySelectedDocs.Count = 1 Then
|
||
Dim oDocId As Integer = mySelectedDocs.First.DocId
|
||
Dim oJumpToDocSQL = String.Format("DECLARE @PID BIGINT
|
||
SELECT @PID = dwParentID FROM TBPMO_DOCRESULT_LIST WHERE DocID = {0}
|
||
SELECT GUID FROM VWPMO_STRUCTURE_NODES WHERE ENTITY_ID = {1} AND ISNUMERIC(ID1) = 1 AND ID1 = @PID", oDocId, OF_FILESTORE_ENTITY)
|
||
Dim ojumpID As Integer = MYDB_ECM.GetScalarValue(oJumpToDocSQL)
|
||
If Not IsNothing(ojumpID) AndAlso ojumpID <> 0 Then
|
||
OpenFormConstructor(OF_FILESTORE_CONSTRUCTOR, 1, OF_FILESTORE_ENTITY, ojumpID)
|
||
|
||
Else
|
||
MessageBox.Show("A parent node could not be found!", "No Node found", MessageBoxButtons.OK, MessageBoxIcon.Warning)
|
||
End If
|
||
End If
|
||
Catch ex As Exception
|
||
MessageBox.Show("Unerwarteter Fehler beim Springen zum Filestore-Knoten: " & ex.Message, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
End Try
|
||
End Sub
|
||
|
||
Private Sub FindNode_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles FindNode.ItemClick
|
||
Dim oNode = TreeListDevexpress.FindNodeByFieldValue("GUID", BarEditItem1.EditValue)
|
||
If Not IsNothing(oNode) Then
|
||
TreeListDevexpress.FocusedNode = oNode
|
||
TreeListDevexpress.MakeNodeVisible(oNode)
|
||
Else
|
||
MessageBox.Show("Knoten nicht gefunden!", "Knoten nicht gefunden", MessageBoxButtons.OK, MessageBoxIcon.Warning)
|
||
End If
|
||
End Sub
|
||
End Class |