This commit is contained in:
SchreiberM 2019-11-20 16:19:29 +01:00
commit 8ebd2b0ff0

View File

@ -1,8 +1,10 @@
Imports DD_LIB_Standards
Imports System.ComponentModel
Imports DD_LIB_Standards
Imports DevExpress.Utils
Imports DevExpress.XtraEditors
Imports DevExpress.XtraEditors.Controls
Imports DevExpress.XtraEditors.NavigatorButtons
Imports DevExpress.XtraEditors.Repository
Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Views.Base
Imports DevExpress.XtraGrid.Views.Grid
@ -387,7 +389,7 @@ Public Class ClassControlCreator
oControl.ForceInitialize()
oView = oControl.DefaultView
oView = oControl.MainView
oView.OptionsView.ShowGroupPanel = False
oControl.ContextMenu = Nothing
@ -423,7 +425,11 @@ Public Class ClassControlCreator
End With
Dim oTables As New Dictionary(Of String, DataTable)
For Each oRow As DD_DMSLiteDataSet.TBPM_CONTROL_TABLERow In columns
' Create Columns in Datatable
Dim oColumn = New DataColumn() With {
.DataType = GetType(String),
.ColumnName = oRow.SPALTENNAME,
@ -432,11 +438,57 @@ Public Class ClassControlCreator
}
oDatatable.Columns.Add(oColumn)
' Fetch and cache Combobox results
Dim oConnectionId As Integer = NotNull(oRow.Item("CONNECTION_ID"), 0)
Dim oSqlCommand As String = NotNull(oRow.Item("SQL_COMMAND"), "")
If oConnectionId > 0 And oSqlCommand <> "" Then
Try
Dim oComboboxDataTable As DataTable = ClassDatabase.Return_Datatable_ConId(oSqlCommand, oConnectionId)
oTables.Add(oRow.SPALTENNAME, oComboboxDataTable)
Catch ex As Exception
LOGGER.Warn("Could not load data for column {0} in control {1}", oRow.SPALTENNAME, oControl.Name)
LOGGER.Error(ex)
End Try
End If
Next
oControl.DataSource = oDatatable
oControl.RefreshDataSource()
oControl.ForceInitialize()
AddHandler oView.CellValueChanged, AddressOf HandleCellValueChanged
AddHandler oView.CustomRowCellEdit, Sub(sender As Object, e As CustomRowCellEditEventArgs)
For Each oRow As DD_DMSLiteDataSet.TBPM_CONTROL_TABLERow In columns
If oRow.SPALTENNAME = e.Column.FieldName Then
If oTables.ContainsKey(e.Column.FieldName) Then
Dim oComboboxDataTable As DataTable = oTables.Item(e.Column.FieldName)
Dim oEditor As New RepositoryItemComboBox()
Dim oItems As New List(Of String)
oEditor.AutoComplete = True
AddHandler oEditor.Validating, Sub(_sender As ComboBoxEdit, _e As CancelEventArgs)
If oItems.Contains(_sender.EditValue) Then
_e.Cancel = False
Else
_e.Cancel = True
End If
End Sub
For Each oRow2 In oComboboxDataTable.Rows
Dim oValue = oRow2.item(0)
oEditor.Items.Add(oValue)
oItems.Add(oValue)
Next
e.RepositoryItem = oEditor
End If
End If
Next
End Sub
Return oControl
End Function
@ -451,6 +503,8 @@ Public Class ClassControlCreator
Dim foo = 1
End Function
Public Shared Function CreateExistingLine(row As DataRow, designMode As Boolean) As LineLabel
Dim control As LineLabel = CreateBaseControl(New LineLabel(), row, designMode)
control.Text = "------------------------------"