jj
This commit is contained in:
parent
8283312ae7
commit
b655ec7f00
@ -35,6 +35,7 @@ Public Class ClassControlCreator
|
||||
Public Const PREFIX_LINE = "LINE"
|
||||
Public Const PREFIX_BUTTON = "BTN"
|
||||
|
||||
Public Shared GridTables As New Dictionary(Of String, DataTable)
|
||||
|
||||
''' <summary>
|
||||
''' Standard Eigenschaften für alle Controls
|
||||
@ -425,7 +426,7 @@ Public Class ClassControlCreator
|
||||
|
||||
End With
|
||||
|
||||
Dim oTables As New Dictionary(Of String, DataTable)
|
||||
GridTables.Clear()
|
||||
|
||||
For Each oRow As DD_DMSLiteDataSet.TBPM_CONTROL_TABLERow In columns
|
||||
' Create Columns in Datatable
|
||||
@ -443,15 +444,19 @@ Public Class ClassControlCreator
|
||||
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
|
||||
If Not clsPatterns.HasComplexPatterns(oSqlCommand) Then
|
||||
If oConnectionId > 0 And oSqlCommand <> "" Then
|
||||
Try
|
||||
Dim oComboboxDataTable As DataTable = ClassDatabase.Return_Datatable_ConId(oSqlCommand, oConnectionId)
|
||||
GridTables.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
|
||||
End If
|
||||
|
||||
|
||||
Next
|
||||
|
||||
oControl.DataSource = oDatatable
|
||||
@ -463,8 +468,8 @@ Public Class ClassControlCreator
|
||||
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)
|
||||
If GridTables.ContainsKey(e.Column.FieldName) Then
|
||||
Dim oComboboxDataTable As DataTable = GridTables.Item(e.Column.FieldName)
|
||||
Dim oEditor As New RepositoryItemComboBox()
|
||||
Dim oItems As New List(Of String)
|
||||
|
||||
|
||||
@ -0,0 +1 @@
|
||||
DevExpress.XtraBars.BarManager, DevExpress.XtraBars.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
@ -53,6 +53,7 @@ Public Class frmValidator
|
||||
Private _frmValidatorSearch As frmValidatorSearch 'You need a reference to Form1
|
||||
Private _dependingControl_in_action As Boolean = False
|
||||
Private DTCONTROLS As DataTable
|
||||
Private DTGRID_COLUMNS As DataTable
|
||||
Private DTVWCONTROL_INDEX As DataTable
|
||||
Private FormLoaded As Boolean = False
|
||||
Private ItemWorked As Boolean = False
|
||||
@ -557,6 +558,8 @@ Public Class frmValidator
|
||||
Dim oSQL = $"SELECT * FROM TBPM_PROFILE_CONTROLS WHERE PROFIL_ID = {CURRENT_ProfilGUID} ORDER BY Y_LOC, X_LOC"
|
||||
DTCONTROLS = ClassDatabase.Return_Datatable(oSQL)
|
||||
|
||||
oSQL = $"SELECT T1.GUID As CONTROL_ID, T1.PROFIL_ID, T.SQL_COMMAND, T.SPALTENNAME from TBPM_CONTROL_TABLE T, TBPM_PROFILE_CONTROLS T1 WHERE T.CONTROL_ID = T1.GUID AND T1.PROFIL_ID = {CURRENT_ProfilGUID} AND LEN(T.SQL_COMMAND) > 0"
|
||||
DTGRID_COLUMNS = ClassDatabase.Return_Datatable(oSQL)
|
||||
Dim oCount As Integer = 0
|
||||
|
||||
For Each oControlRow As DataRow In DTCONTROLS.Rows
|
||||
@ -1142,57 +1145,99 @@ Public Class frmValidator
|
||||
Try
|
||||
If Not IsNothing(SelectedValues) Then
|
||||
If SelectedValues.Count = 1 Then
|
||||
Dim oLOOKUPValue = SelectedValues.Item(0)
|
||||
Dim oLOOKUPName = oLookup.Name
|
||||
|
||||
Dim oControlID = DirectCast(oLookup.Tag, ClassControlCreator.ControlMetadata).Guid
|
||||
Dim oFilteredDatatable As DataTable = DTCONTROLS.Clone()
|
||||
Dim oExpression = $"SQL_UEBERPRUEFUNG like '%#CTRL#{oLOOKUPName}%'"
|
||||
DTCONTROLS.Select(oExpression).CopyToDataTable(oFilteredDatatable, LoadOption.PreserveChanges)
|
||||
If oFilteredDatatable.Rows.Count = 1 Then
|
||||
Dim oDEPENDING_GUID = oFilteredDatatable.Rows(0).Item("GUID")
|
||||
Dim oDEPENDING_CtrlName = oFilteredDatatable.Rows(0).Item("NAME")
|
||||
If _dependingControl_in_action = True Then
|
||||
Exit Sub
|
||||
End If
|
||||
If Not IsDBNull(oFilteredDatatable.Rows(0).Item("CONNECTION_ID")) And Not IsDBNull(oFilteredDatatable.Rows(0).Item("SQL_UEBERPRUEFUNG")) Then
|
||||
Dim oSqlCommand = IIf(IsDBNull(oFilteredDatatable.Rows(0).Item("SQL_UEBERPRUEFUNG")), "", oFilteredDatatable.Rows(0).Item("SQL_UEBERPRUEFUNG"))
|
||||
oSqlCommand = clsPatterns.ReplaceAllValues(oSqlCommand, pnldesigner, CURRENT_WMFILE, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
||||
LOGGER.Debug(">>> sql after ReplaceAllValues: " & oSqlCommand)
|
||||
_dependingControl_in_action = True
|
||||
Dim oDTDEPENDING_RESULT As DataTable = ClassDatabase.Return_Datatable(oSqlCommand)
|
||||
Try
|
||||
'Dim oDependingLookup As LookupControl2 = pnldesigner.Controls.Find(oDEPENDING_CtrlName, False).FirstOrDefault()
|
||||
For Each oControl As Control In pnldesigner.Controls
|
||||
|
||||
If DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid = oDEPENDING_GUID Then
|
||||
If oControl.GetType.ToString = "System.Windows.Forms.TextBox" Then
|
||||
oControl.Text = oDTDEPENDING_RESULT.Rows(0).Item(0)
|
||||
Else
|
||||
Dim oDependingLookup As LookupControl2 = oControl
|
||||
oDependingLookup.DataSource = oDTDEPENDING_RESULT
|
||||
End If
|
||||
_dependingControl_in_action = False
|
||||
Exit For
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
LOGGER.Warn($"Error while setting depending control-value for [{oDEPENDING_CtrlName}]: " & ex.Message)
|
||||
_dependingControl_in_action = False
|
||||
End Try
|
||||
SendKeys.Send("{TAB}")
|
||||
ControlHandleStarted = True
|
||||
End If
|
||||
End If
|
||||
LookupControl_DependingControls(oLookup, SelectedValues)
|
||||
LookupControl_DependingColumn(oLookup, SelectedValues)
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub LookupControl_DependingControls(LookupControl As LookupControl2, SelectedValues As List(Of String))
|
||||
Dim oLOOKUPValue = SelectedValues.Item(0)
|
||||
Dim oLOOKUPName = LookupControl.Name
|
||||
|
||||
Dim oControlID = DirectCast(LookupControl.Tag, ClassControlCreator.ControlMetadata).Guid
|
||||
Dim oFilteredDatatable As DataTable = DTCONTROLS.Clone()
|
||||
Dim oExpression = $"SQL_UEBERPRUEFUNG like '%#CTRL#{oLOOKUPName}%'"
|
||||
DTCONTROLS.Select(oExpression).CopyToDataTable(oFilteredDatatable, LoadOption.PreserveChanges)
|
||||
If oFilteredDatatable.Rows.Count = 1 Then
|
||||
Dim oDEPENDING_GUID = oFilteredDatatable.Rows(0).Item("GUID")
|
||||
Dim oDEPENDING_CtrlName = oFilteredDatatable.Rows(0).Item("NAME")
|
||||
If _dependingControl_in_action = True Then
|
||||
Exit Sub
|
||||
End If
|
||||
If Not IsDBNull(oFilteredDatatable.Rows(0).Item("CONNECTION_ID")) And Not IsDBNull(oFilteredDatatable.Rows(0).Item("SQL_UEBERPRUEFUNG")) Then
|
||||
Dim oSqlCommand = IIf(IsDBNull(oFilteredDatatable.Rows(0).Item("SQL_UEBERPRUEFUNG")), "", oFilteredDatatable.Rows(0).Item("SQL_UEBERPRUEFUNG"))
|
||||
oSqlCommand = clsPatterns.ReplaceAllValues(oSqlCommand, pnldesigner, CURRENT_WMFILE, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
||||
LOGGER.Debug(">>> sql after ReplaceAllValues: " & oSqlCommand)
|
||||
_dependingControl_in_action = True
|
||||
Dim oDTDEPENDING_RESULT As DataTable = ClassDatabase.Return_Datatable(oSqlCommand)
|
||||
Try
|
||||
'Dim oDependingLookup As LookupControl2 = pnldesigner.Controls.Find(oDEPENDING_CtrlName, False).FirstOrDefault()
|
||||
For Each oControl As Control In pnldesigner.Controls
|
||||
|
||||
If DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid = oDEPENDING_GUID Then
|
||||
Select Case oControl.GetType.ToString
|
||||
Case GetType(TextBox).ToString
|
||||
oControl.Text = oDTDEPENDING_RESULT.Rows(0).Item(0)
|
||||
Case GetType(LookupControl2).ToString
|
||||
Dim oDependingLookup As LookupControl2 = oControl
|
||||
oDependingLookup.DataSource = oDTDEPENDING_RESULT
|
||||
Case GetType(GridControl).ToString
|
||||
'ClassControlCreator.GridTables
|
||||
|
||||
End Select
|
||||
_dependingControl_in_action = False
|
||||
Exit For
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
LOGGER.Warn($"Error while setting depending control-value for [{oDEPENDING_CtrlName}]: " & ex.Message)
|
||||
_dependingControl_in_action = False
|
||||
End Try
|
||||
SendKeys.Send("{TAB}")
|
||||
ControlHandleStarted = True
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Private Sub LookupControl_DependingColumn(LookupControl As LookupControl2, SelectedValues As List(Of String))
|
||||
Dim oSQLColumnDatatable As DataTable = DTGRID_COLUMNS.Clone()
|
||||
Dim oExpression = $"SQL_COMMAND like '%#CTRL#{LookupControl.Name}%'"
|
||||
DTGRID_COLUMNS.Select(oExpression).CopyToDataTable(oSQLColumnDatatable, LoadOption.PreserveChanges)
|
||||
If oSQLColumnDatatable.Rows.Count > 0 Then
|
||||
For Each oRow As DataRow In oSQLColumnDatatable.Rows
|
||||
Dim oDEPENDING_GUID = DTGRID_COLUMNS.Rows(0).Item("CONTROL_ID")
|
||||
Dim oDEPENDING_COLUMN = DTGRID_COLUMNS.Rows(0).Item("SPALTENNAME")
|
||||
Dim oSqlCommand = DTGRID_COLUMNS.Rows(0).Item("SQL_COMMAND")
|
||||
If _dependingControl_in_action = True Then
|
||||
Exit Sub
|
||||
End If
|
||||
oSqlCommand = clsPatterns.ReplaceAllValues(oSqlCommand, pnldesigner, CURRENT_WMFILE, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
||||
LOGGER.Debug(">>> sql after ReplaceAllValues: " & oSqlCommand)
|
||||
_dependingControl_in_action = True
|
||||
Try
|
||||
Dim oDTDEPENDING_RESULT As DataTable = ClassDatabase.Return_Datatable(oSqlCommand)
|
||||
For Each oControl As Control In pnldesigner.Controls
|
||||
If DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid = oDEPENDING_GUID Then
|
||||
ClassControlCreator.GridTables.Add(oDEPENDING_COLUMN, oDTDEPENDING_RESULT)
|
||||
_dependingControl_in_action = False
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
_dependingControl_in_action = False
|
||||
End Try
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Public Sub OnCmbselectedIndex(sender As System.Object, e As System.EventArgs)
|
||||
Dim cmb As ComboBox = sender
|
||||
If cmb.SelectedIndex <> -1 And _Indexe_Loaded = True Then
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user