jj_27_01_16
This commit is contained in:
@@ -46,8 +46,8 @@ Public Class ClassControlValues
|
||||
End If
|
||||
|
||||
Case GetType(DevExpress.XtraEditors.CheckedListBoxControl)
|
||||
Dim checkedlistbox As DevExpress.XtraEditors.CheckedListBoxControl = DirectCast(control, DevExpress.XtraEditors.CheckedListBoxControl)
|
||||
If checkedlistbox.SelectedItems.Count = 0 Then
|
||||
Dim checkedlistbox = DirectCast(control, DevExpress.XtraEditors.CheckedListBoxControl)
|
||||
If checkedlistbox.CheckedItemsCount = 0 Then
|
||||
Return False
|
||||
Else
|
||||
Return True
|
||||
@@ -62,15 +62,54 @@ Public Class ClassControlValues
|
||||
End If
|
||||
|
||||
Case Else
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">> Sub LoadControlValue - Control-Type nicht berücksichtigt: " & GetType(Control).ToString(), False)
|
||||
Return True
|
||||
End Select
|
||||
|
||||
End Function
|
||||
|
||||
' Überprüft, welche Controls "Required" sind
|
||||
Public Shared Function CheckRequiredControlValues(controls As Control.ControlCollection) As List(Of String)
|
||||
Public Shared Function CheckRequiredControlValues(controls As Control.ControlCollection, Optional isGroupbox As Boolean = False) As List(Of String)
|
||||
Dim missingValues As New List(Of String)
|
||||
|
||||
'If isGroupbox = True Then
|
||||
' Dim radiobuttons As New List(Of RadioButton)
|
||||
' Dim otherControls As New List(Of Control)
|
||||
|
||||
' ' Nach allen Radiobuttons suchen
|
||||
' For Each c As Control In controls
|
||||
' If TypeOf c Is RadioButton Then
|
||||
' radiobuttons.Add(DirectCast(c, RadioButton))
|
||||
' Else
|
||||
' otherControls.Add(c)
|
||||
' End If
|
||||
' Next
|
||||
|
||||
' ' Wenn mindestens 1 MussFeld-Radiobutton in der Groupbox
|
||||
' Dim atLeastOneRadioButtonHasRequired = False
|
||||
' For Each rb As RadioButton In radiobuttons
|
||||
' If DirectCast(rb.Tag, ClassControlMetadata).Required = True Then
|
||||
' atLeastOneRadioButtonHasRequired = True
|
||||
' Exit For
|
||||
' End If
|
||||
' Next
|
||||
|
||||
|
||||
|
||||
' If atLeastOneRadioButtonHasRequired Then
|
||||
' ' Alle RadioButtons die angeklickt wurden (ist meistens einer :o)
|
||||
' Dim radioButtonsWithValue = (From rb As RadioButton In radiobuttons
|
||||
' Where ControlHasValue(rb)
|
||||
' Select rb.Name).ToArray()
|
||||
|
||||
' ' Wenn kein RadioButton angeklickt wurde, nehmen wir alle in einen String,
|
||||
' ' da GENAU EINER angeklickt werden MUSS
|
||||
' If radioButtonsWithValue Is Nothing Then
|
||||
' Dim missingValue As String = String.Join(", ", radiobuttons)
|
||||
' missingValues.Add(missingValue)
|
||||
' End If
|
||||
' End If
|
||||
'End If
|
||||
|
||||
For Each Control As Control In controls
|
||||
|
||||
Dim metadata = DirectCast(Control.Tag, ClassControlMetadata)
|
||||
@@ -78,11 +117,17 @@ Public Class ClassControlValues
|
||||
' Groupbox muss rekursiv überprüft werden
|
||||
If TypeOf Control Is GroupBox Then
|
||||
Dim groupbox As GroupBox = DirectCast(Control, GroupBox)
|
||||
Dim gbfields As List(Of String) = CheckRequiredControlValues(groupbox.Controls)
|
||||
Dim gbfields As List(Of String) = CheckRequiredControlValues(groupbox.Controls, True)
|
||||
missingValues.AddRange(gbfields)
|
||||
Continue For
|
||||
End If
|
||||
|
||||
'Radio Buttons müssen nicht überprüft werden, da eine RadioButton Group
|
||||
'immer ein Control mit Checked = true hat
|
||||
If TypeOf Control Is RadioButton Then
|
||||
Continue For
|
||||
End If
|
||||
|
||||
If IsNothing(metadata.Required) OrElse metadata.Required = False Then
|
||||
Continue For
|
||||
End If
|
||||
@@ -94,7 +139,7 @@ Public Class ClassControlValues
|
||||
|
||||
Next
|
||||
|
||||
Return missingValues
|
||||
Return missingValues.Distinct().ToList()
|
||||
End Function
|
||||
|
||||
Public Shared Sub LoadControlValues(RecordId As Integer, ParentRecordId As Integer, FormId As Integer, controls As Control.ControlCollection)
|
||||
|
||||
Reference in New Issue
Block a user