correctly show columns datatypes
This commit is contained in:
parent
921422cd57
commit
3050cd6fe8
@ -155,6 +155,8 @@ Public Class frmDocumentResultList
|
|||||||
Private Sub GridView_FocusedRowChanged(sender As GridView, e As FocusedRowChangedEventArgs)
|
Private Sub GridView_FocusedRowChanged(sender As GridView, e As FocusedRowChangedEventArgs)
|
||||||
_ActiveRowHandle = e.FocusedRowHandle
|
_ActiveRowHandle = e.FocusedRowHandle
|
||||||
|
|
||||||
|
DocumentViewer1.CloseDocument()
|
||||||
|
|
||||||
If e.FocusedRowHandle >= 0 Then
|
If e.FocusedRowHandle >= 0 Then
|
||||||
Dim oRow = sender.GetDataRow(e.FocusedRowHandle)
|
Dim oRow = sender.GetDataRow(e.FocusedRowHandle)
|
||||||
Dim oFullPath = oRow.Item(COLUMN_FILEPATH)
|
Dim oFullPath = oRow.Item(COLUMN_FILEPATH)
|
||||||
@ -163,89 +165,54 @@ Public Class frmDocumentResultList
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub CreateDocumentGrid(GridView As GridView, Datatable As DataTable)
|
Private Sub CreateDocumentGrid(GridView As GridView, Datatable As DataTable)
|
||||||
Dim oMyDocDatatable As New DataTable
|
Dim oDocDatatable As New DataTable
|
||||||
Try
|
Try
|
||||||
'Die Icon Colum erstellen und konfigurieren
|
'Die Icon Colum erstellen und konfigurieren
|
||||||
oMyDocDatatable.Columns.Add(New DataColumn() With {
|
oDocDatatable.Columns.Add(New DataColumn() With {
|
||||||
.DataType = GetType(Image),
|
.DataType = GetType(Image),
|
||||||
.ColumnName = COLUMN_ICON,
|
.ColumnName = COLUMN_ICON,
|
||||||
.Caption = ""
|
.Caption = ""
|
||||||
})
|
})
|
||||||
oMyDocDatatable.Columns.Add(New DataColumn() With {
|
oDocDatatable.Columns.Add(New DataColumn() With {
|
||||||
.DataType = GetType(String),
|
.DataType = GetType(String),
|
||||||
.ColumnName = COLUMN_FILEPATH,
|
.ColumnName = COLUMN_FILEPATH,
|
||||||
.Caption = "Fullpath"
|
.Caption = "Fullpath"
|
||||||
})
|
})
|
||||||
oMyDocDatatable.Columns.Add(New DataColumn() With {
|
oDocDatatable.Columns.Add(New DataColumn() With {
|
||||||
.DataType = GetType(Int32),
|
.DataType = GetType(Int32),
|
||||||
.ColumnName = "DocID",
|
.ColumnName = COLUMN_DOCID,
|
||||||
.Caption = "DocID"
|
.Caption = "DocID"
|
||||||
})
|
})
|
||||||
oMyDocDatatable.Columns.Add(New DataColumn() With {
|
oDocDatatable.Columns.Add(New DataColumn() With {
|
||||||
.DataType = GetType(String),
|
.DataType = GetType(String),
|
||||||
.ColumnName = "Filename",
|
.ColumnName = "Filename",
|
||||||
.Caption = "Filename"
|
.Caption = "Filename"
|
||||||
})
|
})
|
||||||
|
|
||||||
Dim oRestColArray As New List(Of String)
|
Dim oRestColArray As New List(Of String)
|
||||||
For Each oCol As DataColumn In Datatable.Columns
|
For Each oColumn As DataColumn In Datatable.Columns
|
||||||
Dim onewColumn As New DataColumn()
|
If oColumn.ColumnName <> COLUMN_DOCID And oColumn.ColumnName <> COLUMN_FILEPATH And oColumn.ColumnName <> COLUMN_FILENAME Then
|
||||||
If oCol.ColumnName <> "DocID" And oCol.ColumnName <> COLUMN_FILEPATH And oCol.ColumnName <> "Filename" Then
|
Dim oNewColumn As New DataColumn() With {
|
||||||
onewColumn.DataType = GetType(String)
|
.DataType = oColumn.DataType,
|
||||||
onewColumn.ColumnName = oCol.ColumnName
|
.ColumnName = oColumn.ColumnName,
|
||||||
onewColumn.Caption = oCol.Caption
|
.Caption = oColumn.Caption
|
||||||
oMyDocDatatable.Columns.Add(onewColumn)
|
}
|
||||||
oRestColArray.Add(onewColumn.ColumnName)
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
oDocDatatable.Columns.Add(oNewColumn)
|
||||||
|
oRestColArray.Add(oNewColumn.ColumnName)
|
||||||
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
For Each oRow As DataRow In Datatable.Rows
|
For Each oRow As DataRow In Datatable.Rows
|
||||||
Dim oFullpath = oRow.Item(COLUMN_FILEPATH)
|
Dim oFullpath = oRow.Item(COLUMN_FILEPATH)
|
||||||
Dim oDocID = oRow.Item("DocID")
|
Dim oDocID = oRow.Item(COLUMN_DOCID)
|
||||||
'Dim Folderpath = Path.GetDirectoryName(fullpath)
|
Dim oFilename = Path.GetFileName(oFullpath)
|
||||||
Dim oFilename = IO.Path.GetFileName(oFullpath)
|
|
||||||
Dim oFileextension = IO.Path.GetExtension(oFullpath)
|
|
||||||
Dim oNewRow As DataRow
|
Dim oNewRow As DataRow
|
||||||
oNewRow = oMyDocDatatable.NewRow()
|
oNewRow = oDocDatatable.NewRow()
|
||||||
|
|
||||||
'Icon zuweisen
|
'Icon zuweisen
|
||||||
Select Case oFileextension.ToUpper
|
oNewRow.Item(0) = GetIconByExtension(oFullpath)
|
||||||
Case ".csv".ToUpper
|
|
||||||
oNewRow.Item(0) = My.Resources.xls
|
|
||||||
Case ".txt".ToUpper
|
|
||||||
oNewRow.Item(0) = My.Resources.txt
|
|
||||||
Case ".pdf".ToUpper
|
|
||||||
oNewRow.Item(0) = My.Resources.pdf
|
|
||||||
Case ".doc".ToUpper
|
|
||||||
oNewRow.Item(0) = My.Resources.doc
|
|
||||||
Case ".docx".ToUpper
|
|
||||||
oNewRow.Item(0) = My.Resources.doc
|
|
||||||
Case ".xls".ToUpper
|
|
||||||
oNewRow.Item(0) = My.Resources.xls
|
|
||||||
Case ".xlsx".ToUpper
|
|
||||||
oNewRow.Item(0) = My.Resources.xls
|
|
||||||
Case ".xlsm".ToUpper
|
|
||||||
oNewRow.Item(0) = My.Resources.xls
|
|
||||||
Case ".ppt".ToUpper
|
|
||||||
oNewRow.Item(0) = My.Resources.ppt
|
|
||||||
Case ".pptx".ToUpper
|
|
||||||
oNewRow.Item(0) = My.Resources.ppt
|
|
||||||
Case ".dwg".ToUpper
|
|
||||||
oNewRow.Item(0) = My.Resources.dwg
|
|
||||||
Case ".dxf".ToUpper
|
|
||||||
oNewRow.Item(0) = My.Resources.dxf
|
|
||||||
Case ".msg".ToUpper
|
|
||||||
oNewRow.Item(0) = My.Resources._page
|
|
||||||
Case ".msg".ToUpper
|
|
||||||
oNewRow.Item(0) = My.Resources._page
|
|
||||||
Case ".tif".ToUpper
|
|
||||||
oNewRow.Item(0) = My.Resources.tiff
|
|
||||||
Case ".tiff".ToUpper
|
|
||||||
oNewRow.Item(0) = My.Resources.tiff
|
|
||||||
Case ".jpg".ToUpper
|
|
||||||
oNewRow.Item(0) = My.Resources.jpg
|
|
||||||
Case Else
|
|
||||||
oNewRow.Item(0) = My.Resources._blank
|
|
||||||
End Select
|
|
||||||
'Den Filepath mitgeben
|
'Den Filepath mitgeben
|
||||||
oNewRow.Item(1) = oFullpath
|
oNewRow.Item(1) = oFullpath
|
||||||
oNewRow.Item(2) = oDocID
|
oNewRow.Item(2) = oDocID
|
||||||
@ -255,23 +222,16 @@ Public Class frmDocumentResultList
|
|||||||
For Each oColumnName As String In oRestColArray
|
For Each oColumnName As String In oRestColArray
|
||||||
Dim oRowValue
|
Dim oRowValue
|
||||||
oRowValue = oRow.Item(oColumnName)
|
oRowValue = oRow.Item(oColumnName)
|
||||||
oNewRow.Item(oIndex) = oRowValue.ToString
|
oNewRow.Item(oIndex) = oRowValue
|
||||||
oIndex += 1
|
oIndex += 1
|
||||||
Next
|
Next
|
||||||
oMyDocDatatable.Rows.Add(oNewRow)
|
|
||||||
|
oDocDatatable.Rows.Add(oNewRow)
|
||||||
Next
|
Next
|
||||||
|
|
||||||
Dim oGridControl As GridControl = GridView.GridControl
|
Dim oGridControl As GridControl = GridView.GridControl
|
||||||
oGridControl.DataSource = oMyDocDatatable
|
oGridControl.DataSource = oDocDatatable
|
||||||
oGridControl.ForceInitialize()
|
oGridControl.ForceInitialize()
|
||||||
Try
|
|
||||||
GridView.Columns.Item("DocID").Visible = False
|
|
||||||
Catch ex As Exception
|
|
||||||
End Try
|
|
||||||
Try
|
|
||||||
GridView.Columns.Item(COLUMN_FILEPATH).Visible = False
|
|
||||||
Catch ex As Exception
|
|
||||||
End Try
|
|
||||||
|
|
||||||
Dim oCreated, oChanged As String
|
Dim oCreated, oChanged As String
|
||||||
If _Environment.User.Language <> "de-DE" Then
|
If _Environment.User.Language <> "de-DE" Then
|
||||||
@ -282,25 +242,32 @@ Public Class frmDocumentResultList
|
|||||||
oCreated = "Erstellt"
|
oCreated = "Erstellt"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim oCreatedColumn = GridView.Columns(oCreated)
|
Try
|
||||||
If Not IsNothing(oCreatedColumn) Then
|
GridView.Columns.Item(COLUMN_DOCID).Visible = False
|
||||||
oCreatedColumn.DisplayFormat.FormatType = FormatType.DateTime
|
GridView.Columns.Item(COLUMN_FILEPATH).Visible = False
|
||||||
oCreatedColumn.DisplayFormat.FormatString = _Environment.User.DateFormat & " HH:MM:ss"
|
GridView.Columns.Item(COLUMN_ICON).MaxWidth = 24
|
||||||
End If
|
GridView.Columns.Item(COLUMN_ICON).MinWidth = 24
|
||||||
|
|
||||||
Dim oChangedColumn = GridView.Columns(oChanged)
|
Dim oCreatedColumn = GridView.Columns(oCreated)
|
||||||
If Not IsNothing(oChangedColumn) Then
|
If Not IsNothing(oCreatedColumn) Then
|
||||||
oChangedColumn.DisplayFormat.FormatType = FormatType.DateTime
|
oCreatedColumn.DisplayFormat.FormatType = FormatType.DateTime
|
||||||
oChangedColumn.DisplayFormat.FormatString = _Environment.User.DateFormat & " HH:MM:ss"
|
oCreatedColumn.DisplayFormat.FormatString = _Environment.User.DateFormat & " HH:MM:ss"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
' Alle Spalten aus ReadOnly setzen, danach werden alle passenden auf nicht ReadOnly gesetzt
|
Dim oChangedColumn = GridView.Columns(oChanged)
|
||||||
For Each oColumn As GridColumn In GridView.Columns
|
If Not IsNothing(oChangedColumn) Then
|
||||||
oColumn.OptionsColumn.AllowEdit = False
|
oChangedColumn.DisplayFormat.FormatType = FormatType.DateTime
|
||||||
Next
|
oChangedColumn.DisplayFormat.FormatString = _Environment.User.DateFormat & " HH:MM:ss"
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Alle Spalten aus ReadOnly setzen, danach werden alle passenden auf nicht ReadOnly gesetzt
|
||||||
|
For Each oColumn As GridColumn In GridView.Columns
|
||||||
|
oColumn.OptionsColumn.AllowEdit = False
|
||||||
|
Next
|
||||||
|
Catch ex As Exception
|
||||||
|
_Logger.Error(ex)
|
||||||
|
End Try
|
||||||
|
|
||||||
GridView.Columns.Item(COLUMN_ICON).MaxWidth = 24
|
|
||||||
GridView.Columns.Item(COLUMN_ICON).MinWidth = 24
|
|
||||||
GridView.OptionsView.BestFitMaxRowCount = -1
|
GridView.OptionsView.BestFitMaxRowCount = -1
|
||||||
GridView.BestFitColumns(True)
|
GridView.BestFitColumns(True)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
@ -308,6 +275,50 @@ Public Class frmDocumentResultList
|
|||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Function GetIconByExtension(FilePath As String) As Bitmap
|
||||||
|
Dim oFileextension = Path.GetExtension(FilePath)
|
||||||
|
|
||||||
|
Select Case oFileextension.ToUpper
|
||||||
|
Case ".csv".ToUpper
|
||||||
|
Return My.Resources.xls
|
||||||
|
Case ".txt".ToUpper
|
||||||
|
Return My.Resources.txt
|
||||||
|
Case ".pdf".ToUpper
|
||||||
|
Return My.Resources.pdf
|
||||||
|
Case ".doc".ToUpper
|
||||||
|
Return My.Resources.doc
|
||||||
|
Case ".docx".ToUpper
|
||||||
|
Return My.Resources.doc
|
||||||
|
Case ".xls".ToUpper
|
||||||
|
Return My.Resources.xls
|
||||||
|
Case ".xlsx".ToUpper
|
||||||
|
Return My.Resources.xls
|
||||||
|
Case ".xlsm".ToUpper
|
||||||
|
Return My.Resources.xls
|
||||||
|
Case ".ppt".ToUpper
|
||||||
|
Return My.Resources.ppt
|
||||||
|
Case ".pptx".ToUpper
|
||||||
|
Return My.Resources.ppt
|
||||||
|
Case ".dwg".ToUpper
|
||||||
|
Return My.Resources.dwg
|
||||||
|
Case ".dxf".ToUpper
|
||||||
|
Return My.Resources.dxf
|
||||||
|
Case ".msg".ToUpper
|
||||||
|
Return My.Resources._page
|
||||||
|
Case ".msg".ToUpper
|
||||||
|
Return My.Resources._page
|
||||||
|
Case ".tif".ToUpper
|
||||||
|
Return My.Resources.tiff
|
||||||
|
Case ".tiff".ToUpper
|
||||||
|
Return My.Resources.tiff
|
||||||
|
Case ".jpg".ToUpper
|
||||||
|
Return My.Resources.jpg
|
||||||
|
Case Else
|
||||||
|
Return My.Resources._blank
|
||||||
|
End Select
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
Private Sub SwitchMainContainerHorizontal_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles SwitchMainContainerHorizontal.CheckedChanged
|
Private Sub SwitchMainContainerHorizontal_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles SwitchMainContainerHorizontal.CheckedChanged
|
||||||
SplitContainerControl1.Horizontal = SwitchMainContainerHorizontal.Checked
|
SplitContainerControl1.Horizontal = SwitchMainContainerHorizontal.Checked
|
||||||
|
|
||||||
@ -501,6 +512,8 @@ Public Class frmDocumentResultList
|
|||||||
_Config.Config.WindowLocation = Location
|
_Config.Config.WindowLocation = Location
|
||||||
_Config.Config.WindowSize = Size
|
_Config.Config.WindowSize = Size
|
||||||
_Config.Save()
|
_Config.Save()
|
||||||
|
|
||||||
|
DocumentViewer1.Done()
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
End Try
|
End Try
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user