Multiselect
This commit is contained in:
@@ -3,16 +3,29 @@ Imports DD_LIB_Standards
|
||||
Imports DevExpress.XtraPrinting
|
||||
|
||||
Public Class frmDoc_Links
|
||||
Public Property Documents As New List(Of ClassWindreamDocGrid.WindreamDoc)
|
||||
|
||||
Private Sub frmDoc_DocLinks_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
Try
|
||||
Refresh_Grid_Data(Documents)
|
||||
|
||||
Refresh_Grid_Data()
|
||||
If ClassWindreamDocGrid.DT_RESULTFILES.Rows.Count = 1 Then
|
||||
Me.Text = $"Document-Links for file: {ClassWindreamDocGrid.DT_RESULTFILES.Rows(0).Item("DOC_PATH")}"
|
||||
' TODO: this does not work for the old form
|
||||
If Documents.Count = 0 Then
|
||||
Text = $"Document-Links for: NODOC-ID"
|
||||
ElseIf Documents.Count = 1 Then
|
||||
Text = $"Document-Links for: {Documents.First.DocPath}"
|
||||
Else
|
||||
Me.Text = $"Document-Links for file: NODOC-ID"
|
||||
Text = $"Document-Links for {Documents.Count} files"
|
||||
End If
|
||||
|
||||
'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
|
||||
|
||||
bbtnitmdeletelink.Enabled = False
|
||||
|
||||
Select Case CURRENT_FILE_RIGHT
|
||||
Case "RW"
|
||||
bbtnitmdeletelink.Enabled = True
|
||||
@@ -23,22 +36,44 @@ Public Class frmDoc_Links
|
||||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error in frmDoc_DocLinks_Load", ex.Message, ex.StackTrace)
|
||||
End Try
|
||||
End Sub
|
||||
Sub Refresh_Grid_Data()
|
||||
|
||||
Private Function Get_Grid_Data(pDocuments As List(Of ClassWindreamDocGrid.WindreamDoc)) As DataTable
|
||||
Dim oTable As DataTable
|
||||
Dim oSql As String = ""
|
||||
|
||||
If pDocuments.Count > 0 Then
|
||||
Dim oIds = String.Join(",", pDocuments.Select(Function(d) d.DocId).ToArray())
|
||||
oSql = $"SELECT * FROM VWPMO_CUST_DOC_OBJECT_LINKS WHERE DocID IN ({oIds})"
|
||||
oTable = MYDB_ECM.GetDatatable(oSql)
|
||||
Else
|
||||
oSql = $"select * FROM VWPMO_CUST_DOC_OBJECT_LINKS WHERE DocID = {CURRENT_DOC_ID}"
|
||||
oTable = MYDB_ECM.GetDatatable(oSql)
|
||||
End If
|
||||
|
||||
If oTable Is Nothing Then
|
||||
LOGGER.Error("Please check your link-object-relation: {0}", oSql)
|
||||
End If
|
||||
|
||||
Return oTable
|
||||
End Function
|
||||
|
||||
Sub Refresh_Grid_Data(pDocuments As List(Of ClassWindreamDocGrid.WindreamDoc))
|
||||
Try
|
||||
Dim DT_RECORDS As DataTable
|
||||
Dim oSql = $"select * FROM VWPMO_CUST_DOC_OBJECT_LINKS WHERE DocID = {CURRENT_DOC_ID}"
|
||||
DT_RECORDS = MYDB_ECM.GetDatatable(oSql)
|
||||
If Not IsNothing(DT_RECORDS) Then
|
||||
BarStaticItemStatus.Caption = $"{DT_RECORDS.Rows.Count} links for Document found!"
|
||||
Dim oTable = Get_Grid_Data(pDocuments)
|
||||
|
||||
If Not IsNothing(oTable) Then
|
||||
BarStaticItemStatus.Caption = $"{oTable.Rows.Count} links for Document found!"
|
||||
grvwGrid.Columns.Clear()
|
||||
GridControlRecords.DataSource = DT_RECORDS
|
||||
GridControlRecords.DataSource = oTable
|
||||
'grvwGrid.Columns.Item("already linked").Fixed = True
|
||||
Try
|
||||
grvwGrid.Columns.Item("DocID").Visible = False
|
||||
grvwGrid.Columns.Item("RecordID").Visible = False
|
||||
'grvwGrid.Columns.Item("FULL_FILENAME").Visible = False
|
||||
Try
|
||||
grvwGrid.Columns.Item("VALUE").Visible = False
|
||||
If grvwGrid.Columns.Item("VALUE") IsNot Nothing Then
|
||||
grvwGrid.Columns.Item("VALUE").Visible = False
|
||||
End If
|
||||
Catch ex1 As Exception
|
||||
LOGGER.Warn("Column VALUE not part of VWPMO_CUST_DOC_OBJECT_LINKS" & ex1.Message)
|
||||
End Try
|
||||
@@ -49,16 +84,17 @@ Public Class frmDoc_Links
|
||||
End Try
|
||||
|
||||
GridControlRecords.RefreshDataSource()
|
||||
'If DT_RECORDS.Rows.Count > 10000 Then
|
||||
'If oTable.Rows.Count > 10000 Then
|
||||
' BarButtonItem2.Enabled = False
|
||||
'Else
|
||||
' BarButtonItem2.Enabled = True
|
||||
'End If
|
||||
Else
|
||||
MsgBox($"Please check Your link-object-relation: {oSql}", MsgBoxStyle.Exclamation)
|
||||
MsgBox($"Please check Your link-object-relation", MsgBoxStyle.Exclamation)
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error in Sub Refresh_Grid_Data", ex.Message, ex.StackTrace)
|
||||
End Try
|
||||
|
||||
@@ -86,22 +122,25 @@ Public Class frmDoc_Links
|
||||
End Try
|
||||
Next
|
||||
|
||||
Refresh_Grid_Data()
|
||||
Refresh_Grid_Data(Documents)
|
||||
End Sub
|
||||
|
||||
Private Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick
|
||||
Try
|
||||
Dim saveFileDialogDocSearchResult As New SaveFileDialog
|
||||
saveFileDialogDocSearchResult.Filter = "Excel File|*.xlsx"
|
||||
saveFileDialogDocSearchResult.Title = "Export to Excel:"
|
||||
Dim saveFileDialogDocSearchResult As New SaveFileDialog With {
|
||||
.Filter = "Excel File|*.xlsx",
|
||||
.Title = "Export to Excel:"
|
||||
}
|
||||
saveFileDialogDocSearchResult.ShowDialog()
|
||||
|
||||
If saveFileDialogDocSearchResult.FileName <> "" Then
|
||||
Dim oOptions As XlsxExportOptionsEx = New XlsxExportOptionsEx
|
||||
oOptions.ShowGridLines = True
|
||||
oOptions.AllowSortingAndFiltering = DevExpress.Utils.DefaultBoolean.True
|
||||
oOptions.ExportType = DevExpress.Export.ExportType.DataAware
|
||||
oOptions.ExportMode = XlsxExportMode.SingleFile
|
||||
oOptions.AllowFixedColumnHeaderPanel = DevExpress.Utils.DefaultBoolean.True
|
||||
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
|
||||
GridControlRecords.MainView.ExportToXlsx(saveFileDialogDocSearchResult.FileName, oOptions)
|
||||
@@ -118,21 +157,18 @@ Public Class frmDoc_Links
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
MsgBox("Unexpected Error in ExportExcel: " & ex.Message, MsgBoxStyle.Critical)
|
||||
End Try
|
||||
Cursor = Cursors.Default
|
||||
End Sub
|
||||
|
||||
Private Sub frmDoc_Links_MaximizedBoundsChanged(sender As Object, e As EventArgs) Handles MyBase.MaximizedBoundsChanged
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub frmDoc_Links_SizeChanged(sender As Object, e As EventArgs) Handles Me.SizeChanged
|
||||
Try
|
||||
grvwGrid.OptionsView.ColumnAutoWidth = False
|
||||
grvwGrid.BestFitColumns()
|
||||
Catch ex As Exception
|
||||
|
||||
LOGGER.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
Reference in New Issue
Block a user