Validation, More Lookup Grid Control Tweaks

This commit is contained in:
Jonathan Jenne 2021-03-15 13:36:07 +01:00
parent 56106732c7
commit ab382c7fd0
3 changed files with 50 additions and 40 deletions

View File

@ -547,37 +547,37 @@ Public Class ClassControlCreator
Next Next
End Sub End Sub
'AddHandler oView.CellValueChanged, Sub(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs) AddHandler oView.ValidateRow, Sub(sender As Object, e As ValidateRowEventArgs)
' Console.WriteLine("") Dim oRow As DataRowView = oView.GetRow(oView.FocusedRowHandle)
' End Sub
'AddHandler oView.ValidateRow, Sub(sender As Object, e As ValidateRowEventArgs) For Each oCol As DataColumn In oRow.DataView.Table.Columns
' Console.WriteLine("") Dim oColumn As DataRow = (From r As DataRow In DT_MY_COLUMNS.Rows
' End Sub Where r.Item("SPALTENNAME") = oCol.ColumnName
Select r).FirstOrDefault()
'AddHandler oView.ValidatingEditor, Sub(sender As Object, e As BaseContainerValidateEditorEventArgs) Dim oIsRequired = oColumn.Item("VALIDATION")
' Dim oRow As DataRowView = oView.GetRow(oView.FocusedRowHandle) Dim oValue = NotNull(oView.GetRowCellValue(e.RowHandle, oCol.ColumnName), "")
' For Each oCol As DataColumn In oRow.DataView.Table.Columns If oIsRequired And oValue = "" Then
' Dim oColumn As DataRow = (From r As DataRow In DT_MY_COLUMNS.Rows e.Valid = False
' Where r.Item("SPALTENNAME") = oCol.ColumnName e.ErrorText = $"Spalte {oColumn.Item("SPALTEN_HEADER")} muss ausgefüllt werden!"
' Select r).FirstOrDefault() Exit For
End If
Next
End Sub
' Dim oIsRequired = oColumn.Item("VALIDATION") AddHandler oView.InvalidRowException, Sub(sender As Object, e As InvalidRowExceptionEventArgs)
' Dim oValue As String = NotNull(e.Value, "") e.ExceptionMode = ExceptionMode.DisplayError
End Sub
' If oValue.contains(" | ") Then AddHandler oView.ValidatingEditor, Sub(sender As Object, e As BaseContainerValidateEditorEventArgs)
' oValue = oValue.Split(" | ").ToList().First() Dim oValue As String = NotNull(e.Value, "")
' e.Value = oValue
' End If
' If oIsRequired And oValue = "" Then If oValue.Contains(" | ") Then
' e.Valid = False oValue = oValue.Split(" | ").ToList().First()
' e.ErrorText = $"Spalte {oColumn.Item("SPALTEN_HEADER")} muss ausgefüllt werden!" e.Value = oValue
' Exit For End If
' End If End Sub
' Next
' End Sub
Return oControl Return oControl
End Function End Function

View File

@ -529,9 +529,6 @@
<data name="&gt;&gt;LOAD_IDX_VALUECheckBox.ZOrder" xml:space="preserve"> <data name="&gt;&gt;LOAD_IDX_VALUECheckBox.ZOrder" xml:space="preserve">
<value>18</value> <value>18</value>
</data> </data>
<data name="VALIDATIONCheckbox.Enabled" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="VALIDATIONCheckbox.Location" type="System.Drawing.Point, System.Drawing"> <data name="VALIDATIONCheckbox.Location" type="System.Drawing.Point, System.Drawing">
<value>24, 455</value> <value>24, 455</value>
</data> </data>

View File

@ -3665,23 +3665,36 @@ Public Class frmValidator
btnSave.Enabled = False btnSave.Enabled = False
' TODO: Use when working on Validation ' TODO: Use when working on Validation
'Dim oGrids = (From oControl In pnldesigner.Controls Dim oValidation As Boolean = True
' Where TypeOf oControl Is GridControl Dim oGrids = (From oControl In pnldesigner.Controls
' Select oControl).ToList() Where TypeOf oControl Is GridControl
Select oControl).ToList()
'For Each oGrid As GridControl In oGrids For Each oGrid As GridControl In oGrids
' Dim oView As GridView = oGrid.MainView Dim oView As GridView = oGrid.MainView
' For index = 0 To oView.RowCount - 1 If oView.RowCount = 0 Then
' oView.FocusedRowHandle = index Continue For
' oView.UpdateCurrentRow() End If
' Next
'Next For index = 0 To oView.RowCount - 1
oView.FocusedRowHandle = index
'Return If oView.UpdateCurrentRow() = False Then
oValidation = False
Exit For
End If
Next
If oValidation = False Then
Exit For
End If
Next
If oValidation = True Then
Finish_WFStep()
End If
Finish_WFStep()
btnSave.Enabled = True btnSave.Enabled = True
End Sub End Sub
Private Function btnFinish_continue() Private Function btnFinish_continue()