jj_26_01_16_version_2.4.4.0
This commit is contained in:
parent
4895619798
commit
2887aea532
@ -2,6 +2,100 @@
|
|||||||
|
|
||||||
Public Class ClassControlValues
|
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)
|
Public Shared Sub LoadControlValues(RecordId As Integer, ParentRecordId As Integer, FormId As Integer, controls As Control.ControlCollection)
|
||||||
Try
|
Try
|
||||||
@ -365,6 +459,10 @@ Public Class ClassControlValues
|
|||||||
Case GetType(DevExpress.XtraEditors.DateEdit)
|
Case GetType(DevExpress.XtraEditors.DateEdit)
|
||||||
Dim datepicker As DevExpress.XtraEditors.DateEdit = DirectCast(control, 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 result As EnumDateTimePickerDefaultValueOptions = EnumDateTimePickerDefaultValueOptions.Empty
|
||||||
Dim success = [Enum].TryParse(Of EnumDateTimePickerDefaultValueOptions)(autoValue, result)
|
Dim success = [Enum].TryParse(Of EnumDateTimePickerDefaultValueOptions)(autoValue, result)
|
||||||
|
|
||||||
|
|||||||
@ -33,7 +33,7 @@ Imports System.Runtime.InteropServices
|
|||||||
' übernehmen, indem Sie "*" eingeben:
|
' übernehmen, indem Sie "*" eingeben:
|
||||||
' <Assembly: AssemblyVersion("1.0.*")>
|
' <Assembly: AssemblyVersion("1.0.*")>
|
||||||
|
|
||||||
<Assembly: AssemblyVersion("2.4.3.0")>
|
<Assembly: AssemblyVersion("2.4.4.0")>
|
||||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||||
|
|
||||||
<Assembly: NeutralResourcesLanguageAttribute("en-US")>
|
<Assembly: NeutralResourcesLanguageAttribute("en-US")>
|
||||||
@ -975,7 +975,7 @@ Public Class frmForm_Constructor_Main_2
|
|||||||
Try
|
Try
|
||||||
Dim Control As Control = sender
|
Dim Control As Control = sender
|
||||||
Dim ControlName As String = Control.Name
|
Dim ControlName As String = Control.Name
|
||||||
Dim ControlId As Integer = Control.Tag ' GetControlID_for_Name(ControlName, FORM_ID)
|
Dim ControlId As Integer = DirectCast(Control.Tag, ClassControlMetadata).Id ' GetControlID_for_Name(ControlName, FORM_ID)
|
||||||
|
|
||||||
Dim dr As DataRow = ClassFunctionCommands.LoadFunction(ControlId)
|
Dim dr As DataRow = ClassFunctionCommands.LoadFunction(ControlId)
|
||||||
|
|
||||||
@ -1048,7 +1048,16 @@ Public Class frmForm_Constructor_Main_2
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
'Update aller Control-Werte
|
'Update aller Control-Werte
|
||||||
Dim ResultMessage = Update_Record_OnChange()
|
Dim ResultMessage
|
||||||
|
' Wenn MussFelder nicht ausgefüllt werden, wird eine exception geworfen und abgefangen
|
||||||
|
Try
|
||||||
|
ResultMessage = Update_Record_OnChange()
|
||||||
|
Catch ex As Exception
|
||||||
|
MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Fehler beim Speichern des Datensatzes")
|
||||||
|
Me.Cursor = Cursors.Default
|
||||||
|
Exit Sub
|
||||||
|
End Try
|
||||||
|
|
||||||
Dim recid As Integer
|
Dim recid As Integer
|
||||||
Update_Status_Label(True, ResultMessage, EDIT_STATE)
|
Update_Status_Label(True, ResultMessage, EDIT_STATE)
|
||||||
|
|
||||||
@ -1773,7 +1782,13 @@ Public Class frmForm_Constructor_Main_2
|
|||||||
'Me.pnlDetails.Enabled = False
|
'Me.pnlDetails.Enabled = False
|
||||||
'CtrlCommandUI.IsInsert = False
|
'CtrlCommandUI.IsInsert = False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
Try
|
||||||
Update_Record_OnChange()
|
Update_Record_OnChange()
|
||||||
|
Catch ex As Exception
|
||||||
|
MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Fehler beim Speichern des Datensatzes")
|
||||||
|
End Try
|
||||||
|
|
||||||
End If
|
End If
|
||||||
CtrlCommandUI.IsInsert = False
|
CtrlCommandUI.IsInsert = False
|
||||||
RECORD_CHANGED = False
|
RECORD_CHANGED = False
|
||||||
@ -2297,6 +2312,17 @@ Public Class frmForm_Constructor_Main_2
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Function Update_Record_OnChange() As String
|
Private Function Update_Record_OnChange() As String
|
||||||
|
' Überprüfen, ob alle "Required Felder ausgefüllt wurden"
|
||||||
|
|
||||||
|
Dim missingControlValues As List(Of String) = ClassControlValues.CheckRequiredControlValues(CtrlBuilder.MasterPanel.Controls)
|
||||||
|
If missingControlValues.Count > 0 Then
|
||||||
|
|
||||||
|
Dim nameString As String = String.Join(vbNewLine, missingControlValues)
|
||||||
|
Dim errorMessage As String = String.Format("Die folgenden Steuerelemente müssen ausgefüllt sein: {0}{1}", vbNewLine, nameString)
|
||||||
|
|
||||||
|
Throw New Exception(errorMessage)
|
||||||
|
End If
|
||||||
|
|
||||||
' Record Speichern
|
' Record Speichern
|
||||||
Dim ResultMessage = CtrlCommandUI.SaveRecord(SELECTED_RECORD_ID, FORM_ID, PARENT_RECORDID)
|
Dim ResultMessage = CtrlCommandUI.SaveRecord(SELECTED_RECORD_ID, FORM_ID, PARENT_RECORDID)
|
||||||
'Jetzt die für die Entität notwendigen Prroceduren ausführen
|
'Jetzt die für die Entität notwendigen Prroceduren ausführen
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user