This commit is contained in:
SchreiberM
2016-05-04 14:35:14 +02:00
parent a14801748b
commit 7ec031388f
14 changed files with 5779 additions and 5537 deletions

View File

@@ -202,6 +202,13 @@ Public Class ClassControlBuilder
Catch ex As Exception
ClassLogger.Add("Unexpected Error in EnableControls - TextBox: " & ex.Message, True)
End Try
Case "CheckBox"
Try
Dim enabled As Boolean = CBool(dt.Rows(0).Item(0))
dependingControl.Enabled = enabled
Catch ex As Exception
ClassLogger.Add("Unexpected Error in EnableControls - Checkbox: " & ex.Message, True)
End Try
End Select
Else
@@ -226,6 +233,32 @@ Public Class ClassControlBuilder
If CURRENT_RECORD_ID = 0 Then
Exit Sub
End If
If IsNothing(value) Then 'Kein Value also abhängige Controls auf "Leer" setzen
For Each row As DataRow In TableResult.Rows
' 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()
Dim type = dependingControl.GetType().Name
Select Case Type
Case "CustomComboBox"
DirectCast(dependingControl, CustomComboBox).DataSource = Nothing
Case "CheckedListBoxControl"
DirectCast(dependingControl, DevExpress.XtraEditors.CheckedListBoxControl).DataSource = Nothing
Case "Label"
DirectCast(dependingControl, Label).Text = ""
Case "TextBox"
DirectCast(dependingControl, TextBox).Text = ""
End Select
Next
Exit Sub
End If
For Each row As DataRow In TableResult.Rows
Dim sqlcommand As String = row.Item("SQL_COMMAND_1")
@@ -434,42 +467,13 @@ Public Class ClassControlBuilder
Dim datatable As DataTable = ClassDatabase.Return_Datatable(SQL)
Dim datatable1 As DataTable = ClassDatabase.Return_Datatable(SQLenable)
Depending_Controls(control, datatable, CONTROL_VALUE)
If IsNothing(CONTROL_VALUE) Then
Exit Sub
End If
Enable_Controls(control, datatable1, CONTROL_VALUE)
Dim values = New List(Of Object)(CONTROL_VALUE.Split(";").ToArray())
'Jetzt noch die checked Items setzen
ClassControlValues.LoadControlValue(CURRENT_RECORD_ID, CURRENT_PARENT_ID, controlId, control, values, 99)
'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)
'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 CustomComboBox = panel.Controls.OfType(Of CustomComboBox)().Where(Function(c As CustomComboBox)
' 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
Console.WriteLine("value changed")
Catch ex As Exception
If ex.Message.Contains("Objektverweis") Or ex.Message.Contains("reference not set") Then