60 lines
2.7 KiB
VB.net
60 lines
2.7 KiB
VB.net
Imports DD_LIB_Standards
|
|
Public Class frmDoc_Links
|
|
Private Sub frmDoc_DocLinks_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
Try
|
|
If ClassWindreamDocGrid.DT_RESULTFILES.Rows.Count = 1 Then
|
|
Me.Text = $"Document-Links for file: {ClassWindreamDocGrid.DT_RESULTFILES.Rows(0).Item("DOC_PATH")}"
|
|
Else
|
|
Me.Text = $"Document-Links for file: NODOC-ID"
|
|
End If
|
|
Refresh_Grid_Data()
|
|
Catch ex As Exception
|
|
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error in frmDoc_DocLinks_Load", ex.Message, ex.StackTrace)
|
|
End Try
|
|
End Sub
|
|
Sub Refresh_Grid_Data()
|
|
Try
|
|
Dim DT_RECORDS As DataTable
|
|
Dim oSql = $"select * FROM VWPMO_CUST_DOC_OBJECT_LINKS WHERE DOC_ID = {ClassWindreamDocGrid.DT_RESULTFILES.Rows(0).Item("DOC_ID")}"
|
|
DT_RECORDS = clsDatabase.Return_Datatable(oSql)
|
|
|
|
tslbl.Text = $"{DT_RECORDS.Rows.Count} links for Document found!"
|
|
grvwGrid.Columns.Clear()
|
|
dgRecords.DataSource = DT_RECORDS
|
|
'grvwGrid.Columns.Item("already linked").Fixed = True
|
|
Try
|
|
grvwGrid.Columns.Item("DOC_ID").Visible = False
|
|
grvwGrid.Columns.Item("RECORD_ID").Visible = False
|
|
grvwGrid.Columns.Item("VALUE").Visible = False
|
|
Catch ex As Exception
|
|
|
|
End Try
|
|
|
|
dgRecords.RefreshDataSource()
|
|
Catch ex As Exception
|
|
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error in Sub Refresh_Grid_Data", ex.Message, ex.StackTrace)
|
|
End Try
|
|
|
|
End Sub
|
|
|
|
Private Sub ToolStripButtonDelete_Click(sender As Object, e As EventArgs) Handles ToolStripButtonDelete.Click
|
|
Dim selectedRows As Integer() = grvwGrid.GetSelectedRows()
|
|
Dim i As Integer = 0
|
|
For Each rowhandle As Integer In selectedRows
|
|
Dim oDocID = grvwGrid.GetRowCellValue(rowhandle, "DOC_ID")
|
|
Dim oRECORD_ID = grvwGrid.GetRowCellValue(rowhandle, "RECORD_ID")
|
|
If IsNothing(oDocID) Then
|
|
Continue For
|
|
End If
|
|
If LogErrorsOnly = False Then ClassLogger.Add($">> RecordLink will be removed Record: {oRECORD_ID} - DocID: {oDocID} ", False)
|
|
Try
|
|
If ClassFileResult.Delete_ResultFile(oDocID, oRECORD_ID, 0) = True Then
|
|
ClassHelper.InsertEssential_Log(oDocID, "DOC-ID", $"RECORD LINK {oRECORD_ID} 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
|
|
Next
|
|
Refresh_Grid_Data()
|
|
End Sub
|
|
End Class |