jj 09.03.2016 übersetzung & mehrere abhängigkeiten
This commit is contained in:
@@ -81,45 +81,89 @@ Public Class ClassControlBuilder
|
||||
|
||||
Public Sub OnComboBoxValueChanged(sender As Object, ByVal e As EventArgs)
|
||||
Try
|
||||
Dim control As ComboBox = DirectCast(sender, ComboBox)
|
||||
Dim control As Control = DirectCast(sender, Control)
|
||||
Dim controlId As Integer = DirectCast(control.Tag, ClassControlMetadata).Id
|
||||
Dim SQL As String = String.Format("SELECT GUID, SQL_COMMAND_1 FROM TBPMO_CONTROL WHERE SQL_COMMAND_1 LIKE '%@{0}@%'", controlId)
|
||||
Dim value As String = control.SelectedValue
|
||||
Dim value
|
||||
|
||||
Select Case control.GetType()
|
||||
Case GetType(ComboBox)
|
||||
value = DirectCast(control, ComboBox).SelectedValue
|
||||
Case Else
|
||||
Exit Sub
|
||||
End Select
|
||||
|
||||
If String.IsNullOrEmpty(value) Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim datatable As DataTable = ClassDatabase.Return_Datatable(SQL)
|
||||
|
||||
If datatable.Rows.Count = 0 Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim sqlcommand As String = datatable.Rows(0).Item("SQL_COMMAND_1")
|
||||
For Each row As DataRow In datatable.Rows
|
||||
Dim sqlcommand As String = row.Item("SQL_COMMAND_1")
|
||||
|
||||
If IsNothing(sqlcommand) Then
|
||||
Exit Sub
|
||||
End If
|
||||
If IsNothing(sqlcommand) Then
|
||||
Continue For
|
||||
End If
|
||||
|
||||
If String.IsNullOrEmpty(value) Then
|
||||
Exit Sub
|
||||
End If
|
||||
Dim regex As New System.Text.RegularExpressions.Regex("(@(\d+)@)")
|
||||
Dim match As System.Text.RegularExpressions.Match = regex.Match(sqlcommand)
|
||||
|
||||
If match.Success Then
|
||||
' DependingControlId bezeichnet das Control, das die Abhängigkeit enthält
|
||||
Dim dependingControlId As Integer = row.Item("GUID")
|
||||
Dim panel As Panel = DirectCast(control.Parent, Panel)
|
||||
' Über die Id das Control finden
|
||||
Dim dependingControl As Control = panel.Controls.OfType(Of Control)().Where(Function(c As Control)
|
||||
Return DirectCast(c.Tag, ClassControlMetadata).Id = dependingControlId
|
||||
End Function).SingleOrDefault()
|
||||
|
||||
sqlcommand = sqlcommand.Replace(match.Groups(1).Value, value)
|
||||
Console.WriteLine("Executing SQL_COMMAND: {0} for controlID {1}", sqlcommand, dependingControlId)
|
||||
Dim dt As DataTable = ClassDatabase.Return_Datatable(sqlcommand)
|
||||
|
||||
Select Case control.GetType()
|
||||
Case GetType(ComboBox)
|
||||
ControlLoader.Combobox.SetDataSource(DirectCast(dependingControl, ComboBox), dt)
|
||||
End Select
|
||||
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
'Dim sqlcommand As String = datatable.Rows(0).Item("SQL_COMMAND_1")
|
||||
|
||||
'If IsNothing(sqlcommand) Then
|
||||
' Exit Sub
|
||||
'End If
|
||||
|
||||
'If String.IsNullOrEmpty(value) Then
|
||||
' Exit Sub
|
||||
'End If
|
||||
|
||||
|
||||
|
||||
Dim regex As New System.Text.RegularExpressions.Regex("(@(\d+)@)")
|
||||
Dim match As System.Text.RegularExpressions.Match = regex.Match(sqlcommand)
|
||||
'Dim regex As New System.Text.RegularExpressions.Regex("(@(\d+)@)")
|
||||
'Dim match As System.Text.RegularExpressions.Match = regex.Match(sqlcommand)
|
||||
|
||||
If match.Success Then
|
||||
' DependingControlId bezeichnet das Control, das die Abhängigkeit enthält
|
||||
Dim dependingControlId As Integer = datatable.Rows(0).Item("GUID")
|
||||
Dim panel As Panel = DirectCast(control.Parent, Panel)
|
||||
' Über die Id das Control finden
|
||||
Dim dependingControl As ComboBox = Panel.Controls.OfType(Of ComboBox)().Where(Function(c As ComboBox)
|
||||
Return DirectCast(c.Tag, ClassControlMetadata).Id = dependingControlId
|
||||
End Function).SingleOrDefault()
|
||||
'If match.Success Then
|
||||
' ' DependingControlId bezeichnet das Control, das die Abhängigkeit enthält
|
||||
' Dim dependingControlId As Integer = datatable.Rows(0).Item("GUID")
|
||||
' Dim panel As Panel = DirectCast(control.Parent, Panel)
|
||||
' ' Über die Id das Control finden
|
||||
' Dim dependingControl As ComboBox = panel.Controls.OfType(Of ComboBox)().Where(Function(c As ComboBox)
|
||||
' Return DirectCast(c.Tag, ClassControlMetadata).Id = dependingControlId
|
||||
' End Function).SingleOrDefault()
|
||||
|
||||
sqlcommand = sqlcommand.Replace(match.Groups(1).Value, value)
|
||||
Console.WriteLine("Executing SQL_COMMAND: {0}", sqlcommand)
|
||||
Dim dt As DataTable = ClassDatabase.Return_Datatable(sqlcommand)
|
||||
ControlLoader.Combobox.SetDataSource(dependingControl, dt)
|
||||
End If
|
||||
' sqlcommand = sqlcommand.Replace(match.Groups(1).Value, value)
|
||||
' Console.WriteLine("Executing SQL_COMMAND: {0}", sqlcommand)
|
||||
' Dim dt As DataTable = ClassDatabase.Return_Datatable(sqlcommand)
|
||||
' ControlLoader.Combobox.SetDataSource(dependingControl, dt)
|
||||
'End If
|
||||
|
||||
Console.WriteLine("value changed")
|
||||
Catch ex As Exception
|
||||
|
||||
Reference in New Issue
Block a user