This commit is contained in:
SchreiberM
2016-03-08 15:46:07 +01:00
4 changed files with 56 additions and 14 deletions

View File

@@ -78,6 +78,55 @@ Public Class ClassControlBuilder
Dim combo As ComboBox = sender Dim combo As ComboBox = sender
combo.BackColor = Color.White combo.BackColor = Color.White
End Sub End Sub
Public Sub OnComboBoxValueChanged(sender As Object, ByVal e As EventArgs)
Try
Dim control As ComboBox = DirectCast(sender, ComboBox)
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 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")
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 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
Console.WriteLine("value changed")
Catch ex As Exception
MsgBox("Error in OnComboBoxValueChanged: " & ex.Message)
End Try
End Sub
' ================================================================================== ' ==================================================================================
' Mouse Up/Down/Move-Handler für LevelDesigner festlegen ' Mouse Up/Down/Move-Handler für LevelDesigner festlegen
' RecordChanged-Handler für Constructor festlegen ' RecordChanged-Handler für Constructor festlegen
@@ -104,6 +153,7 @@ Public Class ClassControlBuilder
Case "ComboBox" Case "ComboBox"
Dim combo As ComboBox = CType(control, ComboBox) Dim combo As ComboBox = CType(control, ComboBox)
AddHandler combo.SelectedValueChanged, AddressOf RecordChanged AddHandler combo.SelectedValueChanged, AddressOf RecordChanged
AddHandler combo.SelectedValueChanged, AddressOf OnComboBoxValueChanged
AddHandler combo.TextChanged, AddressOf RecordChanged AddHandler combo.TextChanged, AddressOf RecordChanged
AddHandler combo.GotFocus, AddressOf OnComboBoxFocus AddHandler combo.GotFocus, AddressOf OnComboBoxFocus
AddHandler combo.LostFocus, AddressOf OnComboBoxLostFocus AddHandler combo.LostFocus, AddressOf OnComboBoxLostFocus

View File

@@ -97,7 +97,6 @@ Module ClassControlProperties
Private _required As Boolean = False Private _required As Boolean = False
Private _read_only As Boolean = False Private _read_only As Boolean = False
' Database Configurations ' Database Configurations
Private _sql_connection As String = ""
Private _sql_command As String = "" Private _sql_command As String = ""
' Font Configurations ' Font Configurations
Private _font As Font Private _font As Font
@@ -136,17 +135,6 @@ Module ClassControlProperties
End Set End Set
End Property End Property
'<LocalizedCategoryAttribute("category_database")>
'<LocalizedDescriptionAttribute("Gibt die Datenbankverbindung für dieses Element an.")>
'Public Property SQLConnection() As SQLValue
' Get
' Return New SQLValue(_sql_connection)
' End Get
' Set(value As SQLValue)
' _sql_connection = value.Value
' End Set
'End Property
<LocalizedCategoryAttribute("category_database")> <LocalizedCategoryAttribute("category_database")>
<LocalizedDescriptionAttribute("desc_sqlcommand")> <LocalizedDescriptionAttribute("desc_sqlcommand")>
Public Property SQLCommand() As SQLValue Public Property SQLCommand() As SQLValue

View File

@@ -167,7 +167,7 @@ Public Class ClassControlValues
Dim groupbox As GroupBox = DirectCast(control, GroupBox) Dim groupbox As GroupBox = DirectCast(control, GroupBox)
LoadControlValues(RecordId, ParentRecordId, FormId, groupbox.Controls) LoadControlValues(RecordId, ParentRecordId, FormId, groupbox.Controls)
Else Else
LoadControlValueNeu(RecordId, ParentRecordId, ControlId, control, value) LoadControlValue(RecordId, ParentRecordId, ControlId, control, value)
End If End If
Next Next
@@ -178,7 +178,7 @@ Public Class ClassControlValues
End Sub End Sub
Private Shared Sub LoadControlValueNeu(recordId As Integer, parentRecordId As Integer, controlId As Integer, control As Control, value As Object) Private Shared Sub LoadControlValue(recordId As Integer, parentRecordId As Integer, controlId As Integer, control As Control, value As Object)
Try Try
Select Case control.GetType() Select Case control.GetType()
Case GetType(TextBox) Case GetType(TextBox)

View File

@@ -409,6 +409,8 @@ Public Class frmFormInput
' SelectedFormID = RowView.Item(1) ' SelectedFormID = RowView.Item(1)
RefreshRecordByID(SelectedRecordID) RefreshRecordByID(SelectedRecordID)
ClassControlValues.LoadControlValuesList(thisformid, pnlView.Controls)
ClassControlValues.LoadControlValuesListWithPlaceholders(thisformid, SelectedRecordID, CURRENT_PARENT_ID, pnlView.Controls)
ClassControlValues.LoadControlValues(SelectedRecordID, CURRENT_PARENT_ID, thisformid, pnlView.Controls) ClassControlValues.LoadControlValues(SelectedRecordID, CURRENT_PARENT_ID, thisformid, pnlView.Controls)
End If End If
load_Documents() load_Documents()
@@ -457,6 +459,8 @@ Public Class frmFormInput
Private Sub tsButtonAdd_Click(sender As Object, e As EventArgs) Handles tsButtonAdd.Click Private Sub tsButtonAdd_Click(sender As Object, e As EventArgs) Handles tsButtonAdd.Click
'CtrlCommandUI.LoadControls(thisformid) 'CtrlCommandUI.LoadControls(thisformid)
ClassControlValues.UnloadControlValuesList(SelectedRecordID, thisformid, pnlView.Controls)
ClassControlValues.LoadControlValuesList(thisformid, pnlView.Controls)
ClassControlValues.LoadDefaultValues(thisformid, SelectedRecordID, pnlView.Controls) ClassControlValues.LoadDefaultValues(thisformid, SelectedRecordID, pnlView.Controls)
'Das Flag INSERT nach LoadControls setzen 'Das Flag INSERT nach LoadControls setzen