MS_22042016
This commit is contained in:
@@ -76,6 +76,7 @@ Public Class ClassControlBuilder
|
||||
|
||||
Public Sub MouseHover(sender As Object, e As EventArgs)
|
||||
Dim onMouseHoverHandler As EventHandler = CType(Me.Events(_onMouseHoverName), EventHandler)
|
||||
|
||||
If onMouseHoverHandler IsNot Nothing Then
|
||||
onMouseHoverHandler.Invoke(sender, e)
|
||||
End If
|
||||
@@ -147,16 +148,20 @@ Public Class ClassControlBuilder
|
||||
Dim SQL As String = String.Format("SELECT GUID, SQL_COMMAND_1 FROM TBPMO_CONTROL WHERE SQL_COMMAND_1 LIKE '%@{0}@%'", controlId)
|
||||
Dim value
|
||||
|
||||
Select Case control.GetType()
|
||||
Case GetType(CustomComboBox)
|
||||
If IsNothing(DirectCast(control, CustomComboBox).ValueMember) Then
|
||||
value = DirectCast(control, CustomComboBox).Text
|
||||
Else
|
||||
value = DirectCast(control, CustomComboBox).SelectedValue
|
||||
End If
|
||||
Case Else
|
||||
Exit Sub
|
||||
End Select
|
||||
' Diese Befehle führen dazu, dass auch der ValueMember als Wert ausgelesen wird
|
||||
' Das kann zu unerwarteten Ergebnissen führen, da der Benutzer nur den DisplayMember sieht.
|
||||
'Select Case control.GetType()
|
||||
' Case GetType(CustomComboBox)
|
||||
' If IsNothing(DirectCast(control, CustomComboBox).ValueMember) Then
|
||||
' value = DirectCast(control, CustomComboBox).Text
|
||||
' Else
|
||||
' value = DirectCast(control, CustomComboBox).SelectedValue
|
||||
' End If
|
||||
' Case Else
|
||||
' Exit Sub
|
||||
'End Select
|
||||
' Die bessere Lösung ist für jetzt, einfach den angezeigten Wert auszulesen:
|
||||
value = DirectCast(control, CustomComboBox).Text
|
||||
|
||||
If String.IsNullOrEmpty(value) Then
|
||||
Exit Sub
|
||||
@@ -175,10 +180,24 @@ Public Class ClassControlBuilder
|
||||
Continue For
|
||||
End If
|
||||
|
||||
sqlcommand = sqlcommand.ToUpper.Replace("@RECORD_ID", CURRENT_RECORD_ID)
|
||||
Dim regex As New System.Text.RegularExpressions.Regex("(@(\d+)@)")
|
||||
Dim match As System.Text.RegularExpressions.Match = regex.Match(sqlcommand)
|
||||
|
||||
If match.Success Then
|
||||
Dim sqlguid = String.Format("SELECT GUID FROM TBPMO_CONTROL_VALUE WHERE CONTROL_ID = {0} AND RECORD_ID = {1}", controlId, CURRENT_RECORD_ID)
|
||||
Dim ctrlvalID = ClassDatabase.Execute_Scalar(sqlguid)
|
||||
If Not IsNothing(ctrlvalID) Then
|
||||
Dim upd1 = String.Format("UPDATE TBPMO_CONTROL_VALUE SET VALUE = '{0}' WHERE CONTROL_ID = {1} AND RECORD_ID = {2}", value.ToString, controlId, CURRENT_RECORD_ID)
|
||||
ClassDatabase.Execute_non_Query(upd1)
|
||||
Else
|
||||
Dim ins = String.Format("INSERT INTO TBPMO_CONTROL_VALUE (CONTROL_ID,RECORD_ID,VALUE,ADDED_WHO) VALUES ({0},{1},'{2}','{3}')", controlId, CURRENT_RECORD_ID, value, Environment.UserName)
|
||||
If ClassDatabase.Execute_non_Query(ins) = True Then
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Value was nothing - Inserted the ControlValue '" & ins & "'")
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
' 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)
|
||||
@@ -189,19 +208,52 @@ Public Class ClassControlBuilder
|
||||
|
||||
sqlcommand = sqlcommand.Replace(match.Groups(1).Value, value)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> " & String.Format("Executing SQL_COMMAND: '{0}' for controlID '{1}'", sqlcommand, dependingControlId))
|
||||
Dim dt As DataTable = ClassDatabase.Return_Datatable(sqlcommand)
|
||||
Dim obj
|
||||
obj = dependingControl.GetType.ToString
|
||||
Select Case dependingControl.GetType().Name
|
||||
|
||||
Case "ComboBox"
|
||||
Dim dt As DataTable = ClassDatabase.Return_Datatable(sqlcommand)
|
||||
Dim type = dependingControl.GetType().Name
|
||||
Select Case type
|
||||
Case "DateEdit"
|
||||
If dt.Rows.Count = 1 Then
|
||||
Try
|
||||
Dim dateValue As String = dt.Rows(0).Item(0)
|
||||
If dateValue = "1900-01-01" Then
|
||||
Continue For
|
||||
End If
|
||||
ControlLoader.DateTimePicker.LoadValue(dependingControl, dateValue)
|
||||
Dim sql1 = String.Format("SELECT GUID FROM TBPMO_CONTROL_VALUE WHERE CONTROL_ID = {0} AND RECORD_ID = {1}", dependingControlId, CURRENT_RECORD_ID)
|
||||
Dim id = ClassDatabase.Execute_Scalar(sql1)
|
||||
|
||||
If Not IsNothing(id) Then
|
||||
Dim upd = String.Format("UPDATE TBPMO_CONTROL_VALUE SET VALUE = '{0}' WHERE GUID = {1}", dateValue, id)
|
||||
If ClassDatabase.Execute_non_Query(upd) = True Then
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Value was not nothing - Updated the ControlValue '" & upd)
|
||||
Else
|
||||
ClassLogger.Add(" >> Check Update depending control value as it was nothing and Update was not successful - Update-Command '" & upd & "'")
|
||||
End If
|
||||
|
||||
Else
|
||||
Dim ins = String.Format("INSERT INTO TBPMO_CONTROL_VALUE (CONTROL_ID,RECORD_ID,VALUE,ADDED_WHO) VALUES ({0},{1},'{2}','{3}')", dependingControlId, CURRENT_RECORD_ID, dateValue, Environment.UserName)
|
||||
If ClassDatabase.Execute_non_Query(ins) = True Then
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Value was nothing - Inserted the ControlValue '" & ins & "'")
|
||||
Else
|
||||
ClassLogger.Add(" >> Check Insert depending control value as it was nothing and Insert was not successful- Insert-Command '" & ins & "'")
|
||||
End If
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add("Unexpectet Error in OnComboBoxValueChanged - TextBox: " & ex.Message, True)
|
||||
End Try
|
||||
Else
|
||||
ClassLogger.Add(" >> Attention: RowCount for depending control was '" & dt.Rows.Count.ToString & "' and not 1 as expected - Check SQL: '" & sqlcommand & "'")
|
||||
End If
|
||||
Case "CustomComboBox"
|
||||
ControlLoader.Combobox.SetDataSource(DirectCast(dependingControl, CustomComboBox), dt)
|
||||
Case "Label"
|
||||
If dt.Rows.Count = 1 Then
|
||||
Try
|
||||
ControlLoader.Label.LoadValue(DirectCast(dependingControl, Label), 9999, 9999, dt.Rows(0).Item(0).ToString, True)
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add(ex.Message)
|
||||
ClassLogger.Add("Unexpectet Error in OnComboBoxValueChanged - Label: " & ex.Message, True)
|
||||
End Try
|
||||
End If
|
||||
Case "TextBox"
|
||||
@@ -214,7 +266,7 @@ Public Class ClassControlBuilder
|
||||
|
||||
If Not IsNothing(id) Then
|
||||
Dim upd = String.Format("UPDATE TBPMO_CONTROL_VALUE SET VALUE = '{0}' WHERE GUID = {1}", value1, id)
|
||||
If ClassDatabase.Execute_non_Query(sql1) = True Then
|
||||
If ClassDatabase.Execute_non_Query(upd) = True Then
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Value was not nothing - Updated the ControlValue '" & upd)
|
||||
Else
|
||||
ClassLogger.Add(" >> Check Update depending control value as it was nothing and Update was not successful - Update-Command '" & upd & "'")
|
||||
@@ -230,7 +282,7 @@ Public Class ClassControlBuilder
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add(ex.Message)
|
||||
ClassLogger.Add("Unexpectet Error in OnComboBoxValueChanged - TextBox: " & ex.Message, True)
|
||||
End Try
|
||||
Else
|
||||
ClassLogger.Add(" >> Attention: RowCount for depending control was '" & dt.Rows.Count.ToString & "' and not 1 as expected - Check SQL: '" & sqlcommand & "'")
|
||||
@@ -312,7 +364,7 @@ Public Class ClassControlBuilder
|
||||
AddHandler textbox.TextChanged, AddressOf OnTextBoxTextChanged
|
||||
AddHandler textbox.ReadOnlyChanged, AddressOf OnReadOnlyChanged
|
||||
|
||||
Case "ComboBox"
|
||||
Case "CustomComboBox"
|
||||
Dim combo As CustomComboBox = CType(control, CustomComboBox)
|
||||
AddHandler combo.SelectedValueChanged, AddressOf RecordChanged
|
||||
AddHandler combo.SelectedValueChanged, AddressOf OnComboBoxValueChanged
|
||||
@@ -603,7 +655,7 @@ Public Class ClassControlBuilder
|
||||
Select Case CurrentType
|
||||
Case "TextBox"
|
||||
ActiveControl.BackColor = ActiveColor
|
||||
Case "ComboBox"
|
||||
Case "CustomComboBox"
|
||||
'Case "System.Windows.Forms.ComboBox"
|
||||
ActiveControl.BackColor = ActiveColor
|
||||
Case "Label"
|
||||
@@ -635,7 +687,7 @@ Public Class ClassControlBuilder
|
||||
Select Case Type
|
||||
Case "TextBox"
|
||||
inctrl.BackColor = Color.White
|
||||
Case "ComboBox"
|
||||
Case "CustomComboBox"
|
||||
'Case "System.Windows.Forms.ComboBox"
|
||||
inctrl.BackColor = Color.White
|
||||
Case "Label"
|
||||
@@ -664,7 +716,7 @@ Public Class ClassControlBuilder
|
||||
Select Case gbType
|
||||
Case "TextBox"
|
||||
gbctrl.BackColor = Color.White
|
||||
Case "ComboBox"
|
||||
Case "CustomComboBox"
|
||||
'Case "System.Windows.Forms.ComboBox"
|
||||
gbctrl.BackColor = Color.White
|
||||
Case "Label"
|
||||
|
||||
Reference in New Issue
Block a user