First Working Version with New parser
This commit is contained in:
59
EDIDocumentImport/GridLoader.vb
Normal file
59
EDIDocumentImport/GridLoader.vb
Normal file
@@ -0,0 +1,59 @@
|
||||
Imports DevExpress.XtraGrid
|
||||
Imports DevExpress.XtraGrid.Views.Grid
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports ImporterShared
|
||||
|
||||
Public Class GridLoader
|
||||
Inherits BaseClass
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig)
|
||||
MyBase.New(pLogConfig, pLogConfig.GetLogger())
|
||||
End Sub
|
||||
|
||||
Public Function GetGridFromElement(pTable As Schemas.Schema.Table) As GridControl
|
||||
Dim oGrid As New GridControl With {
|
||||
.Dock = DockStyle.Fill,
|
||||
.Name = pTable.Name
|
||||
}
|
||||
|
||||
oGrid.ForceInitialize()
|
||||
oGrid.MainView.PopulateColumns()
|
||||
|
||||
Dim oView As GridView = oGrid.DefaultView
|
||||
|
||||
For Each oCol In pTable.Columns
|
||||
Dim oColumn = New Columns.GridColumn With {
|
||||
.Name = oCol.Name,
|
||||
.Caption = oCol.Name,
|
||||
.FieldName = oCol.Name,
|
||||
.UnboundType = GetColumnType(oCol),
|
||||
.VisibleIndex = 0
|
||||
}
|
||||
|
||||
oView.Columns.Add(oColumn)
|
||||
|
||||
Next
|
||||
|
||||
Return oGrid
|
||||
End Function
|
||||
|
||||
Private Function GetColumnType(pColumn As Schemas.Schema.Column)
|
||||
Select Case pColumn.DataType
|
||||
Case Schemas.Schema.ColumnType.Boolean
|
||||
Return DevExpress.Data.UnboundColumnType.Boolean
|
||||
|
||||
Case Schemas.Schema.ColumnType.Date
|
||||
Return DevExpress.Data.UnboundColumnType.DateTime
|
||||
|
||||
Case Schemas.Schema.ColumnType.Integer
|
||||
Return DevExpress.Data.UnboundColumnType.Integer
|
||||
|
||||
Case Schemas.Schema.ColumnType.Decimal
|
||||
Return DevExpress.Data.UnboundColumnType.Decimal
|
||||
|
||||
Case Else
|
||||
Return DevExpress.Data.UnboundColumnType.String
|
||||
End Select
|
||||
|
||||
End Function
|
||||
End Class
|
||||
Reference in New Issue
Block a user