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)
|
||||
_ActiveRowHandle = e.FocusedRowHandle
|
||||
|
||||
DocumentViewer1.CloseDocument()
|
||||
|
||||
If e.FocusedRowHandle >= 0 Then
|
||||
Dim oRow = sender.GetDataRow(e.FocusedRowHandle)
|
||||
Dim oFullPath = oRow.Item(COLUMN_FILEPATH)
|
||||
@ -163,89 +165,54 @@ Public Class frmDocumentResultList
|
||||
End Sub
|
||||
|
||||
Private Sub CreateDocumentGrid(GridView As GridView, Datatable As DataTable)
|
||||
Dim oMyDocDatatable As New DataTable
|
||||
Dim oDocDatatable As New DataTable
|
||||
Try
|
||||
'Die Icon Colum erstellen und konfigurieren
|
||||
oMyDocDatatable.Columns.Add(New DataColumn() With {
|
||||
oDocDatatable.Columns.Add(New DataColumn() With {
|
||||
.DataType = GetType(Image),
|
||||
.ColumnName = COLUMN_ICON,
|
||||
.Caption = ""
|
||||
})
|
||||
oMyDocDatatable.Columns.Add(New DataColumn() With {
|
||||
oDocDatatable.Columns.Add(New DataColumn() With {
|
||||
.DataType = GetType(String),
|
||||
.ColumnName = COLUMN_FILEPATH,
|
||||
.Caption = "Fullpath"
|
||||
})
|
||||
oMyDocDatatable.Columns.Add(New DataColumn() With {
|
||||
oDocDatatable.Columns.Add(New DataColumn() With {
|
||||
.DataType = GetType(Int32),
|
||||
.ColumnName = "DocID",
|
||||
.ColumnName = COLUMN_DOCID,
|
||||
.Caption = "DocID"
|
||||
})
|
||||
oMyDocDatatable.Columns.Add(New DataColumn() With {
|
||||
oDocDatatable.Columns.Add(New DataColumn() With {
|
||||
.DataType = GetType(String),
|
||||
.ColumnName = "Filename",
|
||||
.Caption = "Filename"
|
||||
})
|
||||
|
||||
Dim oRestColArray As New List(Of String)
|
||||
For Each oCol As DataColumn In Datatable.Columns
|
||||
Dim onewColumn As New DataColumn()
|
||||
If oCol.ColumnName <> "DocID" And oCol.ColumnName <> COLUMN_FILEPATH And oCol.ColumnName <> "Filename" Then
|
||||
onewColumn.DataType = GetType(String)
|
||||
onewColumn.ColumnName = oCol.ColumnName
|
||||
onewColumn.Caption = oCol.Caption
|
||||
oMyDocDatatable.Columns.Add(onewColumn)
|
||||
oRestColArray.Add(onewColumn.ColumnName)
|
||||
End If
|
||||
For Each oColumn As DataColumn In Datatable.Columns
|
||||
If oColumn.ColumnName <> COLUMN_DOCID And oColumn.ColumnName <> COLUMN_FILEPATH And oColumn.ColumnName <> COLUMN_FILENAME Then
|
||||
Dim oNewColumn As New DataColumn() With {
|
||||
.DataType = oColumn.DataType,
|
||||
.ColumnName = oColumn.ColumnName,
|
||||
.Caption = oColumn.Caption
|
||||
}
|
||||
|
||||
oDocDatatable.Columns.Add(oNewColumn)
|
||||
oRestColArray.Add(oNewColumn.ColumnName)
|
||||
End If
|
||||
Next
|
||||
|
||||
For Each oRow As DataRow In Datatable.Rows
|
||||
Dim oFullpath = oRow.Item(COLUMN_FILEPATH)
|
||||
Dim oDocID = oRow.Item("DocID")
|
||||
'Dim Folderpath = Path.GetDirectoryName(fullpath)
|
||||
Dim oFilename = IO.Path.GetFileName(oFullpath)
|
||||
Dim oFileextension = IO.Path.GetExtension(oFullpath)
|
||||
Dim oDocID = oRow.Item(COLUMN_DOCID)
|
||||
Dim oFilename = Path.GetFileName(oFullpath)
|
||||
Dim oNewRow As DataRow
|
||||
oNewRow = oMyDocDatatable.NewRow()
|
||||
oNewRow = oDocDatatable.NewRow()
|
||||
|
||||
'Icon zuweisen
|
||||
Select Case oFileextension.ToUpper
|
||||
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
|
||||
oNewRow.Item(0) = GetIconByExtension(oFullpath)
|
||||
|
||||
'Den Filepath mitgeben
|
||||
oNewRow.Item(1) = oFullpath
|
||||
oNewRow.Item(2) = oDocID
|
||||
@ -255,23 +222,16 @@ Public Class frmDocumentResultList
|
||||
For Each oColumnName As String In oRestColArray
|
||||
Dim oRowValue
|
||||
oRowValue = oRow.Item(oColumnName)
|
||||
oNewRow.Item(oIndex) = oRowValue.ToString
|
||||
oNewRow.Item(oIndex) = oRowValue
|
||||
oIndex += 1
|
||||
Next
|
||||
oMyDocDatatable.Rows.Add(oNewRow)
|
||||
|
||||
oDocDatatable.Rows.Add(oNewRow)
|
||||
Next
|
||||
|
||||
Dim oGridControl As GridControl = GridView.GridControl
|
||||
oGridControl.DataSource = oMyDocDatatable
|
||||
oGridControl.DataSource = oDocDatatable
|
||||
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
|
||||
If _Environment.User.Language <> "de-DE" Then
|
||||
@ -282,25 +242,32 @@ Public Class frmDocumentResultList
|
||||
oCreated = "Erstellt"
|
||||
End If
|
||||
|
||||
Dim oCreatedColumn = GridView.Columns(oCreated)
|
||||
If Not IsNothing(oCreatedColumn) Then
|
||||
oCreatedColumn.DisplayFormat.FormatType = FormatType.DateTime
|
||||
oCreatedColumn.DisplayFormat.FormatString = _Environment.User.DateFormat & " HH:MM:ss"
|
||||
End If
|
||||
Try
|
||||
GridView.Columns.Item(COLUMN_DOCID).Visible = False
|
||||
GridView.Columns.Item(COLUMN_FILEPATH).Visible = False
|
||||
GridView.Columns.Item(COLUMN_ICON).MaxWidth = 24
|
||||
GridView.Columns.Item(COLUMN_ICON).MinWidth = 24
|
||||
|
||||
Dim oChangedColumn = GridView.Columns(oChanged)
|
||||
If Not IsNothing(oChangedColumn) Then
|
||||
oChangedColumn.DisplayFormat.FormatType = FormatType.DateTime
|
||||
oChangedColumn.DisplayFormat.FormatString = _Environment.User.DateFormat & " HH:MM:ss"
|
||||
End If
|
||||
Dim oCreatedColumn = GridView.Columns(oCreated)
|
||||
If Not IsNothing(oCreatedColumn) Then
|
||||
oCreatedColumn.DisplayFormat.FormatType = FormatType.DateTime
|
||||
oCreatedColumn.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
|
||||
Dim oChangedColumn = GridView.Columns(oChanged)
|
||||
If Not IsNothing(oChangedColumn) Then
|
||||
oChangedColumn.DisplayFormat.FormatType = FormatType.DateTime
|
||||
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.BestFitColumns(True)
|
||||
Catch ex As Exception
|
||||
@ -308,6 +275,50 @@ Public Class frmDocumentResultList
|
||||
End Try
|
||||
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
|
||||
SplitContainerControl1.Horizontal = SwitchMainContainerHorizontal.Checked
|
||||
|
||||
@ -501,6 +512,8 @@ Public Class frmDocumentResultList
|
||||
_Config.Config.WindowLocation = Location
|
||||
_Config.Config.WindowSize = Size
|
||||
_Config.Save()
|
||||
|
||||
DocumentViewer1.Done()
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
End Try
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user