More logging, attempt at fixing empty lines in grid control, add checkbox validation
This commit is contained in:
parent
9a2b324ef5
commit
92d77dcd80
@ -588,9 +588,6 @@ Public Class ClassControlCreator
|
|||||||
oView.OptionsView.ShowFooter = oShouldDisplayFooter
|
oView.OptionsView.ShowFooter = oShouldDisplayFooter
|
||||||
|
|
||||||
AddHandler oView.InitNewRow, Sub(sender As Object, e As InitNewRowEventArgs)
|
AddHandler oView.InitNewRow, Sub(sender As Object, e As InitNewRowEventArgs)
|
||||||
' TODO: Remove when this works and is properly implemented.
|
|
||||||
'Exit Sub
|
|
||||||
|
|
||||||
Try
|
Try
|
||||||
For Each oColumnData As DataRow In DT_MY_COLUMNS.Rows
|
For Each oColumnData As DataRow In DT_MY_COLUMNS.Rows
|
||||||
For Each oGridColumn As GridColumn In oView.Columns
|
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)
|
AddHandler oView.ValidatingEditor, Sub(sender As Object, e As BaseContainerValidateEditorEventArgs)
|
||||||
Dim oRow As DataRowView = oView.GetRow(oView.FocusedRowHandle)
|
Dim oRow As DataRowView = oView.GetRow(oView.FocusedRowHandle)
|
||||||
Dim oColumnName = oView.FocusedColumn.FieldName
|
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)
|
GridTables_ValidateColumn(oView, DT_MY_COLUMNS, oColumnName, e.Value, e.Valid, e.ErrorText)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
AddHandler oView.InvalidRowException, AddressOf View_InvalidRowException
|
AddHandler oView.InvalidRowException, AddressOf View_InvalidRowException
|
||||||
AddHandler oView.ValidatingEditor, AddressOf View_ValidatingEditor
|
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.ShowingEditor, AddressOf View_ShowingEditor
|
||||||
AddHandler oView.ShownEditor, AddressOf View_ShownEditor
|
AddHandler oView.ShownEditor, AddressOf View_ShownEditor
|
||||||
AddHandler oView.ValidateRow, AddressOf View_ValidateRow
|
AddHandler oView.ValidateRow, AddressOf View_ValidateRow
|
||||||
@ -646,19 +647,6 @@ Public Class ClassControlCreator
|
|||||||
Return oControl
|
Return oControl
|
||||||
End Function
|
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 newRowModified As Boolean
|
||||||
|
|
||||||
Private Shared Sub View_ShowingEditor(sender As Object, e As CancelEventArgs)
|
Private Shared Sub View_ShowingEditor(sender As Object, e As CancelEventArgs)
|
||||||
@ -669,6 +657,28 @@ Public Class ClassControlCreator
|
|||||||
End If
|
End If
|
||||||
End Sub
|
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)
|
Private Shared Sub View_ValidatingEditor(sender As Object, e As BaseContainerValidateEditorEventArgs)
|
||||||
Dim oValue As String = NotNull(e.Value, "")
|
Dim oValue As String = NotNull(e.Value, "")
|
||||||
|
|
||||||
|
|||||||
@ -133,9 +133,10 @@ Public Class ClassPMWindream
|
|||||||
|
|
||||||
Dim i As Integer = 0
|
Dim i As Integer = 0
|
||||||
Dim indexname As String
|
Dim indexname As String
|
||||||
|
|
||||||
If aValues.Length = 1 And aValues(0) = "" Then
|
If aValues.Length = 1 And aValues(0) = "" Then
|
||||||
LOGGER.Debug("Indexwert ist leer/Nothing - Keine Indexierung")
|
LOGGER.Debug("Indexwert ist leer/Nothing - Keine Indexierung")
|
||||||
End If
|
Else
|
||||||
'Jetzt jeden Indexwert durchlaufen
|
'Jetzt jeden Indexwert durchlaufen
|
||||||
For Each aName As String In Indizes
|
For Each aName As String In Indizes
|
||||||
indexname = aName
|
indexname = aName
|
||||||
@ -420,6 +421,8 @@ Public Class ClassPMWindream
|
|||||||
Next
|
Next
|
||||||
End Select
|
End Select
|
||||||
|
|
||||||
|
LOGGER.Debug("Wert für Index vor Indexierung: [{0}]", myArray)
|
||||||
|
|
||||||
'Jetzt die Nachindexierung für Vektor-Felder
|
'Jetzt die Nachindexierung für Vektor-Felder
|
||||||
oDocument.SetVariableValue(aName, myArray)
|
oDocument.SetVariableValue(aName, myArray)
|
||||||
LOGGER.Debug("'SetVariableValue' für VEKTOR erfolgreich", False)
|
LOGGER.Debug("'SetVariableValue' für VEKTOR erfolgreich", False)
|
||||||
@ -428,6 +431,7 @@ Public Class ClassPMWindream
|
|||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
Next
|
Next
|
||||||
|
End If
|
||||||
|
|
||||||
' oDocument.LockRights()
|
' oDocument.LockRights()
|
||||||
|
|
||||||
|
|||||||
@ -3585,7 +3585,11 @@ Public Class frmValidator
|
|||||||
Where TypeOf oControl Is GridControl
|
Where TypeOf oControl Is GridControl
|
||||||
Select oControl).ToList()
|
Select oControl).ToList()
|
||||||
|
|
||||||
|
LOGGER.Debug("Forcing grid Validation")
|
||||||
|
|
||||||
For Each oGrid As GridControl In oGrids
|
For Each oGrid As GridControl In oGrids
|
||||||
|
LOGGER.Debug("Validating Grid [{0}]", oGrid.Name)
|
||||||
|
|
||||||
Dim oView As GridView = oGrid.MainView
|
Dim oView As GridView = oGrid.MainView
|
||||||
|
|
||||||
If oView.RowCount = 0 Then
|
If oView.RowCount = 0 Then
|
||||||
@ -3594,9 +3598,10 @@ Public Class frmValidator
|
|||||||
|
|
||||||
If oView.UpdateCurrentRow() = False Then
|
If oView.UpdateCurrentRow() = False Then
|
||||||
oValidation = False
|
oValidation = False
|
||||||
Return False
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
LOGGER.Debug("Validation of Grid [{0}] ended with Result: [{1}]", oGrid.Name, oValidation)
|
||||||
|
|
||||||
If oValidation = False Then
|
If oValidation = False Then
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
@ -4671,11 +4676,12 @@ Public Class frmValidator
|
|||||||
Dim chk As CheckBox = oControl
|
Dim chk As CheckBox = oControl
|
||||||
oMyInput = chk.Checked.ToString
|
oMyInput = chk.Checked.ToString
|
||||||
|
|
||||||
'If chk.Checked = False And oIsRequired = True Then
|
If chk.CheckState = CheckState.Indeterminate And oIsRequired = True Then
|
||||||
' oMissing = True
|
oMissing = True
|
||||||
' oErrorMessage = "Option '" & chk.Name & "' is required."
|
oErrMsgMissingInput = "Please set Checkbox value for field '" & chk.Name & "'"
|
||||||
' Exit For
|
LOGGER.Warn(oErrMsgMissingInput)
|
||||||
'End If
|
Exit For
|
||||||
|
End If
|
||||||
|
|
||||||
'den aktuellen Wert in windream auslesen
|
'den aktuellen Wert in windream auslesen
|
||||||
Dim WertWD As String
|
Dim WertWD As String
|
||||||
@ -4881,6 +4887,12 @@ Public Class frmValidator
|
|||||||
|
|
||||||
str = String.Join(PMDelimiter, oValueList.ToArray)
|
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
|
'Den Wert im Array speichern
|
||||||
myVektorArr(ZeilenGrid) = str
|
myVektorArr(ZeilenGrid) = str
|
||||||
ZeilenGrid += 1
|
ZeilenGrid += 1
|
||||||
@ -4975,7 +4987,7 @@ Public Class frmValidator
|
|||||||
End Try
|
End Try
|
||||||
|
|
||||||
End Function
|
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
|
Dim File_indexiert As Boolean = False
|
||||||
idxerr_message = ""
|
idxerr_message = ""
|
||||||
Try
|
Try
|
||||||
@ -4986,21 +4998,30 @@ Public Class frmValidator
|
|||||||
arrValue = Nothing
|
arrValue = Nothing
|
||||||
'Den Indexnamen übergeben
|
'Den Indexnamen übergeben
|
||||||
ReDim Preserve arrIndex(0)
|
ReDim Preserve arrIndex(0)
|
||||||
arrIndex(0) = idxxname
|
arrIndex(0) = pIndexName
|
||||||
'Das Array der Idnexwerte überprüfen
|
'Das Array der Idnexwerte überprüfen
|
||||||
If idxvalue Is Nothing = False Then
|
If pIndexValues Is Nothing = False Then
|
||||||
If idxvalue.Length() > 1 Then
|
If pIndexValues.Length() > 1 Then
|
||||||
LOGGER.Debug("Indexing Index '" & idxxname & "' with Arrayvalue")
|
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
|
Dim anzahl As Integer = 0
|
||||||
For Each indexvalue As String In idxvalue
|
For Each indexvalue As String In pIndexValues
|
||||||
ReDim Preserve arrValue(anzahl)
|
ReDim Preserve arrValue(anzahl)
|
||||||
arrValue(anzahl) = indexvalue
|
arrValue(anzahl) = indexvalue
|
||||||
anzahl += 1
|
anzahl += 1
|
||||||
Next
|
Next
|
||||||
Else
|
Else
|
||||||
LOGGER.Debug("Indexing Index '" & idxxname & "' with value '" & idxvalue(0) & "'")
|
LOGGER.Debug("Indexing Index '" & pIndexName & "' with value '" & pIndexValues(0) & "'")
|
||||||
ReDim Preserve arrValue(0)
|
ReDim Preserve arrValue(0)
|
||||||
arrValue(0) = idxvalue(0).ToString
|
arrValue(0) = pIndexValues(0).ToString
|
||||||
End If
|
End If
|
||||||
'Jetzt das eigentliche Indexieren der Datei
|
'Jetzt das eigentliche Indexieren der Datei
|
||||||
'File_indexiert = Me._windreamPM.RunIndexing(_dok, arrIndex, arrValue)
|
'File_indexiert = Me._windreamPM.RunIndexing(_dok, arrIndex, arrValue)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user