MS
This commit is contained in:
@@ -860,7 +860,15 @@ Public Class frmValidator
|
||||
If filteredData.Rows.Count = 1 Then
|
||||
'AddHandler lookup.EditValueChanged, AddressOf onLookUp1
|
||||
AddHandler lookup.SelectedValuesChanged, AddressOf onLookUpselectedValue
|
||||
Else
|
||||
oExpression = $"SQL_ENABLE like '%#CTRL#{oMyControl.Name}%'"
|
||||
DTCONTROLS.Select(oExpression).CopyToDataTable(filteredData, LoadOption.PreserveChanges)
|
||||
If filteredData.Rows.Count = 1 Then
|
||||
'AddHandler lookup.EditValueChanged, AddressOf onLookUp1
|
||||
AddHandler lookup.SelectedValuesChanged, AddressOf onLookUpselectedValue
|
||||
End If
|
||||
End If
|
||||
|
||||
filteredData = DTCONTROLS.Clone()
|
||||
oExpression = $"GUID = {oControlRow.Item("GUID")} and Len(SET_CONTROL_DATA) > 0"
|
||||
DTCONTROLS.Select(oExpression).CopyToDataTable(filteredData, LoadOption.PreserveChanges)
|
||||
@@ -1320,6 +1328,7 @@ Public Class frmValidator
|
||||
If Not IsNothing(SelectedValues) Then
|
||||
If SelectedValues.Count = 1 Then
|
||||
LookupControl_DependingControls(oLookup, SelectedValues)
|
||||
LookupControl_EnablingControls(oLookup, SelectedValues)
|
||||
LookupControl_DependingColumn(oLookup, SelectedValues)
|
||||
Else
|
||||
LOGGER.Debug("Uups: SelectedValues.Count <> 1 ")
|
||||
@@ -1564,6 +1573,13 @@ Public Class frmValidator
|
||||
|
||||
End If
|
||||
End Sub
|
||||
Private Sub LookupControl_EnablingControls(LookupControl As LookupControl2, SelectedValues As List(Of String))
|
||||
Dim oLOOKUPValue = SelectedValues.Item(0)
|
||||
LOGGER.Debug($"oLOOKUPValue is [{oLOOKUPValue}]!")
|
||||
Dim oControlID = DirectCast(LookupControl.Tag, ClassControlCreator.ControlMetadata).Guid
|
||||
Controls2beEnabled(LookupControl.Name)
|
||||
|
||||
End Sub
|
||||
Private Sub LookupControl_DependingColumn(LookupControl As LookupControl2, SelectedValues As List(Of String))
|
||||
Dim oSQLColumnDatatable As DataTable = DTGRID_COLUMNS_WITH_SQL.Clone()
|
||||
Dim oExpression = $"SQL_COMMAND like '%#CTRL#{LookupControl.Name}%'"
|
||||
@@ -1623,36 +1639,6 @@ Public Class frmValidator
|
||||
sql_Statement = clsPatterns.ReplaceAllValues(sql_Statement, pnldesigner, CURRENT_WMFILE, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
||||
_Step = 3
|
||||
|
||||
'' Regulären Ausdruck zum Auslesen der Indexe definieren
|
||||
'Dim preg As String = "\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}"
|
||||
'' einen Regulären Ausdruck laden
|
||||
'Dim regulärerAusdruck As Text.RegularExpressions.Regex = New Text.RegularExpressions.Regex(preg)
|
||||
'' die Vorkommen im SQL-String auslesen
|
||||
'Dim elemente As Text.RegularExpressions.MatchCollection = regulärerAusdruck.Matches(sql_Statement)
|
||||
''####
|
||||
'' alle Vorkommen innerhalbd er Namenkonvention durchlaufen
|
||||
'For Each element As Text.RegularExpressions.Match In elemente
|
||||
' Try
|
||||
' If LogErrorsOnly = False Then LOGGER.Info(" >> element in RegeX: " & element.Value)
|
||||
' Dim MyPattern = element.Value.Substring(2, element.Value.Length - 3)
|
||||
' Dim input_value
|
||||
|
||||
' If MyPattern.Contains(ClassControlCreator.PREFIX_TEXTBOX) Then
|
||||
' Dim txt As TextBox = CType(pnldesigner.Controls(MyPattern), TextBox)
|
||||
' input_value = txt.Text
|
||||
' ElseIf MyPattern.Contains(ClassControlCreator.PREFIX_COMBOBOX) Then
|
||||
' Dim cmb1 As ComboBox = CType(pnldesigner.Controls(MyPattern), ComboBox)
|
||||
' input_value = cmb1.Text
|
||||
' End If
|
||||
' sql_Statement = sql_Statement.ToString.Replace(element.Value, input_value)
|
||||
|
||||
' Catch ex As Exception
|
||||
' LOGGER.Info("Unexpected Error in Checking control values for Variable SQL Result ComboBox - ERROR: " & ex.Message)
|
||||
' End Try
|
||||
|
||||
'Next
|
||||
'If LogErrorsOnly = False Then LOGGER.Info(">>> sql_Statement after replacement: " & sql_Statement)
|
||||
|
||||
_dependingControl_in_action = True
|
||||
_Step = 4
|
||||
Depending_Control_Set_Result(displayboxname, sql_Statement, ROW.Item(1))
|
||||
@@ -1666,18 +1652,71 @@ Public Class frmValidator
|
||||
End Try
|
||||
Next
|
||||
End If
|
||||
Controls2beEnabled(cmb.Name)
|
||||
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
LOGGER.Info("Unexpected Error in Eventhandler Variable SQL Result ComboBox - ERROR: " & ex.Message)
|
||||
End Try
|
||||
|
||||
SendKeys.Send("{TAB}")
|
||||
ControlHandleStarted = True
|
||||
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Private Sub Controls2beEnabled(pControlName As String)
|
||||
Try
|
||||
Dim oFilteredDatatable As DataTable = DTCONTROLS.Clone()
|
||||
Dim oExpression = $"SQL_ENABLE like '%#CTRL#{pControlName}%'"
|
||||
DTCONTROLS.Select(oExpression).CopyToDataTable(oFilteredDatatable, LoadOption.PreserveChanges)
|
||||
If oFilteredDatatable.Rows.Count > 0 Then
|
||||
LOGGER.Debug($"We got {oFilteredDatatable.Rows.Count} controls which got enable definitions!!")
|
||||
Else
|
||||
LOGGER.Debug($"Sorry NO controls with enabling definition!!")
|
||||
End If
|
||||
For Each oRowEnablingControl As DataRow In oFilteredDatatable.Rows
|
||||
Dim oENABLE_GUID = oRowEnablingControl.Item("GUID")
|
||||
Dim oENABLE_CtrlName = oRowEnablingControl.Item("NAME")
|
||||
LOGGER.Debug($"Control {oENABLE_CtrlName} is depending on lookUp {pControlName}..")
|
||||
If _dependingControl_in_action = True Then
|
||||
LOGGER.Debug($"..but _dependingControl_in_action = True ==> Exit Sub!")
|
||||
Exit Sub
|
||||
End If
|
||||
If Not IsDBNull(oRowEnablingControl.Item("CONNECTION_ID")) And Not IsDBNull(oRowEnablingControl.Item("SQL_ENABLE")) Then
|
||||
Dim oSqlCommand = IIf(IsDBNull(oRowEnablingControl.Item("SQL_ENABLE")), "", oRowEnablingControl.Item("SQL_ENABLE"))
|
||||
oSqlCommand = clsPatterns.ReplaceAllValues(oSqlCommand, pnldesigner, CURRENT_WMFILE, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
||||
_dependingControl_in_action = True
|
||||
Dim oENABLERESULT As Boolean = ClassDatabase.Execute_Scalar(oSqlCommand, CONNECTION_STRING)
|
||||
Try
|
||||
Dim oFound As Boolean = False
|
||||
'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 = oENABLE_GUID Then
|
||||
oFound = True
|
||||
LOGGER.Debug($"Got the depending control ID:{oENABLE_GUID}..Setting enabled/Disabled...")
|
||||
oControl.Enabled = oENABLERESULT
|
||||
_dependingControl_in_action = False
|
||||
Exit For
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
If oFound = False Then
|
||||
LOGGER.Debug($"Could not find the enabling Control with ID {oENABLE_GUID} on panel!!!")
|
||||
End If
|
||||
Catch ex As Exception
|
||||
LOGGER.Warn($"Error while setting enabling control-value for [{oENABLE_CtrlName}]: " & ex.Message)
|
||||
_dependingControl_in_action = False
|
||||
End Try
|
||||
Else
|
||||
LOGGER.Debug($"Error: Check CoNN ID and SQL on NULL VALUES!")
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub Depending_Control_Set_Result(displayboxname As String, sqlCommand As String, sqlConnection As String)
|
||||
Try
|
||||
Dim resultDT As DataTable = ClassDatabase.Return_Datatable_ConStr(sqlCommand, sqlConnection)
|
||||
|
||||
Reference in New Issue
Block a user