ZooFlow: switch to Checkedit, small changes in frmIndex
This commit is contained in:
@@ -5,6 +5,8 @@ Imports DigitalData.GUIs.ZooFlow.frmGlobix_Index
|
||||
Imports DigitalData.Modules.EDMI.API
|
||||
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.GUIs.GlobalIndexer.ControlCreator
|
||||
Imports DevExpress.XtraEditors
|
||||
|
||||
Public Class ClassValidator
|
||||
Inherits BaseClass
|
||||
@@ -18,19 +20,30 @@ Public Class ClassValidator
|
||||
ManualIndexes = pManualIndexes
|
||||
End Sub
|
||||
|
||||
Public Function GetControlMeta(pControl As Control) As ControlMeta
|
||||
Dim oMeta As ControlMeta = Nothing
|
||||
If TypeOf pControl.Tag Is ControlMeta Then
|
||||
oMeta = DirectCast(pControl.Tag, ControlMeta)
|
||||
End If
|
||||
Return oMeta
|
||||
End Function
|
||||
|
||||
|
||||
Function ValidateControls(pPanel As Panel, pDocType As DocType) As Boolean
|
||||
Try
|
||||
Logger.Debug("Starting [ValidateControls]")
|
||||
Dim result As Boolean = True
|
||||
|
||||
For Each oControl As Control In pPanel.Controls
|
||||
Dim oMeta As ControlMeta = GetControlMeta(oControl)
|
||||
|
||||
If oControl.Name.StartsWith("lbl") Then
|
||||
' Labels do not need to validated
|
||||
If TypeOf oControl Is Label Then
|
||||
Continue For
|
||||
End If
|
||||
|
||||
' ========================= TEXT BOX =========================
|
||||
If oControl.Name.StartsWith("txt") Then
|
||||
If oMeta.ControlType = "txt" Then
|
||||
Dim oTextBox As DevExpress.XtraEditors.TextEdit = oControl
|
||||
If oTextBox.Text = "" Then
|
||||
Dim oIndexName = GetIndexName(oTextBox, "txt")
|
||||
@@ -45,7 +58,7 @@ Public Class ClassValidator
|
||||
End If
|
||||
|
||||
' ========================= LOOKUP =========================
|
||||
If oControl.Name.StartsWith("cmbMulti") Then
|
||||
If oMeta.ControlType = "cmbMulti" Then
|
||||
Dim oLookup = DirectCast(oControl, LookupControl3)
|
||||
Dim oValues As List(Of String) = oLookup.Properties.SelectedValues
|
||||
|
||||
@@ -60,7 +73,8 @@ Public Class ClassValidator
|
||||
End If
|
||||
End If
|
||||
|
||||
ElseIf oControl.Name.StartsWith("cmbSingle") Then
|
||||
End If
|
||||
If oMeta.ControlType = "cmbSingle" Then
|
||||
Dim cmbSingle As TextBox = oControl
|
||||
|
||||
If cmbSingle.Text = "" Then
|
||||
@@ -73,9 +87,10 @@ Public Class ClassValidator
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
ElseIf oControl.Name.StartsWith("cmb") Then
|
||||
Dim cmb As ComboBox = oControl
|
||||
If oMeta.ControlType = "cmb" Then
|
||||
Dim cmb As Windows.Forms.ComboBox = oControl
|
||||
If cmb.Text = "" Then
|
||||
Dim oIndexName = GetIndexName(cmb, "cmb")
|
||||
Dim oOptional = TestIsIndexOptional(pDocType, oIndexName)
|
||||
@@ -86,11 +101,10 @@ Public Class ClassValidator
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
' ========================= DATE PICKER =========================
|
||||
If oControl.Name.StartsWith("dtp") Then
|
||||
If oMeta.ControlType = "dtp" Then
|
||||
Dim dtp As DevExpress.XtraEditors.DateEdit = oControl
|
||||
Dim oIndexName As String = GetIndexName(dtp, "dtp")
|
||||
|
||||
@@ -106,19 +120,11 @@ Public Class ClassValidator
|
||||
End If
|
||||
|
||||
' ========================= CHECK BOX =========================
|
||||
If oControl.Name.StartsWith("chk") Then
|
||||
Dim chk As CheckBox = oControl
|
||||
If oMeta.ControlType = "chk" Then
|
||||
'TODO: Implement Itermediate state and then validation for checkbox
|
||||
Dim chk As CheckEdit = oControl
|
||||
'result = True
|
||||
End If
|
||||
|
||||
'If TypeOf (oControl) Is Button Then
|
||||
' Continue For
|
||||
'End If
|
||||
|
||||
'If oControl.Name.StartsWith("lbl") = False And result = False Then
|
||||
' Logger.Info("Die Überprüfung der manuellen Indices ist fehlerhaft. Bitte informieren Sie den Systembetreuer")
|
||||
' Return False
|
||||
'End If
|
||||
Next
|
||||
|
||||
Return True
|
||||
@@ -133,13 +139,15 @@ Public Class ClassValidator
|
||||
Dim oAttributeValues As New List(Of UserAttributeValue)
|
||||
|
||||
For Each oControl As Control In pPanel.Controls
|
||||
Dim oMeta As ControlMeta = GetControlMeta(oControl)
|
||||
|
||||
If oControl.Name.StartsWith("lbl") Then
|
||||
' Labels do not have values
|
||||
If TypeOf oControl Is Label Then
|
||||
Continue For
|
||||
End If
|
||||
|
||||
' ========================= TEXTBOX =========================
|
||||
If oControl.Name.StartsWith("txt") Then
|
||||
If oMeta.ControlType = "txt" Then
|
||||
Dim oTextBox As DevExpress.XtraEditors.TextEdit = oControl
|
||||
Dim oIndexName = GetIndexName(oTextBox, "txt")
|
||||
|
||||
@@ -155,7 +163,7 @@ Public Class ClassValidator
|
||||
End If
|
||||
|
||||
' ========================= LOOKUP =========================
|
||||
If oControl.Name.StartsWith("cmbMulti") Then
|
||||
If oMeta.ControlType = "cmbMulti" Then
|
||||
Dim oLookup = DirectCast(oControl, LookupControl3)
|
||||
Dim oValues As List(Of String) = oLookup.Properties.SelectedValues
|
||||
Dim oIndexName = GetIndexName(oLookup, "cmbMulti")
|
||||
@@ -170,7 +178,9 @@ Public Class ClassValidator
|
||||
})
|
||||
|
||||
|
||||
ElseIf oControl.Name.StartsWith("cmbSingle") Then
|
||||
End If
|
||||
|
||||
If oMeta.ControlType = "cmbSingle" Then
|
||||
Dim cmbSingle As TextBox = oControl
|
||||
Dim oIndexName = GetIndexName(cmbSingle, "cmbSingle")
|
||||
|
||||
@@ -178,12 +188,13 @@ Public Class ClassValidator
|
||||
End If
|
||||
|
||||
oAttributeValues.Add(New UserAttributeValue With {
|
||||
.Name = oIndexName,
|
||||
.Values = WrapIndexValue(cmbSingle.Text),
|
||||
.ControlName = cmbSingle.Name
|
||||
})
|
||||
.Name = oIndexName,
|
||||
.Values = WrapIndexValue(cmbSingle.Text),
|
||||
.ControlName = cmbSingle.Name
|
||||
})
|
||||
End If
|
||||
|
||||
ElseIf oControl.Name.StartsWith("cmb") Then
|
||||
If oMeta.ControlType = "cmb" Then
|
||||
Dim cmb As ComboBox = oControl
|
||||
Dim oIndexName = GetIndexName(cmb, "cmb")
|
||||
|
||||
@@ -198,7 +209,7 @@ Public Class ClassValidator
|
||||
End If
|
||||
|
||||
' ========================= DATE PICKER =========================
|
||||
If oControl.Name.StartsWith("dtp") Then
|
||||
If oMeta.ControlType = "dtp" Then
|
||||
Dim dtp As DevExpress.XtraEditors.DateEdit = oControl
|
||||
Dim oIndexName As String = GetIndexName(dtp, "dtp")
|
||||
|
||||
@@ -210,8 +221,8 @@ Public Class ClassValidator
|
||||
End If
|
||||
|
||||
' ========================= CHECK BOX =========================
|
||||
If oControl.Name.StartsWith("chk") Then
|
||||
Dim chk As CheckBox = oControl
|
||||
If oMeta.ControlType = "chk" Then
|
||||
Dim chk As CheckEdit = oControl
|
||||
Dim oIndexName As String = GetIndexName(chk, "chk")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user