Validierungslogik verbessert und Fehleranzeige zentralisiert
Die Methode `Check_UpdateIndexe` wurde um einen optionalen Parameter `pRegularComplete` erweitert, um die Validierungslogik flexibler zu gestalten. Bedingungsprüfungen wurden angepasst, um die Validierung nur bei Bedarf durchzuführen. Fehlermeldungen für fehlende Eingaben wurden klarer formuliert. Die Methode `frmError.ShowDialog()` wurde durch `OpenfrmError(oErrMsgMissingInput)` ersetzt, um die Fehleranzeige zu zentralisieren. Der Aufruf von `Check_UpdateIndexe()` wurde angepasst, um in bestimmten Kontexten die Validierung zu deaktivieren.
This commit is contained in:
@@ -6994,7 +6994,7 @@ Public Class frmValidator
|
|||||||
Next
|
Next
|
||||||
Return odt
|
Return odt
|
||||||
End Function
|
End Function
|
||||||
Function Check_UpdateIndexe() As Boolean
|
Function Check_UpdateIndexe(Optional ByVal pRegularComplete As Boolean = True) As Boolean
|
||||||
Dim oControlName
|
Dim oControlName
|
||||||
Dim oControlId As String
|
Dim oControlId As String
|
||||||
Try
|
Try
|
||||||
@@ -7084,12 +7084,12 @@ Public Class frmValidator
|
|||||||
Case oControl.GetType = GetType(LookupControl3)
|
Case oControl.GetType = GetType(LookupControl3)
|
||||||
Try
|
Try
|
||||||
Dim lookup As LookupControl3 = oControl
|
Dim lookup As LookupControl3 = oControl
|
||||||
If lookup.Properties.SelectedValues.Count = 0 And oIsRequired = True Then
|
If lookup.Properties.SelectedValues.Count = 0 And oIsRequired = True And pRegularComplete Then
|
||||||
oMissing = True
|
oMissing = True
|
||||||
oErrMsgMissingInput = $"Kein Auswahl getroffen in LookupGrid '{oControl.Name}'"
|
oErrMsgMissingInput = $"Pflichtfeld: Keine Auswahl getroffen in LookupGrid '{oControl.Name}'"
|
||||||
MyValidationLogger.Warn($"⚠️ Kein Auswahl getroffen in LookupGrid '{oControl.Name}'")
|
MyValidationLogger.Warn($"⚠️ {oErrMsgMissingInput}")
|
||||||
oControl.BackColor = Color.Red
|
oControl.BackColor = Color.Red
|
||||||
frmError.ShowDialog()
|
OpenfrmError(oErrMsgMissingInput)
|
||||||
Exit For
|
Exit For
|
||||||
Else
|
Else
|
||||||
If lookup.Properties.MultiSelect = True Then
|
If lookup.Properties.MultiSelect = True Then
|
||||||
@@ -7144,10 +7144,11 @@ Public Class frmValidator
|
|||||||
Else
|
Else
|
||||||
' Single-Select Lookup
|
' Single-Select Lookup
|
||||||
oMyInput = lookup.Properties.SelectedValues.FirstOrDefault()
|
oMyInput = lookup.Properties.SelectedValues.FirstOrDefault()
|
||||||
If IsNothing(oMyInput) And oIsRequired = True Then
|
If IsNothing(oMyInput) And oIsRequired = True And pRegularComplete Then
|
||||||
oMissing = True
|
oMissing = True
|
||||||
oErrMsgMissingInput = $"Could not get FirstOrDefault-Value of LookUpGrid! - LookUPGridName: {lookup.Name}"
|
oErrMsgMissingInput = $"Could not get FirstOrDefault-Value of LookUpGrid! - LookUPGridName: {lookup.Name}"
|
||||||
MyValidationLogger.Warn(oErrMsgMissingInput)
|
MyValidationLogger.Warn(oErrMsgMissingInput)
|
||||||
|
OpenfrmError(oErrMsgMissingInput)
|
||||||
Exit For
|
Exit For
|
||||||
ElseIf IsNothing(oMyInput) And oIsRequired = False Then
|
ElseIf IsNothing(oMyInput) And oIsRequired = False Then
|
||||||
For Each ochangedLookub In listChangedLookup
|
For Each ochangedLookub In listChangedLookup
|
||||||
@@ -7279,7 +7280,7 @@ Public Class frmValidator
|
|||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If Check_Missing_Control_Value(oControl, "txt") = True And oIsRequired = True Then
|
If Check_Missing_Control_Value(oControl, "txt") = True And oIsRequired = True And pRegularComplete Then
|
||||||
oMissing = True
|
oMissing = True
|
||||||
oErrMsgMissingInput = oWrongInputMessage & " textbox '" & oControl.Name & "'"
|
oErrMsgMissingInput = oWrongInputMessage & " textbox '" & oControl.Name & "'"
|
||||||
MyValidationLogger.Warn(oErrMsgMissingInput)
|
MyValidationLogger.Warn(oErrMsgMissingInput)
|
||||||
@@ -7409,7 +7410,7 @@ Public Class frmValidator
|
|||||||
Try
|
Try
|
||||||
MyValidationLogger.Debug($"Working on Combobox...")
|
MyValidationLogger.Debug($"Working on Combobox...")
|
||||||
Dim cmb As Windows.Forms.ComboBox = oControl
|
Dim cmb As Windows.Forms.ComboBox = oControl
|
||||||
If cmb.SelectedIndex = -1 And oIsRequired = True Then
|
If cmb.SelectedIndex = -1 And oIsRequired = True And pRegularComplete Then
|
||||||
oMissing = True
|
oMissing = True
|
||||||
oErrMsgMissingInput = "Please Choose an entry out of ComboBox '" & cmb.Name & "'"
|
oErrMsgMissingInput = "Please Choose an entry out of ComboBox '" & cmb.Name & "'"
|
||||||
MyValidationLogger.Warn(oErrMsgMissingInput)
|
MyValidationLogger.Warn(oErrMsgMissingInput)
|
||||||
@@ -7544,7 +7545,7 @@ Public Class frmValidator
|
|||||||
Case oControl.GetType = GetType(DateTimePicker)
|
Case oControl.GetType = GetType(DateTimePicker)
|
||||||
Try
|
Try
|
||||||
Dim dtp As DateTimePicker = oControl
|
Dim dtp As DateTimePicker = oControl
|
||||||
If oIsRequired = True And dtp.Value.ToString = String.Empty Then
|
If oIsRequired = True And dtp.Value.ToString = String.Empty And pRegularComplete Then
|
||||||
oMissing = True
|
oMissing = True
|
||||||
oErrMsgMissingInput = "Please Choose DateValue for field'" & dtp.Name & "'"
|
oErrMsgMissingInput = "Please Choose DateValue for field'" & dtp.Name & "'"
|
||||||
MyValidationLogger.Warn(oErrMsgMissingInput)
|
MyValidationLogger.Warn(oErrMsgMissingInput)
|
||||||
@@ -7640,7 +7641,7 @@ Public Class frmValidator
|
|||||||
Dim chk As CheckBox = oControl
|
Dim chk As CheckBox = oControl
|
||||||
oMyInput = chk.Checked.ToString
|
oMyInput = chk.Checked.ToString
|
||||||
|
|
||||||
If chk.CheckState = CheckState.Indeterminate And oIsRequired = True Then
|
If chk.CheckState = CheckState.Indeterminate And oIsRequired = True And pRegularComplete Then
|
||||||
oMissing = True
|
oMissing = True
|
||||||
oErrMsgMissingInput = "Please set Checkbox value for field '" & chk.Name & "'"
|
oErrMsgMissingInput = "Please set Checkbox value for field '" & chk.Name & "'"
|
||||||
MyValidationLogger.Warn(oErrMsgMissingInput)
|
MyValidationLogger.Warn(oErrMsgMissingInput)
|
||||||
@@ -7758,7 +7759,7 @@ Public Class frmValidator
|
|||||||
Zeilen += 1
|
Zeilen += 1
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
If oIsRequired = True And Zeilen = 0 Then
|
If oIsRequired = True And Zeilen = 0 And pRegularComplete Then
|
||||||
oMissing = True
|
oMissing = True
|
||||||
oErrMsgMissingInput = "Fehlende Eingabe in Vektorfeld '" & dgv.Name & "'"
|
oErrMsgMissingInput = "Fehlende Eingabe in Vektorfeld '" & dgv.Name & "'"
|
||||||
MyValidationLogger.Warn(oErrMsgMissingInput)
|
MyValidationLogger.Warn(oErrMsgMissingInput)
|
||||||
@@ -8701,7 +8702,7 @@ Public Class frmValidator
|
|||||||
ShowOverlaySafe() ' ✅ Overlay hier öffnen
|
ShowOverlaySafe() ' ✅ Overlay hier öffnen
|
||||||
Try
|
Try
|
||||||
' ========== FIX 2: Nur EINEN Check-Aufruf ==========
|
' ========== FIX 2: Nur EINEN Check-Aufruf ==========
|
||||||
If Check_UpdateIndexe() = True Then
|
If Check_UpdateIndexe(False) = True Then
|
||||||
SetStatusLabel("Data saved", "LimeGreen")
|
SetStatusLabel("Data saved", "LimeGreen")
|
||||||
MyValidationLogger.Info("Workflowdata saved manually!")
|
MyValidationLogger.Info("Workflowdata saved manually!")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user