This commit is contained in:
SchreiberM 2021-03-24 14:45:30 +01:00
commit fafabe8754
3 changed files with 44 additions and 32 deletions

View File

@ -409,7 +409,7 @@ Public Class ClassControlCreator
Public Shared Function CreateExistingGridControl(row As DataRow, DT_MY_COLUMNS As DataTable, designMode As Boolean) As GridControl Public Shared Function CreateExistingGridControl(row As DataRow, DT_MY_COLUMNS As DataTable, designMode As Boolean) As GridControl
Dim oControl As GridControl = CreateBaseControl(New GridControl(), row, designMode) Dim oControl As GridControl = CreateBaseControl(New GridControl(), row, designMode)
Dim oDatatable As New DataTable Dim oDatatable As New DataTable
Dim oView As DevExpress.XtraGrid.Views.Grid.GridView Dim oView As GridView
oControl.ForceInitialize() oControl.ForceInitialize()
@ -555,19 +555,23 @@ Public Class ClassControlCreator
Where r.Item("SPALTENNAME") = oCol.ColumnName Where r.Item("SPALTENNAME") = oCol.ColumnName
Select r).FirstOrDefault() Select r).FirstOrDefault()
Dim oGridColumn As GridColumn = (From c As GridColumn In oView.Columns
Where c.FieldName = oCol.ColumnName
Select c).FirstOrDefault()
Dim oIsRequired = oColumn.Item("VALIDATION") Dim oIsRequired = oColumn.Item("VALIDATION")
Dim oValue = NotNull(oView.GetRowCellValue(e.RowHandle, oCol.ColumnName), "") Dim oValue = NotNull(oView.GetRowCellValue(e.RowHandle, oCol.ColumnName), "")
If oIsRequired And oValue = "" Then If oIsRequired And oValue = "" Then
oView.SetColumnError(oGridColumn, "Spalte muss ausgefüllt werden!")
e.Valid = False e.Valid = False
e.ErrorText = $"Spalte {oColumn.Item("SPALTEN_HEADER")} muss ausgefüllt werden!"
Exit For Exit For
End If End If
Next Next
End Sub End Sub
AddHandler oView.InvalidRowException, Sub(sender As Object, e As InvalidRowExceptionEventArgs) AddHandler oView.InvalidRowException, Sub(sender As Object, e As InvalidRowExceptionEventArgs)
e.ExceptionMode = ExceptionMode.DisplayError e.ExceptionMode = ExceptionMode.NoAction
End Sub End Sub
AddHandler oView.ValidatingEditor, Sub(sender As Object, e As BaseContainerValidateEditorEventArgs) AddHandler oView.ValidatingEditor, Sub(sender As Object, e As BaseContainerValidateEditorEventArgs)

View File

@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyCompany("Digital Data")> <Assembly: AssemblyCompany("Digital Data")>
<Assembly: AssemblyProduct("Process Manager")> <Assembly: AssemblyProduct("Process Manager")>
<Assembly: AssemblyCopyright("Copyright © Digital Data 2021")> <Assembly: AssemblyCopyright("Copyright © Digital Data 2021")>
<Assembly: AssemblyTrademark("2190")> <Assembly: AssemblyTrademark("21110")>
<Assembly: ComVisible(False)> <Assembly: ComVisible(False)>

View File

