MS_27012016

This commit is contained in:
SchreiberM
2016-01-27 15:24:40 +01:00
5 changed files with 66 additions and 7 deletions

View File

@@ -218,6 +218,8 @@
DEFAULTVALUE = properties.DefaultValue DEFAULTVALUE = properties.DefaultValue
ElseIf type = "DateEdit" Then ElseIf type = "DateEdit" Then
DEFAULTVALUE = ClassConverter.ToDateTimePickerOptionsOrDefault(properties.DefaultValue) DEFAULTVALUE = ClassConverter.ToDateTimePickerOptionsOrDefault(properties.DefaultValue)
ElseIf type = "TextBox" Then
DEFAULTVALUE = properties.DefaultValue
End If End If
If type = "TextBox" OrElse If type = "TextBox" OrElse

View File

@@ -46,8 +46,8 @@ Public Class ClassControlValues
End If End If
Case GetType(DevExpress.XtraEditors.CheckedListBoxControl) Case GetType(DevExpress.XtraEditors.CheckedListBoxControl)
Dim checkedlistbox As DevExpress.XtraEditors.CheckedListBoxControl = DirectCast(control, DevExpress.XtraEditors.CheckedListBoxControl) Dim checkedlistbox = DirectCast(control, DevExpress.XtraEditors.CheckedListBoxControl)
If checkedlistbox.SelectedItems.Count = 0 Then If checkedlistbox.CheckedItemsCount = 0 Then
Return False Return False
Else Else
Return True Return True
@@ -62,15 +62,54 @@ Public Class ClassControlValues
End If End If
Case Else Case Else
If LogErrorsOnly = False Then ClassLogger.Add(">> Sub LoadControlValue - Control-Type nicht berücksichtigt: " & GetType(Control).ToString(), False) Return True
End Select End Select
End Function End Function
' Überprüft, welche Controls "Required" sind ' Ü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) 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 For Each Control As Control In controls
Dim metadata = DirectCast(Control.Tag, ClassControlMetadata) Dim metadata = DirectCast(Control.Tag, ClassControlMetadata)
@@ -78,11 +117,17 @@ Public Class ClassControlValues
' Groupbox muss rekursiv überprüft werden ' Groupbox muss rekursiv überprüft werden
If TypeOf Control Is GroupBox Then If TypeOf Control Is GroupBox Then
Dim groupbox As GroupBox = DirectCast(Control, GroupBox) 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) missingValues.AddRange(gbfields)
Continue For Continue For
End If 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 If IsNothing(metadata.Required) OrElse metadata.Required = False Then
Continue For Continue For
End If End If
@@ -94,7 +139,7 @@ Public Class ClassControlValues
Next Next
Return missingValues Return missingValues.Distinct().ToList()
End Function End Function
Public Shared Sub LoadControlValues(RecordId As Integer, ParentRecordId As Integer, FormId As Integer, controls As Control.ControlCollection) Public Shared Sub LoadControlValues(RecordId As Integer, ParentRecordId As Integer, FormId As Integer, controls As Control.ControlCollection)

View File

@@ -11,6 +11,14 @@
Empty = 1 Empty = 1
End Enum End Enum
Public Function NotNull(Of T)(ByVal value As T, ByVal defaultValue As T) As T
If value Is Nothing OrElse String.IsNullOrEmpty(value.ToString) OrElse IsDBNull(value) Then
Return defaultValue
Else
Return value
End If
End Function
Public Function BoolToInt(bool As Boolean) As Integer Public Function BoolToInt(bool As Boolean) As Integer
' Wandelt einen Boolean Wert in einen Int um ' Wandelt einen Boolean Wert in einen Int um
Return IIf(bool, 1, 0) Return IIf(bool, 1, 0)

View File

@@ -1179,6 +1179,8 @@ Public Class frmForm_Constructor_Main_2
Update_Status_Label(True, "Der Datensatz '" & SELECTED_RECORD_ID & "' wurde erfolgreich gelöscht - " & Now, EditState.Update) Update_Status_Label(True, "Der Datensatz '" & SELECTED_RECORD_ID & "' wurde erfolgreich gelöscht - " & Now, EditState.Update)
Update_Record_Label(SELECTED_RECORD_ID) Update_Record_Label(SELECTED_RECORD_ID)
Load_Tree_View_Data() Load_Tree_View_Data()
' Nach dem löschen muss die aktuelle Ansicht neugeladen werden
Load_Entity_Data(ACT_EBENE)
DisableEditMode() DisableEditMode()
End If End If
End If End If

View File

@@ -97,7 +97,8 @@
props.DefaultValue = ClassConverter.ToBooleanOrDefault(row.Item("CONTROL_DEF_VALUE")) props.DefaultValue = ClassConverter.ToBooleanOrDefault(row.Item("CONTROL_DEF_VALUE"))
Case "Datepicker" Case "Datepicker"
props = New DateTimePickerProperties() props = New DateTimePickerProperties()
props.DefaultValue = ClassConverter.ToDateTimePickerOptionsOrDefault(row.Item("CONTROL_DEF_VALUE")) props.DefaultValue = NotNull(row.Item("CONTROL_DEF_VALUE"), EnumDateTimePickerDefaultValueOptions.Empty)
'props.DefaultValue = ClassConverter.ToDateTimePickerOptionsOrDefault(row.Item("CONTROL_DEF_VALUE"))
Case "Datagridview" Case "Datagridview"
props = New DataGridViewProperties() props = New DataGridViewProperties()
Case "Groupbox" Case "Groupbox"
@@ -110,6 +111,7 @@
props = New RadioButtonProperties() props = New RadioButtonProperties()
props.Caption = row.Item("CTRLSCR_CAPTION") props.Caption = row.Item("CTRLSCR_CAPTION")
props.DefaultValue = ClassConverter.ToBooleanOrDefault(row.Item("CONTROL_DEF_VALUE")) props.DefaultValue = ClassConverter.ToBooleanOrDefault(row.Item("CONTROL_DEF_VALUE"))
props.IsRequired = row.Item("CONTROL_REQUIRED")
Case "F_AddAppointment" Case "F_AddAppointment"
props = New FunctionAddAppointment() props = New FunctionAddAppointment()
Case "F_AddFormData" Case "F_AddFormData"