This commit is contained in:
2023-11-16 17:44:00 +01:00
parent 4c502369bd
commit df489932df
5 changed files with 69 additions and 47 deletions

View File

@@ -1,6 +1,7 @@
Imports System.IO
Imports DD_LIB_Standards
Imports DevExpress.XtraPrinting
Imports Microsoft.Office.Interop.Outlook
Public Class frmDoc_Links
Public Property Documents As New List(Of ClassWindreamDocGrid.WindreamDoc)
@@ -38,7 +39,7 @@ Public Class frmDoc_Links
Case "RWA"
bbtnitmdeletelink.Enabled = True
End Select
Catch ex As Exception
Catch ex As System.Exception
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error in frmDoc_DocLinks_Load", ex.Message, ex.StackTrace)
End Try
End Sub
@@ -80,12 +81,12 @@ Public Class frmDoc_Links
If grvwGrid.Columns.Item("VALUE") IsNot Nothing Then
grvwGrid.Columns.Item("VALUE").Visible = False
End If
Catch ex1 As Exception
Catch ex1 As System.Exception
LOGGER.Warn("Column VALUE not part of VWPMO_CUST_DOC_OBJECT_LINKS" & ex1.Message)
End Try
grvwGrid.OptionsView.ColumnAutoWidth = False
grvwGrid.BestFitColumns()
Catch ex As Exception
Catch ex As System.Exception
LOGGER.Error(ex)
End Try
@@ -99,7 +100,7 @@ Public Class frmDoc_Links
MsgBox($"Please check Your link-object-relation", MsgBoxStyle.Exclamation)
End If
Catch ex As Exception
Catch ex As System.Exception
LOGGER.Error(ex)
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error in Sub Refresh_Grid_Data", ex.Message, ex.StackTrace)
End Try
@@ -108,27 +109,44 @@ Public Class frmDoc_Links
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtnitmdeletelink.ItemClick
Dim oSelectedRows As Integer() = grvwGrid.GetSelectedRows()
For Each rowhandle As Integer In oSelectedRows
Try
Dim oSelectedDocID = grvwGrid.GetRowCellValue(rowhandle, "DocID")
Dim oSelectedRecordID = grvwGrid.GetRowCellValue(rowhandle, "RecordID")
If IsNothing(oSelectedDocID) Then
Continue For
End If
LOGGER.Debug($"RecordLink will be removed Record: {oSelectedRecordID} - DocID: {oSelectedDocID} ")
Try
If ClassFileResult.Delete_ResultFile(oSelectedDocID, oSelectedRecordID, 0) = True Then
ClassHelper.InsertEssential_Log(oSelectedDocID, "DOC-ID", $"RECORD LINK {oSelectedRecordID} REMOVED FROM DOC-SEARCH")
End If
Catch ex As Exception
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error in Removing DocRecord-Link", ex.Message, ex.StackTrace)
End Try
Catch ex As Exception
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error in Collecting DocRecord-Link", ex.Message, ex.StackTrace)
End Try
Next
If oSelectedRows.Count > 0 Then
Dim result As MsgBoxResult
Dim msg = String.Format("Wollen Sie die ausgewählten Links wirklich löschen?")
Dim oCount As Integer = 0
If USER_LANGUAGE <> "de-DE" Then
msg = String.Format("Do you really want to delete the selected links?")
End If
result = MessageBox.Show(msg, "Bestätigung/Commitment:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = MsgBoxResult.Yes Then
For Each rowhandle As Integer In oSelectedRows
Try
Dim oSelectedDocID = grvwGrid.GetRowCellValue(rowhandle, "DocID")
Dim oSelectedRecordID = grvwGrid.GetRowCellValue(rowhandle, "RecordID")
If IsNothing(oSelectedDocID) Then
Continue For
End If
LOGGER.Debug($"RecordLink will be removed - Record: {oSelectedRecordID} - DocID: {oSelectedDocID} ")
Try
Dim oDEL = $"DELETE FROM TBPMO_DOC_RECORD_LINK WHERE Doc_ID = {oSelectedDocID} AND RECORD_ID = {oSelectedRecordID}"
If MYDB_ECM.ExecuteNonQuery(oDEL) = True Then
oCount += 1
ClassHelper.InsertEssential_Log(oSelectedDocID, "DOC-ID", $"RECORD LINK {oSelectedRecordID} REMOVED FROM DOC-SEARCH")
End If
Catch ex As System.Exception
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error in Removing DocRecord-Link", ex.Message, ex.StackTrace)
End Try
Catch ex As System.Exception
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error in Collecting DocRecord-Link", ex.Message, ex.StackTrace)
End Try
Next
MsgBox($"Es wurden {oCount} Links erfolreich gelöscht!", MsgBoxStyle.Information)
End If
Refresh_Grid_Data(Documents)
Else
MsgBox("No links selected!", MsgBoxStyle.Information)
End If
Refresh_Grid_Data(Documents)
End Sub
Private Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick
@@ -162,7 +180,7 @@ Public Class frmDoc_Links
End If
End If
Catch ex As Exception
Catch ex As System.Exception
LOGGER.Error(ex)
MsgBox("Unexpected Error in ExportExcel: " & ex.Message, MsgBoxStyle.Critical)
End Try
@@ -173,7 +191,7 @@ Public Class frmDoc_Links
Try
grvwGrid.OptionsView.ColumnAutoWidth = False
grvwGrid.BestFitColumns()
Catch ex As Exception
Catch ex As System.Exception
LOGGER.Error(ex)
End Try
End Sub