This commit is contained in:
2021-06-28 16:02:25 +02:00
parent e9fb65eddf
commit 3feb7ebf4d
10 changed files with 785 additions and 395 deletions

View File

@@ -30,6 +30,8 @@ Public Class frmDocSearchResult
Private Const SEE_MASK_FLAG_NO_UI = &H400
Public Const SW_SHOW As Short = 5
Private DT_RESULT As DataTable
Private SelectedDocID As Int64
Private SelectedFULL_FILEPATH As String
Public Sub LoadDocSearch(reload As Boolean)
Try
Cursor = Cursors.WaitCursor
@@ -43,7 +45,7 @@ Public Class frmDocSearchResult
GridViewDoc_Search.Columns.Clear()
GridControlDocSearch.DataSource = DT_RESULT
GridViewDoc_Search.BestFitColumns(True)
ToolStripLabelCaption.Text = $"{CURRENT_DOCSEARCH_CAPTION} ({DT_RESULT.Rows.Count} rows)"
bsiInfo.Caption = $"{CURRENT_DOCSEARCH_CAPTION} ({DT_RESULT.Rows.Count} rows)"
Load_DocGrid_Layout()
GridControlDocSearch.DataSource = DT_RESULT
GridControlDocSearch.DataSource = DT_RESULT
@@ -58,7 +60,6 @@ Public Class frmDocSearchResult
'Else
' ToolStripButton2.Enabled = True
'End If
ToolStripButton2.Enabled = True
Catch ex As Exception
LOGGER.Warn("Unexpected Error in LoadDocSearch: " & ex.Message)
End Try
@@ -67,7 +68,7 @@ Public Class frmDocSearchResult
End Sub
Private Sub GridViewDoc_Search_FocusedColumnChanged(sender As Object, e As DevExpress.XtraGrid.Views.Base.FocusedColumnChangedEventArgs) Handles GridViewDoc_Search.FocusedColumnChanged
If GridViewDoc_Search.RowCount > 0 Then
ClassWindreamDocGrid.GetDocItems(GridViewDoc_Search)
GetDocID()
Refresh_DocID()
End If
@@ -75,25 +76,39 @@ Public Class frmDocSearchResult
Private Sub GridViewDoc_Search_FocusedRowChanged(sender As Object, e As FocusedRowChangedEventArgs) Handles GridViewDoc_Search.FocusedRowChanged
If GridViewDoc_Search.RowCount > 0 Then
ClassWindreamDocGrid.GetDocItems(GridViewDoc_Search)
GetDocID()
Refresh_DocID()
End If
End Sub
Sub Refresh_DocID()
If ClassWindreamDocGrid.SELECTED_DOC_ID <> 0 Then
Dim msg = "Doc-ID: " & ClassWindreamDocGrid.SELECTED_DOC_ID.ToString
tslblDocID.Text = msg
If SelectedDocID <> 0 Then
Dim msg = "Doc-ID: " & SelectedDocID.ToString
bsiDocID.Caption = msg
Else
tslblDocID.Text = "DocRow not selected"
bsiDocID.Caption = "DocRow not selected"
End If
End Sub
Sub GetDocID()
Try
Dim oDocID = GridViewDoc_Search.GetRowCellValue(GridViewDoc_Search.FocusedRowHandle, "DocID")
SelectedFULL_FILEPATH = GridViewDoc_Search.GetRowCellValue(GridViewDoc_Search.FocusedRowHandle, "FULL_FILENAME")
If Not IsNothing(oDocID) Then
SelectedDocID = oDocID
SelectedFULL_FILEPATH = GridViewDoc_Search.GetRowCellValue(GridViewDoc_Search.FocusedRowHandle, "FULL_FILENAME")
End If
Catch ex As Exception
LOGGER.Error(ex)
End Try
End Sub
Sub Open_File()
Me.Cursor = Cursors.WaitCursor
Dim allow_Open As Boolean = False
ClassWindreamDocGrid.GetDocItems(GridViewDoc_Search)
Dim Result = ClassDOC_SEARCH.Get_File_Rights(ClassWindreamDocGrid.SELECTED_DOC_ID)
GetDocID()
Dim Result = ClassDOC_SEARCH.Get_File_Rights(SelectedDocID)
If Not IsNothing(Result) Then
Select Case Result.ToString
Case "R"
@@ -106,14 +121,13 @@ Public Class frmDocSearchResult
End Select
End If
If allow_Open = True Then
If IsNothing(ClassWindreamDocGrid.DT_RESULTFILES) Then
If IsNothing(SelectedDocID) 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.File_open(row.Item("FULL_FILENAME"), row.Item("DocID"))
If CURRENT_OFFICE_FILE_CHANGED = True Then LoadDocSearch(True)
Next
ClassHelper.File_open(SelectedFULL_FILEPATH, SelectedDocID)
If CURRENT_OFFICE_FILE_CHANGED = True Then LoadDocSearch(True)
Else
ClassHelper.MSGBOX_Handler("ERROR", "", "File does not exist! Please contact your admin!")
End If
@@ -125,13 +139,13 @@ Public Class frmDocSearchResult
End Sub
Private Sub OrdnerÖffnenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles OrdnerÖffnenToolStripMenuItem.Click
If IsNothing(ClassWindreamDocGrid.DT_RESULTFILES) Then
If IsNothing(SelectedFULL_FILEPATH) 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("FULL_FILENAME"), row.Item("DocID"))
Next
ClassHelper.Open_Folder(SelectedFULL_FILEPATH, SelectedDocID)
End Sub
Private Sub docCM_Copy_Click(sender As Object, e As EventArgs) Handles docCM_Copy.Click
@@ -168,29 +182,28 @@ Public Class frmDocSearchResult
End Sub
Private Sub docCM_PropertiesFile_Click(sender As Object, e As EventArgs) Handles docCM_PropertiesFile.Click
Show_File_Properties()
End Sub
Sub Show_File_Properties()
If IsNothing(ClassWindreamDocGrid.DT_RESULTFILES) Then
If IsNothing(SelectedFULL_FILEPATH) Then
MsgBox("Could not read File Parameters(4)!", MsgBoxStyle.Exclamation)
Exit Sub
End If
For Each row As DataRow In ClassWindreamDocGrid.DT_RESULTFILES.Rows
If row.Item("FULL_FILENAME") <> "" Then
Cursor = Cursors.WaitCursor
Dim sei As New SHELLEXECUTEINFO
sei.cbSize = Marshal.SizeOf(sei)
sei.lpVerb = "properties"
sei.lpFile = row.Item("FULL_FILENAME")
sei.nShow = SW_SHOW
sei.fMask = SEE_MASK_INVOKEIDLIST
If Not ShellExecuteEx(sei) 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
If SelectedFULL_FILEPATH <> "" Then
Cursor = Cursors.WaitCursor
Dim sei As New SHELLEXECUTEINFO
sei.cbSize = Marshal.SizeOf(sei)
sei.lpVerb = "properties"
sei.lpFile = SelectedFULL_FILEPATH
sei.nShow = SW_SHOW
sei.fMask = SEE_MASK_INVOKEIDLIST
If Not ShellExecuteEx(sei) Then
Dim ex As New System.ComponentModel.Win32Exception(System.Runtime.InteropServices.Marshal.GetLastWin32Error())
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", "Error in Open file properties:", ex.Message)
End If
Cursor = Cursors.Default
Next
End If
Cursor = Cursors.Default
End Sub
Private Sub frmDocSearchResult_Load(sender As Object, e As EventArgs) Handles Me.Load
@@ -230,24 +243,32 @@ Public Class frmDocSearchResult
End Sub
Private Sub GridControlDocSearch_DoubleClick(sender As Object, e As EventArgs) Handles GridControlDocSearch.DoubleClick
ClassWindreamDocGrid.GetDocItems(GridViewDoc_Search)
GetDocID()
Refresh_DocID()
End Sub
Private Sub GridViewDoc_Search_ColumnFilterChanged(sender As Object, e As EventArgs) Handles GridViewDoc_Search.ColumnFilterChanged
ToolStripLabelCaption.Text = $"{CURRENT_DOCSEARCH_CAPTION} ({GridViewDoc_Search.RowCount} rows [filtered])"
If GridViewDoc_Search.RowCount > 12000 Then
ToolStripButton2.Enabled = False
Else
ToolStripButton2.Enabled = True
End If
bsiInfo.Caption = $"{CURRENT_DOCSEARCH_CAPTION} ({GridViewDoc_Search.RowCount} rows [filtered])"
End Sub
Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs) Handles ToolStripButton1.Click
Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs)
LoadDocSearch(False)
End Sub
Private Sub ToolStripButton2_Click(sender As Object, e As EventArgs) Handles ToolStripButton2.Click
Private Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick
Dim XMLPath = Get_DocGrid_Layout_Filename()
If File.Exists(XMLPath) Then
File.Delete(XMLPath)
LoadDocSearch(True)
End If
End Sub
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
Try
Dim saveFileDialogDocSearchResult As New SaveFileDialog
saveFileDialogDocSearchResult.Filter = "Excel File|*.xlsx"
@@ -273,12 +294,4 @@ Public Class frmDocSearchResult
End Try
Cursor = Cursors.Default
End Sub
Private Sub ToolStripButton3_Click(sender As Object, e As EventArgs) Handles ToolStripButton3.Click
Dim XMLPath = Get_DocGrid_Layout_Filename()
If File.Exists(XMLPath) Then
File.Delete(XMLPath)
LoadDocSearch(True)
End If
End Sub
End Class