jj_26_01_16_version_2.4.4.0
This commit is contained in:
@@ -2,6 +2,100 @@
|
||||
|
||||
Public Class ClassControlValues
|
||||
|
||||
Public Shared Function ControlHasValue(control As Control) As Boolean
|
||||
|
||||
Select Case control.GetType()
|
||||
Case GetType(TextBox)
|
||||
Dim textbox As TextBox = DirectCast(control, TextBox)
|
||||
If textbox.Text.Trim() = String.Empty Then
|
||||
Return False
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
|
||||
Case GetType(ComboBox)
|
||||
Dim combobox As ComboBox = DirectCast(control, ComboBox)
|
||||
If combobox.Text.Trim() = String.Empty Then
|
||||
Return False
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
|
||||
Case GetType(CheckBox)
|
||||
Dim checkbox As CheckBox = DirectCast(control, CheckBox)
|
||||
Return checkbox.Checked
|
||||
|
||||
Case GetType(RadioButton)
|
||||
Dim radiobutton As RadioButton = DirectCast(control, RadioButton)
|
||||
Return radiobutton.Checked
|
||||
|
||||
Case GetType(DevExpress.XtraEditors.DateEdit)
|
||||
Dim datepicker As DevExpress.XtraEditors.DateEdit = DirectCast(control, DevExpress.XtraEditors.DateEdit)
|
||||
If IsDBNull(datepicker.EditValue) Then
|
||||
Return False
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
|
||||
Case GetType(DevExpress.XtraEditors.ListBoxControl)
|
||||
Dim listbox As DevExpress.XtraEditors.ListBoxControl = DirectCast(control, DevExpress.XtraEditors.ListBoxControl)
|
||||
If listbox.SelectedIndex = -1 Then
|
||||
Return False
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
|
||||
Case GetType(DevExpress.XtraEditors.CheckedListBoxControl)
|
||||
Dim checkedlistbox As DevExpress.XtraEditors.CheckedListBoxControl = DirectCast(control, DevExpress.XtraEditors.CheckedListBoxControl)
|
||||
If checkedlistbox.SelectedItems.Count = 0 Then
|
||||
Return False
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
|
||||
Case GetType(PictureBox)
|
||||
Dim picturebox = DirectCast(control, PictureBox)
|
||||
If IsNothing(picturebox.BackgroundImage) Then
|
||||
Return False
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
|
||||
Case Else
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">> Sub LoadControlValue - Control-Type nicht berücksichtigt: " & GetType(Control).ToString(), False)
|
||||
End Select
|
||||
|
||||
End Function
|
||||
|
||||
' Überprüft, welche Controls "Required" sind
|
||||
Public Shared Function CheckRequiredControlValues(controls As Control.ControlCollection) As List(Of String)
|
||||
Dim missingValues As New List(Of String)
|
||||
|
||||
For Each Control As Control In controls
|
||||
|
||||
Dim metadata = DirectCast(Control.Tag, ClassControlMetadata)
|
||||
|
||||
' 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)
|
||||
missingValues.AddRange(gbfields)
|
||||
Continue For
|
||||
End If
|
||||
|
||||
If IsNothing(metadata.Required) OrElse metadata.Required = False Then
|
||||
Continue For
|
||||
End If
|
||||
|
||||
If Not ControlHasValue(Control) Then
|
||||
missingValues.Add(Control.Name)
|
||||
End If
|
||||
|
||||
|
||||
Next
|
||||
|
||||
Return missingValues
|
||||
End Function
|
||||
|
||||
Public Shared Sub LoadControlValues(RecordId As Integer, ParentRecordId As Integer, FormId As Integer, controls As Control.ControlCollection)
|
||||
Try
|
||||
@@ -365,6 +459,10 @@ Public Class ClassControlValues
|
||||
Case GetType(DevExpress.XtraEditors.DateEdit)
|
||||
Dim datepicker As DevExpress.XtraEditors.DateEdit = DirectCast(control, DevExpress.XtraEditors.DateEdit)
|
||||
|
||||
If IsDBNull(autoValue) Then
|
||||
autoValue = String.Empty
|
||||
End If
|
||||
|
||||
Dim result As EnumDateTimePickerDefaultValueOptions = EnumDateTimePickerDefaultValueOptions.Empty
|
||||
Dim success = [Enum].TryParse(Of EnumDateTimePickerDefaultValueOptions)(autoValue, result)
|
||||
|
||||
@@ -390,7 +488,7 @@ Public Class ClassControlValues
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
Public Shared Function Get_Control_Value_for_ID(Control_ID As Integer, Record_ID As Integer)
|
||||
Try
|
||||
Return ClassDatabase.Execute_Scalar("SELECT VALUE FROM TBPMO_CONTROL_VALUE WHERE CONTROL_ID = " & Control_ID & " AND RECORD_ID = " & Record_ID, True)
|
||||
|
||||
Reference in New Issue
Block a user