MS SearchForm Dev
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
Imports DevExpress.XtraGrid
|
||||
Imports DevExpress.XtraEditors
|
||||
Imports DevExpress.XtraGrid
|
||||
Imports DevExpress.XtraGrid.Views.Base
|
||||
Imports DevExpress.XtraGrid.Views.Grid
|
||||
Imports DevExpress.XtraTab
|
||||
Imports DigitalData.Modules.Logging
|
||||
@@ -52,7 +54,12 @@ Public Class ClassControlCreator
|
||||
|
||||
Public Class ControlMetadata
|
||||
Public Guid As Integer
|
||||
Public [ReadOnly] As Boolean = False
|
||||
Public AttrID As Integer
|
||||
Public AttrTitle As String
|
||||
Public AttrType As String
|
||||
Public DTSource As DataTable
|
||||
Public MinValue As String
|
||||
Public MaxValue As String
|
||||
End Class
|
||||
|
||||
Private Shared Function TransformDataRow(row As DataRow, pXPosition As Integer, pYPosition As Integer) As ControlDBProps
|
||||
@@ -78,12 +85,27 @@ Public Class ClassControlCreator
|
||||
'.Color = oColor
|
||||
|
||||
End Function
|
||||
Public Function CreateBaseControl(ctrl As Control, OAttributeRow As DataRow, pXPosition As Integer, pYPosition As Integer) As Control
|
||||
Public Function CreateBaseControl(ctrl As Control, pAttributeRow As DataRow, pXPosition As Integer, pYPosition As Integer) As Control
|
||||
Try
|
||||
Dim props As ControlDBProps = TransformDataRow(OAttributeRow, pXPosition, pYPosition)
|
||||
|
||||
Dim props As ControlDBProps = TransformDataRow(pAttributeRow, pXPosition, pYPosition)
|
||||
Dim oSourceSQL As String = pAttributeRow.Item("SOURCE_SQL").ToString
|
||||
oSourceSQL = oSourceSQL.Replace("@USER_LANGUAGE", My.Application.User.Language)
|
||||
oSourceSQL = oSourceSQL.Replace("@pUSER_ID", My.Application.User.UserId)
|
||||
oSourceSQL = oSourceSQL.Replace("@RESULT_TITLE", pAttributeRow.Item("ATTRIBUTE_TITLE").ToString)
|
||||
Dim oDTSource As DataTable = My.Database_IDB.GetDatatable(oSourceSQL)
|
||||
Dim oMinValue As String = ""
|
||||
Dim oMaxValue As String = ""
|
||||
If Not IsNothing(oDTSource) Then
|
||||
oMinValue = oDTSource.Rows(0).Item(0)
|
||||
oMaxValue = oDTSource.Rows(oDTSource.Rows.Count - 1).Item(0)
|
||||
End If
|
||||
ctrl.Tag = New ControlMetadata() With {
|
||||
.Guid = props.Guid
|
||||
.Guid = CType(pAttributeRow.Item("GUID"), Integer),
|
||||
.AttrID = CType(pAttributeRow.Item("ATTRIBUTE_ID"), Integer),
|
||||
.AttrTitle = CType(pAttributeRow.Item("ATTRIBUTE_TITLE"), String),
|
||||
.DTSource = CType(oDTSource, DataTable),
|
||||
.MinValue = oMinValue,
|
||||
.MaxValue = oMaxValue
|
||||
}
|
||||
ctrl.Name = props.Name
|
||||
ctrl.Location = props.Location
|
||||
@@ -127,16 +149,38 @@ Public Class ClassControlCreator
|
||||
|
||||
Return oDataGridView
|
||||
End Function
|
||||
Public Function CreateExistingDatepicker(pAttributeRow As DataRow, pXPosition As Integer, pYPosition As Integer) As DateEdit
|
||||
Dim oDateControl As DateEdit = CType(CreateBaseControl(New DateEdit(), pAttributeRow, pXPosition, pYPosition), DateEdit)
|
||||
|
||||
oDateControl.Size = New Size(100, 20)
|
||||
oDateControl.Properties.HighlightTodayCell = True
|
||||
oDateControl.Properties.ShowWeekNumbers = True
|
||||
oDateControl.Properties.ShowClear = True
|
||||
Try
|
||||
Dim oMinDate As Date = DirectCast(oDateControl.Tag, ClassControlCreator.ControlMetadata).MinValue
|
||||
oDateControl.Properties.MinValue = oMinDate
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
Try
|
||||
Dim oMaxDate As Date = DirectCast(oDateControl.Tag, ClassControlCreator.ControlMetadata).MaxValue
|
||||
oDateControl.Properties.MaxValue = oMaxDate
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
Return oDateControl
|
||||
End Function
|
||||
Public Function CreateExistingGridControl(pAttributeRow As DataRow, pXPosition As Integer, pYPosition As Integer) As GridControl
|
||||
Dim oControl As GridControl = CreateBaseControl(New GridControl(), pAttributeRow, pXPosition, pYPosition)
|
||||
Dim oMyNewGridControl As GridControl = CreateBaseControl(New GridControl(), pAttributeRow, pXPosition, pYPosition)
|
||||
Dim oDatatable As New DataTable
|
||||
Dim oView As DevExpress.XtraGrid.Views.Grid.GridView
|
||||
|
||||
oControl.ForceInitialize()
|
||||
oMyNewGridControl.ForceInitialize()
|
||||
|
||||
oView = oControl.MainView
|
||||
oView = CType(oMyNewGridControl.MainView, GridView)
|
||||
oView.OptionsView.ShowGroupPanel = False
|
||||
oControl.ContextMenu = Nothing
|
||||
oMyNewGridControl.ContextMenu = Nothing
|
||||
oView.Appearance.EvenRow.BackColor = Color.LightBlue
|
||||
|
||||
oView.OptionsBehavior.Editable = False
|
||||
@@ -148,11 +192,11 @@ Public Class ClassControlCreator
|
||||
oView.OptionsView.ShowAutoFilterRow = True
|
||||
oView.OptionsView.EnableAppearanceEvenRow = True
|
||||
|
||||
oControl.Size = New Size(DEFAULT_WIDTH_GRIDVIEW, DEFAULT_HEIGHT_GRIDVIEW)
|
||||
oMyNewGridControl.Size = New Size(DEFAULT_WIDTH_GRIDVIEW, DEFAULT_HEIGHT_GRIDVIEW)
|
||||
|
||||
' Add and configure navigator to delete rows
|
||||
oControl.UseEmbeddedNavigator = True
|
||||
With oControl.EmbeddedNavigator.Buttons
|
||||
oMyNewGridControl.UseEmbeddedNavigator = True
|
||||
With oMyNewGridControl.EmbeddedNavigator.Buttons
|
||||
.CancelEdit.Visible = False
|
||||
.Edit.Visible = False
|
||||
.EndEdit.Visible = False
|
||||
@@ -166,20 +210,16 @@ Public Class ClassControlCreator
|
||||
End With
|
||||
|
||||
GridTables.Clear()
|
||||
Dim oSQL As String = pAttributeRow.Item("SOURCE_SQL").ToString
|
||||
oSQL = oSQL.Replace("@USER_LANGUAGE", My.Application.User.Language)
|
||||
oSQL = oSQL.Replace("@pUSER_ID", My.Application.User.UserId)
|
||||
Dim oDTSource As DataTable = My.Database_IDB.GetDatatable(oSQL)
|
||||
|
||||
|
||||
Dim oColumn = New DataColumn() With {
|
||||
.DataType = GetType(String),
|
||||
.ColumnName = pAttributeRow.Item("ATTRIBUTE_TITLE").ToString,
|
||||
.Caption = pAttributeRow.Item("ATTRIBUTE_TITLE").ToString,
|
||||
.ReadOnly = False
|
||||
}
|
||||
'Dim oColumn = New DataColumn() With {
|
||||
' .DataType = GetType(String),
|
||||
' .ColumnName = pAttributeRow.Item("ATTRIBUTE_TITLE").ToString,
|
||||
' .Caption = pAttributeRow.Item("ATTRIBUTE_TITLE").ToString,
|
||||
' .ReadOnly = False
|
||||
' }
|
||||
|
||||
oDatatable.Columns.Add(oColumn)
|
||||
'oDatatable.Columns.Add(oColumn)
|
||||
|
||||
'For Each oRow As DataRow In DT_MY_COLUMNS.Rows
|
||||
' ' Create Columns in Datatable
|
||||
@@ -212,21 +252,21 @@ Public Class ClassControlCreator
|
||||
|
||||
'Next
|
||||
|
||||
Dim oDTSource As DataTable = DirectCast(oMyNewGridControl.Tag, ClassControlCreator.ControlMetadata).DTSource
|
||||
|
||||
oMyNewGridControl.DataSource = oDTSource
|
||||
oView.PopulateColumns()
|
||||
oControl.DataSource = oDTSource
|
||||
|
||||
oMyNewGridControl.RefreshDataSource()
|
||||
oMyNewGridControl.ForceInitialize()
|
||||
'Try
|
||||
' oView.Columns(0).Caption = "Existierende Werte"
|
||||
'Catch ex As Exception
|
||||
|
||||
'End Try
|
||||
|
||||
|
||||
oControl.RefreshDataSource()
|
||||
oControl.ForceInitialize()
|
||||
Try
|
||||
oView.Columns(0).Caption = "Existierende Werte"
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
|
||||
'AddHandler oView.CellValueChanged, AddressOf HandleCellValueChanged
|
||||
'AddHandler oView.CustomRowCellEdit, Sub(sender As Object, e As CustomRowCellEditEventArgs)
|
||||
' For Each oRow As DataRow In DT_MY_COLUMNS.Rows
|
||||
' If oRow.Item("SPALTENNAME") = e.Column.FieldName Then
|
||||
@@ -274,8 +314,9 @@ Public Class ClassControlCreator
|
||||
' End If
|
||||
' End Sub
|
||||
|
||||
Return oControl
|
||||
Return oMyNewGridControl
|
||||
End Function
|
||||
|
||||
Public Function AddCheckBox(indexname As String, y As Integer, vorbelegung As String, caption As String)
|
||||
Try
|
||||
Dim value As Boolean = False
|
||||
@@ -397,18 +438,18 @@ Public Class ClassControlCreator
|
||||
AddHandler cmb.SelectedIndexChanged, AddressOf OncmbSIndexChanged
|
||||
AddHandler cmb.GotFocus, AddressOf OncmbGotFocus
|
||||
AddHandler cmb.LostFocus, AddressOf OncmbLostFocus
|
||||
AddHandler cmb.KeyDown, AddressOf OncmbKeyDown
|
||||
'AddHandler cmb.KeyDown, AddressOf OncmbKeyDown
|
||||
Return cmb
|
||||
End Function
|
||||
|
||||
Public Sub OncmbKeyDown(sender As System.Object, e As System.EventArgs)
|
||||
Dim cmb As ComboBox = sender
|
||||
'Public Sub OncmbKeyDown(sender As System.Object, e As System.EventArgs)
|
||||
' Dim cmb As ComboBox = sender
|
||||
|
||||
' Verhindert, dass Auswahlliste und Autocompleteliste übereinander liegen
|
||||
If cmb.DroppedDown = True Then
|
||||
cmb.DroppedDown = False
|
||||
End If
|
||||
End Sub
|
||||
' ' Verhindert, dass Auswahlliste und Autocompleteliste übereinander liegen
|
||||
' If cmb.DroppedDown = True Then
|
||||
' cmb.DroppedDown = False
|
||||
' End If
|
||||
'End Sub
|
||||
|
||||
Public Sub OncmbGotFocus(sender As System.Object, e As System.EventArgs)
|
||||
Dim cmb As ComboBox = sender
|
||||
@@ -421,7 +462,7 @@ Public Class ClassControlCreator
|
||||
End Sub
|
||||
|
||||
Public Sub OncmbSIndexChanged(sender As System.Object, e As System.EventArgs)
|
||||
If Form.FormLoaded = False Then
|
||||
If Form.FormShown = False Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
@@ -439,6 +480,7 @@ Public Class ClassControlCreator
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
'Private Sub Get_NextComboBoxResults(cmb As ComboBox)
|
||||
' Try
|
||||
' Dim indexname = cmb.Name.Replace("cmb", "")
|
||||
|
||||
Reference in New Issue
Block a user