@ -3671,6 +3671,14 @@ Public Class frmValidator
btnSave.Enabled = False btnSave.Enabled = False
' TODO: Use when working on Validation ' TODO: Use when working on Validation
If ForceGridValidation() = True Then
Finish_WFStep()
End If
btnSave.Enabled = True
End Sub
Private Function ForceGridValidation()
Dim oValidation As Boolean = True Dim oValidation As Boolean = True
Dim oGrids = (From oControl In pnldesigner.Controls Dim oGrids = (From oControl In pnldesigner.Controls
Where TypeOf oControl Is GridControl Where TypeOf oControl Is GridControl
@ -3683,26 +3691,19 @@ Public Class frmValidator
Continue For Continue For
End If End If
For index = 0 To oView.RowCount - 1 If oView.UpdateCurrentRow() = False Then
oView.FocusedRowHandle = index oValidation = False
Return False
If oView.UpdateCurrentRow() = False Then End If
oValidation = False
Exit For
End If
Next
If oValidation = False Then If oValidation = False Then
Exit For Return False
End If End If
Next Next
If oValidation = True Then Return True
Finish_WFStep() End Function
End If
btnSave.Enabled = True
End Sub
Private Function btnFinish_continue() Private Function btnFinish_continue()
Try Try
Dim oSQL = PROFIL_FINISH_SQL Dim oSQL = PROFIL_FINISH_SQL
@ -5044,8 +5045,7 @@ Public Class frmValidator
Catch ex As Exception Catch ex As Exception
LOGGER.Warn($"Unexpected error in Check_UpdateIndexe - ControlID: {oControlId},{oControlName}") LOGGER.Warn($"Unexpected error in Check_UpdateIndexe - ControlID: {oControlId},{oControlName}")
LOGGER.Error(ex) LOGGER.Error(ex)
Dim st As New StackTrace(True) Dim st As New StackTrace(ex, True)
st = New StackTrace(ex, True)
MsgBox($"Unexpected error in Check_UpdateIndexe ControlID,Name: {oControlId},{oControlName}" & vbNewLine & ex.Message & vbNewLine & "Line: " & st.GetFrame(0).GetFileLineNumber().ToString, MsgBoxStyle.Critical, "Error:") MsgBox($"Unexpected error in Check_UpdateIndexe ControlID,Name: {oControlId},{oControlName}" & vbNewLine & ex.Message & vbNewLine & "Line: " & st.GetFrame(0).GetFileLineNumber().ToString, MsgBoxStyle.Critical, "Error:")
LOGGER.Info("Unexpected error in Check_UpdateIndexe:" & ex.Message & " - Line: " & st.GetFrame(0).GetFileLineNumber().ToString, True) LOGGER.Info("Unexpected error in Check_UpdateIndexe:" & ex.Message & " - Line: " & st.GetFrame(0).GetFileLineNumber().ToString, True)
Return False Return False
@ -5406,11 +5406,16 @@ Public Class frmValidator
End Sub End Sub
Private Sub bbtniNext_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtniNext.ItemClick Private Sub bbtniNext_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtniNext.ItemClick
Datei_ueberspringen() If ForceGridValidation() = True Then
Datei_ueberspringen()
End If
End Sub End Sub
Private Sub bbtniDelete_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtniDelete.ItemClick Private Sub bbtniDelete_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtniDelete.ItemClick
delete_active_File() If ForceGridValidation() = True Then
delete_active_File()
End If
End Sub End Sub
Private Sub bbtniAnnotation_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtniAnnotation.ItemClick Private Sub bbtniAnnotation_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtniAnnotation.ItemClick
@ -5422,16 +5427,19 @@ Public Class frmValidator
End Sub End Sub
Private Sub BbtnItm_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BbtnItm.ItemClick Private Sub BbtnItm_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BbtnItm.ItemClick
Dim oRESULT As String If ForceGridValidation() = True Then
If USER_LANGUAGE = "de-DE" Then Dim oRESULT As String
oRESULT = "Eingaben gespeichert"
Else If USER_LANGUAGE = "de-DE" Then
oRESULT = "Eingaben gespeichert" oRESULT = "Eingaben gespeichert"
End If Else
If Check_UpdateIndexe() = True Then oRESULT = "Eingaben gespeichert"
SetStatusLabel($"Data saved", "LimeGreen") End If
Else If Check_UpdateIndexe() = True Then
SetStatusLabel($"Error while saving data!", "Red") SetStatusLabel($"Data saved", "LimeGreen")
Else
SetStatusLabel($"Error while saving data!", "Red")
End If
End If End If
End Sub End Sub
Private Sub SaveDevExpressGridControl_Layout(pProfilID As Integer, pControlID As Integer, pGridView As DevExpress.XtraGrid.Views.Grid.GridView) Private Sub SaveDevExpressGridControl_Layout(pProfilID As Integer, pControlID As Integer, pGridView As DevExpress.XtraGrid.Views.Grid.GridView)