JJ 21.04.16
This commit is contained in:
parent
b13468f42c
commit
012b5d20db
@ -148,16 +148,22 @@ 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 SQL As String = String.Format("SELECT GUID, SQL_COMMAND_1 FROM TBPMO_CONTROL WHERE SQL_COMMAND_1 LIKE '%@{0}@%'", controlId)
|
||||||
Dim value
|
Dim value
|
||||||
|
|
||||||
Select Case control.GetType()
|
' Diese Befehle führen dazu, dass auch der ValueMember als Wert ausgelesen wird
|
||||||
Case GetType(CustomComboBox)
|
' Das kann zu unerwarteten Ergebnissen führen, da der Benutzer nur den DisplayMember sieht.
|
||||||
If IsNothing(DirectCast(control, CustomComboBox).ValueMember) Then
|
'Select Case control.GetType()
|
||||||
value = DirectCast(control, CustomComboBox).Text
|
' Case GetType(CustomComboBox)
|
||||||
Else
|
' If IsNothing(DirectCast(control, CustomComboBox).ValueMember) Then
|
||||||
value = DirectCast(control, CustomComboBox).SelectedValue
|
' value = DirectCast(control, CustomComboBox).Text
|
||||||
End If
|
' Else
|
||||||
Case Else
|
' value = DirectCast(control, CustomComboBox).SelectedValue
|
||||||
Exit Sub
|
' End If
|
||||||
End Select
|
' 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
|
If String.IsNullOrEmpty(value) Then
|
||||||
Exit Sub
|
Exit Sub
|
||||||
@ -191,9 +197,8 @@ Public Class ClassControlBuilder
|
|||||||
sqlcommand = sqlcommand.Replace(match.Groups(1).Value, value)
|
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))
|
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 dt As DataTable = ClassDatabase.Return_Datatable(sqlcommand)
|
||||||
Dim obj
|
Dim type = dependingControl.GetType().Name
|
||||||
obj = dependingControl.GetType.ToString
|
Select Case type
|
||||||
Select Case dependingControl.GetType().Name
|
|
||||||
|
|
||||||
Case "CustomComboBox"
|
Case "CustomComboBox"
|
||||||
ControlLoader.Combobox.SetDataSource(DirectCast(dependingControl, CustomComboBox), dt)
|
ControlLoader.Combobox.SetDataSource(DirectCast(dependingControl, CustomComboBox), dt)
|
||||||
|
|||||||
@ -479,7 +479,16 @@ Public Class ClassControlValues
|
|||||||
|
|
||||||
Case GetType(DataGridView)
|
Case GetType(DataGridView)
|
||||||
Dim dgv As DataGridView = DirectCast(control, DataGridView)
|
Dim dgv As DataGridView = DirectCast(control, DataGridView)
|
||||||
dgv.Rows.Clear()
|
Dim ds = dgv.DataSource
|
||||||
|
|
||||||
|
If (IsNothing(ds)) Then
|
||||||
|
dgv.Rows.Clear()
|
||||||
|
dgv.Refresh()
|
||||||
|
Else
|
||||||
|
dgv.DataSource = Nothing
|
||||||
|
dgv.Refresh()
|
||||||
|
End If
|
||||||
|
Console.WriteLine("Clearing DataGridView")
|
||||||
|
|
||||||
End Select
|
End Select
|
||||||
End Sub
|
End Sub
|
||||||
@ -488,7 +497,7 @@ Public Class ClassControlValues
|
|||||||
#Region "LoadDefaultValue"
|
#Region "LoadDefaultValue"
|
||||||
Public Shared Sub LoadDefaultValues(FormID As Integer, RecordID As Integer, controls As Control.ControlCollection)
|
Public Shared Sub LoadDefaultValues(FormID As Integer, RecordID As Integer, controls As Control.ControlCollection)
|
||||||
'' Zuerst alle Controls leeren
|
'' Zuerst alle Controls leeren
|
||||||
'ClearControlValues(controls)
|
ClearControlValues(controls)
|
||||||
|
|
||||||
Dim i = 0
|
Dim i = 0
|
||||||
For Each control As Control In controls
|
For Each control As Control In controls
|
||||||
|
|||||||
@ -24,13 +24,14 @@
|
|||||||
If e.Index >= 0 Then
|
If e.Index >= 0 Then
|
||||||
Dim label As String
|
Dim label As String
|
||||||
|
|
||||||
|
' Wenn die Items eine Static List ist, wird der String ausgelesen
|
||||||
If (Me.Items(e.Index).GetType() = GetType(String)) Then
|
If (Me.Items(e.Index).GetType() = GetType(String)) Then
|
||||||
label = Me.Items(e.Index).ToString()
|
label = Me.Items(e.Index).ToString()
|
||||||
Else
|
Else
|
||||||
|
'Wenn die Items aus einer Datatable kommen, wird der DisplayMember ausgelesen
|
||||||
Dim rowView As DataRowView = Me.Items(e.Index)
|
Dim rowView As DataRowView = Me.Items(e.Index)
|
||||||
Dim rowCount As Integer = rowView.Row.ItemArray.Count
|
Dim rowCount As Integer = rowView.Row.ItemArray.Count
|
||||||
|
|
||||||
|
|
||||||
If rowCount = 1 Then
|
If rowCount = 1 Then
|
||||||
label = rowView.Item(0)
|
label = rowView.Item(0)
|
||||||
ElseIf rowCount = 2 Then
|
ElseIf rowCount = 2 Then
|
||||||
|
|||||||
@ -720,7 +720,8 @@ Public Class frmConstructor_Main
|
|||||||
RIGHT_ONLY_READ = False
|
RIGHT_ONLY_READ = False
|
||||||
End Try
|
End Try
|
||||||
If RIGHT_ONLY_READ = True Then
|
If RIGHT_ONLY_READ = True Then
|
||||||
tsButtonAdd.Enabled = False
|
' Hinzufügen sollte auch bei RIGHT_ONLY_READ verfügbar sein
|
||||||
|
tsButtonAdd.Enabled = True
|
||||||
tsButtonEdit.Enabled = False
|
tsButtonEdit.Enabled = False
|
||||||
tsButtonSave.Enabled = False
|
tsButtonSave.Enabled = False
|
||||||
tsButtonDelete.Enabled = False
|
tsButtonDelete.Enabled = False
|
||||||
@ -1155,6 +1156,8 @@ Public Class frmConstructor_Main
|
|||||||
ClassControlValues.LoadDefaultValues(ENTITY_ID, SELECTED_RECORD_ID, pnlDetails.Controls)
|
ClassControlValues.LoadDefaultValues(ENTITY_ID, SELECTED_RECORD_ID, pnlDetails.Controls)
|
||||||
' Im gegensatz zu EnableEditMode muss hier nur der save button enabled werden
|
' Im gegensatz zu EnableEditMode muss hier nur der save button enabled werden
|
||||||
tsButtonSave.Enabled = True
|
tsButtonSave.Enabled = True
|
||||||
|
' Muss aktiviert werden, sonst funktionieren die Combobox Abhängigkeits Events nicht
|
||||||
|
CURRENT_RECORD_ENABLED = True
|
||||||
EDIT_STATE = EditState.Insert
|
EDIT_STATE = EditState.Insert
|
||||||
RECORD_CHANGED = True
|
RECORD_CHANGED = True
|
||||||
tsslblRecord.Text = "Adding record ......"
|
tsslblRecord.Text = "Adding record ......"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user