Close DocView after changing records

This commit is contained in:
Jonathan Jenne
2023-09-20 14:29:16 +02:00
parent 9047cec61f
commit 16b2026a24

View File

@@ -16,6 +16,7 @@ Imports DD_LIB_Standards
Imports DigitalData.Modules.Base
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Database
Imports System.Configuration
Public Class frmNodeNavigation
#Region "Laufzeitvariablen & Konstanten"
@@ -300,7 +301,7 @@ Public Class frmNodeNavigation
Private Sub TreeListDevexpress_FocusedNodeChanged(sender As Object, e As FocusedNodeChangedEventArgs) Handles TreeListDevexpress.FocusedNodeChanged
Private Async Sub TreeListDevexpress_FocusedNodeChanged(sender As Object, e As FocusedNodeChangedEventArgs) Handles TreeListDevexpress.FocusedNodeChanged
FocusedNode = Nothing
If oFilterActive Then
@@ -366,7 +367,7 @@ Public Class frmNodeNavigation
CtrlBuilder.WatchRecordChanges = False
ClassControlValues.LoadControlValuesListWithPlaceholders(oEntityID, CURRENT_RECORD_ID, 0, CtrlBuilder.AllControls, oEntityID)
CtrlBuilder.WatchRecordChanges = True
Show_Selected_Record_Data(CURRENT_RECORD_ID)
Await Show_Selected_Record_Data(CURRENT_RECORD_ID)
ClassRightManagement.Check_Set_Rights(CURRENT_RECORD_ID, oEntityID)
@@ -746,7 +747,7 @@ Public Class frmNodeNavigation
End Try
End Sub
Function Show_Selected_Record_Data(Rec_ID As Integer) As Threading.Tasks.Task
Private Async Function Show_Selected_Record_Data(Rec_ID As Integer) As Threading.Tasks.Task
Dim oHandle = SplashScreenManager.ShowOverlayForm(Me)
Try
@@ -778,7 +779,11 @@ Public Class frmNodeNavigation
'Refresh_Navpane()
Update_Record_Label(SELECTED_NODE_RECORD_ID)
RUN_WDSEARCH_GRID(True)
Dim oDocumentsFounnd = Await RUN_WDSEARCH_GRID(True)
If oDocumentsFounnd = 0 Then
DocumentViewer.CloseDocument()
End If
sw.Done()
@@ -977,7 +982,7 @@ Public Class frmNodeNavigation
LastFindFilterText = oFilterText
End Sub
Private Sub LoadRecord(pRecord As Integer)
Private Async Sub LoadRecord(pRecord As Integer)
Try
CURRENT_RECORD_ID = pRecord
CURRENT_SEARCH_TYPE = "RECORD"
@@ -994,7 +999,7 @@ Public Class frmNodeNavigation
ClassControlValues.LoadControlValuesListWithPlaceholders(CURRENT_ENTITY_ID, CURRENT_RECORD_ID, 0, CtrlBuilder.AllControls, oEntityID)
CtrlBuilder.WatchRecordChanges = True
If CURRENT_RECORD_ID > 0 Then
Show_Selected_Record_Data(CURRENT_RECORD_ID)
Await Show_Selected_Record_Data(CURRENT_RECORD_ID)
End If
@@ -1406,14 +1411,15 @@ Public Class frmNodeNavigation
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", "Error in Customer_Run_Procedures: ", ex.Message)
End Try
End Sub
Function RUN_WDSEARCH_GRID(osplashscreen As Boolean) As Threading.Tasks.Task
Private Async Function RUN_WDSEARCH_GRID(pShowSplashscreen As Boolean) As Task(Of Integer)
Dim oHandle As IOverlaySplashScreenHandle
If osplashscreen Then
If pShowSplashscreen Then
oHandle = SplashScreenManager.ShowOverlayForm(Me)
taskToken = New CancellationTokenSource()
End If
Dim sw As New SW("RUN_WDSEARCH_GRID")
Dim oFilesFound As Integer = 0
Try
bsitmtInfoDoc.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
@@ -1422,17 +1428,7 @@ Public Class frmNodeNavigation
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
Try
Dim async As New ClassAsyncSQL(sql)
async.bw.RunWorkerAsync()
While async.bw.IsBusy
Application.DoEvents()
End While
DT_ASYNC = async.dt
Catch ex As Exception
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error Async DT_ASYNC", ex.Message, ex.StackTrace)
End Try
Dim DT_ASYNC As DataTable = Await MYDB_ECM.GetDatatableAsync(sql)
If Not IsNothing(DT_ASYNC) Then
Dim result = DT_ASYNC.Rows(0).Item(0)
@@ -1448,6 +1444,7 @@ Public Class frmNodeNavigation
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
@@ -1511,6 +1508,8 @@ Public Class frmNodeNavigation
End If
'BbtnitmDocSearch.Enabled = TruefRe
oFilesFound = DT_RESULT.Rows.Count
Else
Dim msg = "Keine Dateien für '"
@@ -1548,6 +1547,8 @@ Public Class frmNodeNavigation
GridViewDoc_Search.ViewCaption = msg
GridControlDocSearch.DataSource = Nothing
'Clear_Windream_ResultList()
oFilesFound = 0
End If
End If
@@ -1557,13 +1558,13 @@ Public Class frmNodeNavigation
Finally
sw.Done()
bsitmtInfoDoc.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
If osplashscreen Then
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")
@@ -1828,7 +1829,7 @@ Public Class frmNodeNavigation
Function GetSafeFilename(filename As String)
Return String.Join("_", filename.Split(Path.GetInvalidFileNameChars()))
End Function
Sub Reset_View_layout()
Private Async Function Reset_View_layout() As Task
Try
Dim XMLPath = Get_DocGrid_Layout_Filename()
If File.Exists(XMLPath) Then
@@ -1837,7 +1838,7 @@ Public Class frmNodeNavigation
GridControlDocSearch.DataSource = Nothing
GridViewDoc_Search.Columns.Clear()
RUN_WDSEARCH_GRID(True)
Await RUN_WDSEARCH_GRID(True)
Else
MsgBox("Resetting the layout was not successful - File not existing!", MsgBoxStyle.Information)
@@ -1846,10 +1847,10 @@ Public Class frmNodeNavigation
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", "Error in Resetting Layout DocGrid: ", ex.Message)
End Try
Me.Cursor = Cursors.Default
End Sub
End Function
Private Sub bbtnitmDocResultLayoutReset_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtnitmDocResultLayoutReset.ItemClick
Reset_View_layout()
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
@@ -1867,36 +1868,36 @@ Public Class frmNodeNavigation
Update_Status_Label(True, "No entity selected", EditState.Insert)
End If
End Sub
Sub Drag_Drop(e As DragEventArgs)
Private Async Function Drag_Drop(e As DragEventArgs) As Task
Try
If ClassDragDrop.Drop_File(e) = False Then
Exit Sub
Exit Function
End If
If USER_PERSONIFIED_TEST = True Then
ClassHelper.MSGBOX_Handler("INFO", "Attention", "You are using ADDI in personified mode! Adding files is not allowed!")
Exit Sub
Exit Function
End If
If clsWindream.Create_Session = False Then
ClassHelper.MSGBOX_Handler("INFO", "Attention", "Check Your windream-connection and restart ADDI afterwards.", "Could not create a windream session!")
Exit Sub
Exit Function
End If
If oEntityID <> 0 And (RIGHT_READ_ONLY_DOC = False And GridControlDocSearch.ContextMenuStrip.Name = "ContextMenuStripResultFiles") Or RIGHT_ADD_DOC = True Then
Dim sql = "select count(*) from VWPMO_DOKUMENTTYPES where FORMVIEW_ID = " & FORMVIEW_ID
Dim count_DT = 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 Sub
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 Sub
Exit Function
End If
End If
If RECORD_CHANGED = True Then
If Save_Record() = False Then
Exit Sub
Exit Function
End If
End If
CURRENT_CONTROL_DOCTYPE_MATCH = 0
@@ -1948,7 +1949,7 @@ Public Class frmNodeNavigation
'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
RUN_WDSEARCH_GRID(True)
Await RUN_WDSEARCH_GRID(True)
ClassHelper.GetDocrecordLinks(CURRENT_RECORD_ID)
TimerClearResultfiles.Start()
Else
@@ -1972,7 +1973,7 @@ Public Class frmNodeNavigation
Finally
End Try
End Sub
End Function
Private DROPPED_CHECKED As Boolean = False
Sub Check_Dropped_Files()
Try
@@ -2046,16 +2047,16 @@ Public Class frmNodeNavigation
End Try
End Sub
Private Sub GridControlDocSearch_DragDrop(sender As Object, e As DragEventArgs) Handles GridControlDocSearch.DragDrop
Drag_Drop(e)
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 Sub pnlControls_DragDrop(sender As Object, e As DragEventArgs) Handles pnlControls.DragDrop
Drag_Drop(e)
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
@@ -2065,8 +2066,8 @@ Public Class frmNodeNavigation
Drag_Enter(e)
End Sub
Private Sub SplitContainer1_DragDrop(sender As Object, e As DragEventArgs) Handles SplitContainer1.DragDrop
Drag_Drop(e)
Private Async Sub SplitContainer1_DragDrop(sender As Object, e As DragEventArgs) Handles SplitContainer1.DragDrop
Await Drag_Drop(e)
End Sub
#End Region
@@ -2406,7 +2407,7 @@ Public Class frmNodeNavigation
End Try
End Sub
Private Sub tsmiFileInWork_Click(sender As Object, e As EventArgs) Handles tsmiFileInWork.Click
Private Async Sub tsmiFileInWork_Click(sender As Object, e As EventArgs) Handles tsmiFileInWork.Click
If ClassWindreamDocGrid.HasNoSelectedDocuments(GridViewDoc_Search) Then
MsgBox("Could not read File Parameters (3)!", MsgBoxStyle.Exclamation)
Exit Sub
@@ -2417,7 +2418,7 @@ Public Class frmNodeNavigation
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
RUN_WDSEARCH_GRID(True)
Await RUN_WDSEARCH_GRID(True)
End If
Else
msglbl = "In Bearbeitung durch User '" & IW_USER & "' - Kommentar:"
@@ -2430,7 +2431,7 @@ Public Class frmNodeNavigation
Else
frmFileInWork.ShowDialog()
ClassWindreamDocGrid.SELECTED_INWORK = ClassFileResult.InWork
RUN_WDSEARCH_GRID(True)
Await RUN_WDSEARCH_GRID(True)
End If
End Sub
@@ -2442,7 +2443,7 @@ Public Class frmNodeNavigation
FORM_SHOWN = True
End Sub
Private Sub tsmiFileRenameDisplayname_Click(sender As Object, e As EventArgs) Handles tsmiFileRenameDisplayname.Click
Private Async Sub tsmiFileRenameDisplayname_Click(sender As Object, e As EventArgs) Handles tsmiFileRenameDisplayname.Click
Try
If ClassWindreamDocGrid.HasNoSelectedDocuments(GridViewDoc_Search) Then
Exit Sub
@@ -2465,7 +2466,7 @@ Public Class frmNodeNavigation
Dim oRowHandle As Integer = GridViewDoc_Search.FocusedRowHandle
Dim frm As New frmFileRename(1, oDocuments.First.DisplayName, "Displayname")
frm.ShowDialog()
RUN_WDSEARCH_GRID(True)
Await RUN_WDSEARCH_GRID(True)
If Not IsNothing(oRowHandle) Then
GridViewDoc_Search.FocusedRowHandle = oRowHandle
End If
@@ -2475,7 +2476,7 @@ Public Class frmNodeNavigation
End Try
End Sub
Private Sub tsmiFileRenameFilename_Click(sender As Object, e As EventArgs) Handles tsmiFileRenameFilename.Click
Private Async Sub tsmiFileRenameFilename_Click(sender As Object, e As EventArgs) Handles tsmiFileRenameFilename.Click
Try
Dim RENAME_DOC_PATH
Try
@@ -2498,7 +2499,7 @@ Public Class frmNodeNavigation
Dim oRowHandle As Integer = GridViewDoc_Search.FocusedRowHandle
Dim frm As New frmFileRename(1, FileToRename, "Filename")
frm.ShowDialog()
RUN_WDSEARCH_GRID(True)
Await RUN_WDSEARCH_GRID(True)
If Not IsNothing(oRowHandle) Then
GridViewDoc_Search.FocusedRowHandle = oRowHandle
End If
@@ -2605,7 +2606,7 @@ Public Class frmNodeNavigation
End Try
End Sub
Private Sub tsmiFileLinkRemove_Click(sender As Object, e As EventArgs) Handles tsmiFileLinkRemove.Click
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
@@ -2626,7 +2627,7 @@ Public Class frmNodeNavigation
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
RUN_WDSEARCH_GRID(True)
Await RUN_WDSEARCH_GRID(True)
End If
@@ -2638,10 +2639,10 @@ Public Class frmNodeNavigation
End If
End Sub
Private Sub tsmiFileVersion_Click(sender As Object, e As EventArgs) Handles tsmiFileVersion.Click
Private Async Sub tsmiFileVersion_Click(sender As Object, e As EventArgs) Handles tsmiFileVersion.Click
Refresh_Selected_Table()
frmWM_CreateVersion.ShowDialog()
RUN_WDSEARCH_GRID(True)
Await RUN_WDSEARCH_GRID(True)
End Sub
Private Sub tsmiFileRightsShow_Click(sender As Object, e As EventArgs) Handles tsmiFileRightsShow.Click
@@ -2688,8 +2689,8 @@ Public Class frmNodeNavigation
Show_File_Properties()
End Sub
Private Sub bbtnitmDocResultRefresh_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtnitmDocResultRefresh.ItemClick
RUN_WDSEARCH_GRID(True)
Private Async Sub bbtnitmDocResultRefresh_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtnitmDocResultRefresh.ItemClick
Await RUN_WDSEARCH_GRID(True)
End Sub
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick