More logging, attempt at fixing empty lines in grid control, add checkbox validation

This commit is contained in:
Jonathan Jenne 2021-11-01 14:02:51 +01:00
parent 9a2b324ef5
commit 92d77dcd80
3 changed files with 344 additions and 309 deletions

View File

@ -588,9 +588,6 @@ Public Class ClassControlCreator
oView.OptionsView.ShowFooter = oShouldDisplayFooter
AddHandler oView.InitNewRow, Sub(sender As Object, e As InitNewRowEventArgs)
' TODO: Remove when this works and is properly implemented.
'Exit Sub
Try
For Each oColumnData As DataRow In DT_MY_COLUMNS.Rows
For Each oGridColumn As GridColumn In oView.Columns
@ -634,11 +631,15 @@ Public Class ClassControlCreator
AddHandler oView.ValidatingEditor, Sub(sender As Object, e As BaseContainerValidateEditorEventArgs)
Dim oRow As DataRowView = oView.GetRow(oView.FocusedRowHandle)
Dim oColumnName = oView.FocusedColumn.FieldName
LOGGER.Debug("Validating Editor for Column [{0}]", oColumnName)
GridTables_ValidateColumn(oView, DT_MY_COLUMNS, oColumnName, e.Value, e.Valid, e.ErrorText)
End Sub
AddHandler oView.InvalidRowException, AddressOf View_InvalidRowException
AddHandler oView.ValidatingEditor, AddressOf View_ValidatingEditor
' These handlers are all used for the custom DefaultValue functionality
' https://supportcenter.devexpress.com/ticket/details/t1035580/how-to-default-a-value-in-a-column-when-add-new-row-in-data-grid
AddHandler oView.ShowingEditor, AddressOf View_ShowingEditor
AddHandler oView.ShownEditor, AddressOf View_ShownEditor
AddHandler oView.ValidateRow, AddressOf View_ValidateRow
@ -646,19 +647,6 @@ Public Class ClassControlCreator
Return oControl
End Function
Private Shared Sub View_ValidateRow(sender As Object, e As ValidateRowEventArgs)
Dim view As GridView = TryCast(sender, GridView)
If view.IsNewItemRow(e.RowHandle) AndAlso Not newRowModified Then view.DeleteRow(e.RowHandle)
newRowModified = False
End Sub
Private Shared Sub View_ShownEditor(sender As Object, e As EventArgs)
Dim view As GridView = TryCast(sender, GridView)
If view.IsNewItemRow(view.FocusedRowHandle) Then
AddHandler view.ActiveEditor.Modified, Sub() newRowModified = True
End If
End Sub
Private Shared newRowModified As Boolean
Private Shared Sub View_ShowingEditor(sender As Object, e As CancelEventArgs)
@ -669,6 +657,28 @@ Public Class ClassControlCreator
End If
End Sub
Private Shared Sub View_ShownEditor(sender As Object, e As EventArgs)
Dim view As GridView = TryCast(sender, GridView)
If view.IsNewItemRow(view.FocusedRowHandle) Then
AddHandler view.ActiveEditor.Modified, Sub()
LOGGER.Debug("Row was modified")
newRowModified = True
End Sub
End If
End Sub
Private Shared Sub View_ValidateRow(sender As Object, e As ValidateRowEventArgs)
Dim view As GridView = TryCast(sender, GridView)
If view.IsNewItemRow(e.RowHandle) AndAlso Not newRowModified Then
LOGGER.Debug("Deleting unused row")
view.DeleteRow(e.RowHandle)
End If
LOGGER.Debug("Validating row. Resetting Modified.")
newRowModified = False
End Sub
Private Shared Sub View_ValidatingEditor(sender As Object, e As BaseContainerValidateEditorEventArgs)
Dim oValue As String = NotNull(e.Value, "")

View File

@ -133,9 +133,10 @@ Public Class ClassPMWindream
Dim i As Integer = 0
Dim indexname As String
If aValues.Length = 1 And aValues(0) = "" Then
LOGGER.Debug("Indexwert ist leer/Nothing - Keine Indexierung")
End If
Else
'Jetzt jeden Indexwert durchlaufen
For Each aName As String In Indizes
indexname = aName
@ -420,6 +421,8 @@ Public Class ClassPMWindream
Next
End Select
LOGGER.Debug("Wert für Index vor Indexierung: [{0}]", myArray)
'Jetzt die Nachindexierung für Vektor-Felder
oDocument.SetVariableValue(aName, myArray)
LOGGER.Debug("'SetVariableValue' für VEKTOR erfolgreich", False)
@ -428,6 +431,7 @@ Public Class ClassPMWindream
i += 1
Next
End If
' oDocument.LockRights()

View File

@ -3585,7 +3585,11 @@ Public Class frmValidator
Where TypeOf oControl Is GridControl
Select oControl).ToList()
LOGGER.Debug("Forcing grid Validation")
For Each oGrid As GridControl In oGrids
LOGGER.Debug("Validating Grid [{0}]", oGrid.Name)
Dim oView As GridView = oGrid.MainView
If oView.RowCount = 0 Then
@ -3594,9 +3598,10 @@ Public Class frmValidator
If oView.UpdateCurrentRow() = False Then
oValidation = False
Return False
End If
LOGGER.Debug("Validation of Grid [{0}] ended with Result: [{1}]", oGrid.Name, oValidation)
If oValidation = False Then
Return False
End If
@ -4671,11 +4676,12 @@ Public Class frmValidator
Dim chk As CheckBox = oControl
oMyInput = chk.Checked.ToString
'If chk.Checked = False And oIsRequired = True Then
' oMissing = True
' oErrorMessage = "Option '" & chk.Name & "' is required."
' Exit For
'End If
If chk.CheckState = CheckState.Indeterminate And oIsRequired = True Then
oMissing = True
oErrMsgMissingInput = "Please set Checkbox value for field '" & chk.Name & "'"
LOGGER.Warn(oErrMsgMissingInput)
Exit For
End If
'den aktuellen Wert in windream auslesen
Dim WertWD As String
@ -4881,6 +4887,12 @@ Public Class frmValidator
str = String.Join(PMDelimiter, oValueList.ToArray)
' 22.10.2021 Attempt at fixing empty lines appearing in indexes
If str.Trim.Length = 0 Or str.Trim.Replace(PMDelimiter, "").Length = 0 Then
LOGGER.Debug("Empty line in Grid [{0}]. Skipping.", oControlName)
Continue For
End If
'Den Wert im Array speichern
myVektorArr(ZeilenGrid) = str
ZeilenGrid += 1
@ -4975,7 +4987,7 @@ Public Class frmValidator
End Try
End Function
Private Function Indexiere_File(_dok As WINDREAMLib.WMObject, idxxname As String, idxvalue As Object) As Boolean
Private Function Indexiere_File(_dok As WINDREAMLib.WMObject, pIndexName As String, pIndexValues As Object) As Boolean
Dim File_indexiert As Boolean = False
idxerr_message = ""
Try
@ -4986,21 +4998,30 @@ Public Class frmValidator
arrValue = Nothing
'Den Indexnamen übergeben
ReDim Preserve arrIndex(0)
arrIndex(0) = idxxname
arrIndex(0) = pIndexName
'Das Array der Idnexwerte überprüfen
If idxvalue Is Nothing = False Then
If idxvalue.Length() > 1 Then
LOGGER.Debug("Indexing Index '" & idxxname & "' with Arrayvalue")
If pIndexValues Is Nothing = False Then
If pIndexValues.Length() > 1 Then
LOGGER.Debug("Indexing Index '" & pIndexName & "' with Arrayvalue")
For Each oValue In pIndexValues
Try
LOGGER.Debug("Current Index Value for [{0}] is [{1}]", pIndexName, oValue)
Catch ex As Exception
LOGGER.Debug("Current Index Value for [{0}] could not be read!", pIndexName)
End Try
Next
Dim anzahl As Integer = 0
For Each indexvalue As String In idxvalue
For Each indexvalue As String In pIndexValues
ReDim Preserve arrValue(anzahl)
arrValue(anzahl) = indexvalue
anzahl += 1
Next
Else
LOGGER.Debug("Indexing Index '" & idxxname & "' with value '" & idxvalue(0) & "'")
LOGGER.Debug("Indexing Index '" & pIndexName & "' with value '" & pIndexValues(0) & "'")
ReDim Preserve arrValue(0)
arrValue(0) = idxvalue(0).ToString
arrValue(0) = pIndexValues(0).ToString
End If
'Jetzt das eigentliche Indexieren der Datei
'File_indexiert = Me._windreamPM.RunIndexing(_dok, arrIndex, arrValue)