WIP Validation for Grids
This commit is contained in:
parent
b6413711f2
commit
2fd4e817a7
@ -37,7 +37,7 @@ Public Class ClassControlCreator
|
|||||||
Public Const PREFIX_LINE = "LINE"
|
Public Const PREFIX_LINE = "LINE"
|
||||||
Public Const PREFIX_BUTTON = "BTN"
|
Public Const PREFIX_BUTTON = "BTN"
|
||||||
|
|
||||||
Public Shared GridTables As New Dictionary(Of String, DataTable)
|
Public Shared GridTables As New Dictionary(Of String, Dictionary(Of String, DataTable))
|
||||||
|
|
||||||
''' <summary>
|
''' <summary>
|
||||||
''' Standard Eigenschaften für alle Controls
|
''' Standard Eigenschaften für alle Controls
|
||||||
@ -106,6 +106,7 @@ Public Class ClassControlCreator
|
|||||||
Return ctrl
|
Return ctrl
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
LOGGER.Error(ex)
|
LOGGER.Error(ex)
|
||||||
|
Return Nothing
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
End Function
|
End Function
|
||||||
@ -449,7 +450,11 @@ Public Class ClassControlCreator
|
|||||||
|
|
||||||
End With
|
End With
|
||||||
|
|
||||||
GridTables.Clear()
|
If GridTables.ContainsKey(oControl.Name) Then
|
||||||
|
GridTables.Item(oControl.Name).Clear()
|
||||||
|
Else
|
||||||
|
GridTables.Add(oControl.Name, New Dictionary(Of String, DataTable)())
|
||||||
|
End If
|
||||||
|
|
||||||
For Each oRow As DataRow In DT_MY_COLUMNS.Rows
|
For Each oRow As DataRow In DT_MY_COLUMNS.Rows
|
||||||
' Create Columns in Datatable
|
' Create Columns in Datatable
|
||||||
@ -471,7 +476,9 @@ Public Class ClassControlCreator
|
|||||||
If oConnectionId > 0 And oSqlCommand <> "" Then
|
If oConnectionId > 0 And oSqlCommand <> "" Then
|
||||||
Try
|
Try
|
||||||
Dim oComboboxDataTable As DataTable = ClassDatabase.Return_Datatable_ConId(oSqlCommand, oConnectionId)
|
Dim oComboboxDataTable As DataTable = ClassDatabase.Return_Datatable_ConId(oSqlCommand, oConnectionId)
|
||||||
GridTables.Add(oRow.Item("SPALTENNAME"), oComboboxDataTable)
|
|
||||||
|
GridTables.Item(oControl.Name).Add(oRow.Item("SPALTENNAME"), oComboboxDataTable)
|
||||||
|
'GridTables.Add(oRow.Item("SPALTENNAME"), oComboboxDataTable)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
LOGGER.Warn("Could not load data for column {0} in control {1}", oRow.Item("SPALTENNAME"), oControl.Name)
|
LOGGER.Warn("Could not load data for column {0} in control {1}", oRow.Item("SPALTENNAME"), oControl.Name)
|
||||||
LOGGER.Error(ex)
|
LOGGER.Error(ex)
|
||||||
@ -488,20 +495,18 @@ Public Class ClassControlCreator
|
|||||||
oControl.RefreshDataSource()
|
oControl.RefreshDataSource()
|
||||||
oControl.ForceInitialize()
|
oControl.ForceInitialize()
|
||||||
|
|
||||||
|
|
||||||
AddHandler oView.CellValueChanged, AddressOf HandleCellValueChanged
|
|
||||||
AddHandler oView.CustomRowCellEdit, Sub(sender As Object, e As CustomRowCellEditEventArgs)
|
AddHandler oView.CustomRowCellEdit, Sub(sender As Object, e As CustomRowCellEditEventArgs)
|
||||||
For Each oRow As DataRow In DT_MY_COLUMNS.Rows
|
For Each oRow As DataRow In DT_MY_COLUMNS.Rows
|
||||||
If oRow.Item("SPALTENNAME") = e.Column.FieldName Then
|
If oRow.Item("SPALTENNAME") = e.Column.FieldName Then
|
||||||
If GridTables.ContainsKey(e.Column.FieldName) Then
|
If GridTables.Item(oControl.Name).ContainsKey(e.Column.FieldName) Then
|
||||||
Dim oComboboxDataTable As DataTable = GridTables.Item(e.Column.FieldName)
|
Dim oComboboxDataTable As DataTable = GridTables.Item(oControl.Name).Item(e.Column.FieldName)
|
||||||
|
|
||||||
If oRow.Item("ADVANCED_LOOKUP") Then
|
If oRow.Item("ADVANCED_LOOKUP") Then
|
||||||
Dim oEditor = New RepositoryItemLookupControl3()
|
Dim oEditor = New RepositoryItemLookupControl3 With {
|
||||||
|
.DataSource = oComboboxDataTable,
|
||||||
oEditor.DataSource = oComboboxDataTable
|
.DisplayMember = oComboboxDataTable.Columns.Item(0).ColumnName,
|
||||||
oEditor.DisplayMember = oComboboxDataTable.Columns.Item(0).ColumnName
|
.ValueMember = oComboboxDataTable.Columns.Item(0).ColumnName
|
||||||
oEditor.ValueMember = oComboboxDataTable.Columns.Item(0).ColumnName
|
}
|
||||||
|
|
||||||
e.RepositoryItem = oEditor
|
e.RepositoryItem = oEditor
|
||||||
Else
|
Else
|
||||||
@ -534,43 +539,42 @@ Public Class ClassControlCreator
|
|||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
AddHandler oView.CellValueChanged, Sub(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs)
|
||||||
|
Console.WriteLine("")
|
||||||
|
End Sub
|
||||||
|
|
||||||
AddHandler oView.ValidateRow, Sub(sender As Object, e As ValidateRowEventArgs)
|
AddHandler oView.ValidateRow, Sub(sender As Object, e As ValidateRowEventArgs)
|
||||||
Dim oRow As DataRowView = DirectCast(e.Row, DataRowView)
|
Console.WriteLine("")
|
||||||
For Each oCol As DataColumn In oRow.DataView.Table.Columns
|
|
||||||
Dim oColumn As DataRow = (From r As DataRow In DT_MY_COLUMNS.Rows
|
|
||||||
Where r.Item("SPALTENNAME") = oCol.ColumnName
|
|
||||||
Select r).FirstOrDefault()
|
|
||||||
|
|
||||||
Dim oIsRequired = oColumn.Item("VALIDATION")
|
|
||||||
Dim oValue = oRow.Item(oCol.ColumnName)
|
|
||||||
|
|
||||||
If oIsRequired And (oValue Is Nothing OrElse oValue.ToString = "") Then
|
|
||||||
e.Valid = False
|
|
||||||
e.ErrorText = $"Spalte {oColumn.Item("SPALTEN_HEADER")} muss ausgefüllt werden!"
|
|
||||||
Exit For
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
AddHandler oView.ValidatingEditor, Sub(sender As Object, e As BaseContainerValidateEditorEventArgs)
|
||||||
|
Dim oRow As DataRowView = oView.GetRow(oView.FocusedRowHandle)
|
||||||
|
|
||||||
|
For Each oCol As DataColumn In oRow.DataView.Table.Columns
|
||||||
|
Dim oColumn As DataRow = (From r As DataRow In DT_MY_COLUMNS.Rows
|
||||||
|
Where r.Item("SPALTENNAME") = oCol.ColumnName
|
||||||
|
Select r).FirstOrDefault()
|
||||||
|
|
||||||
|
Dim oIsRequired = oColumn.Item("VALIDATION")
|
||||||
|
Dim oValue As String = NotNull(e.Value, "")
|
||||||
|
|
||||||
|
If oValue.contains(" | ") Then
|
||||||
|
oValue = oValue.Split(" | ").ToList().First()
|
||||||
|
e.Value = oValue
|
||||||
|
End If
|
||||||
|
|
||||||
|
If oIsRequired And oValue = "" Then
|
||||||
|
e.Valid = False
|
||||||
|
e.ErrorText = $"Spalte {oColumn.Item("SPALTEN_HEADER")} muss ausgefüllt werden!"
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End Sub
|
||||||
|
|
||||||
Return oControl
|
Return oControl
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Shared Function HandleCellValueChanged(sender As Object, e As CellValueChangedEventArgs)
|
|
||||||
' TODO: Do the validation
|
|
||||||
Dim oCurrentView As GridView = DirectCast(sender, GridView)
|
|
||||||
Dim oCurrentControl As GridControl = oCurrentView.GridControl
|
|
||||||
Dim oCurrentDatasource As DataTable = oCurrentControl.DataSource
|
|
||||||
Dim oColumn = oCurrentDatasource.Columns.Item(e.Column.FieldName)
|
|
||||||
|
|
||||||
Dim oValue = e.Value.ToString()
|
|
||||||
Dim oView2 As GridView = TryCast(sender, GridView)
|
|
||||||
|
|
||||||
If oValue.Contains(" | ") Then
|
|
||||||
oValue = oValue.Split(" | ").ToList().Item(0)
|
|
||||||
oView2.SetRowCellValue(e.RowHandle, e.Column, oValue)
|
|
||||||
End If
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Public Shared Function CreateExistingLine(row As DataRow, designMode As Boolean) As LineLabel
|
Public Shared Function CreateExistingLine(row As DataRow, designMode As Boolean) As LineLabel
|
||||||
Dim control As LineLabel = CreateBaseControl(New LineLabel(), row, designMode)
|
Dim control As LineLabel = CreateBaseControl(New LineLabel(), row, designMode)
|
||||||
control.Text = "------------------------------"
|
control.Text = "------------------------------"
|
||||||
|
|||||||
@ -165,6 +165,9 @@
|
|||||||
<Reference Include="DigitalData.Modules.EDMI.API">
|
<Reference Include="DigitalData.Modules.EDMI.API">
|
||||||
<HintPath>..\..\..\DDMonorepo\Modules.EDMIAPI\bin\Debug\DigitalData.Modules.EDMI.API.dll</HintPath>
|
<HintPath>..\..\..\DDMonorepo\Modules.EDMIAPI\bin\Debug\DigitalData.Modules.EDMI.API.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="DigitalData.Modules.Language">
|
||||||
|
<HintPath>..\..\..\DDMonorepo\Modules.Language\bin\Debug\DigitalData.Modules.Language.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="DigitalData.Modules.Logging">
|
<Reference Include="DigitalData.Modules.Logging">
|
||||||
<HintPath>..\..\..\DDMonorepo\Modules.Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
<HintPath>..\..\..\DDMonorepo\Modules.Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
|||||||
@ -13,6 +13,7 @@ Imports DigitalData.Controls.ChatControl
|
|||||||
Imports DevExpress.XtraEditors.Repository
|
Imports DevExpress.XtraEditors.Repository
|
||||||
Imports DigitalData.Modules.EDMI.API
|
Imports DigitalData.Modules.EDMI.API
|
||||||
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
||||||
|
Imports DevExpress.XtraGrid.Views.Grid
|
||||||
|
|
||||||
Public Class frmValidator
|
Public Class frmValidator
|
||||||
Dim strFileList()
|
Dim strFileList()
|
||||||
@ -358,9 +359,9 @@ Public Class frmValidator
|
|||||||
RibbonPageGroupConv_Change.Visible = False
|
RibbonPageGroupConv_Change.Visible = False
|
||||||
End If
|
End If
|
||||||
RepositoryItemComboBox3.Items.Clear()
|
RepositoryItemComboBox3.Items.Clear()
|
||||||
Dim oActiveConv As Boolean = False
|
Dim oActiveConv As Boolean = False
|
||||||
RibbonPageGroupConv_Change.Visible = True
|
RibbonPageGroupConv_Change.Visible = True
|
||||||
For Each oconv As String In oConversations
|
For Each oconv As String In oConversations
|
||||||
If Not oconv.Contains("Started") Then
|
If Not oconv.Contains("Started") Then
|
||||||
RepositoryItemComboBox3.Items.Add(oconv)
|
RepositoryItemComboBox3.Items.Add(oconv)
|
||||||
End If
|
End If
|
||||||
@ -369,16 +370,16 @@ Public Class frmValidator
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
Next
|
Next
|
||||||
If oActiveConv = False Then
|
If oActiveConv = False Then
|
||||||
btnitemConversationEnd.Enabled = False
|
btnitemConversationEnd.Enabled = False
|
||||||
btnitemConversation_reload.Enabled = False
|
btnitemConversation_reload.Enabled = False
|
||||||
SplitContainer2_DV_Chat.Collapsed = True
|
SplitContainer2_DV_Chat.Collapsed = True
|
||||||
Else
|
Else
|
||||||
If SplitContainer2_DV_Chat.Panel2.Visible = False Then
|
If SplitContainer2_DV_Chat.Panel2.Visible = False Then
|
||||||
SplitContainer2_DV_Chat.Panel2.Visible = True
|
SplitContainer2_DV_Chat.Panel2.Visible = True
|
||||||
End If
|
|
||||||
SplitContainer2_DV_Chat.Collapsed = False
|
|
||||||
End If
|
End If
|
||||||
|
SplitContainer2_DV_Chat.Collapsed = False
|
||||||
|
End If
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub frmValidation_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
|
Private Sub frmValidation_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
|
||||||
@ -398,7 +399,7 @@ Public Class frmValidator
|
|||||||
If INACTIVITY_DURATION <> 0 Then frmMain.Check_Timer_Inactivity()
|
If INACTIVITY_DURATION <> 0 Then frmMain.Check_Timer_Inactivity()
|
||||||
|
|
||||||
Try
|
Try
|
||||||
_frmValidatorSearch.Close()
|
_frmValidatorSearch.Close()
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
@ -1969,7 +1970,7 @@ Public Class frmValidator
|
|||||||
LOGGER.Debug($"Trying to fill the DropDown (DC) for ControlID [{oDEPENDING_CONTROL_ID}]..RowCount: [{oDTDEPENDING_RESULT.Rows.Count}] ")
|
LOGGER.Debug($"Trying to fill the DropDown (DC) for ControlID [{oDEPENDING_CONTROL_ID}]..RowCount: [{oDTDEPENDING_RESULT.Rows.Count}] ")
|
||||||
For Each oControl As Control In pnldesigner.Controls
|
For Each oControl As Control In pnldesigner.Controls
|
||||||
If DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid = oDEPENDING_CONTROL_ID Then
|
If DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid = oDEPENDING_CONTROL_ID Then
|
||||||
ClassControlCreator.GridTables.Add(oDEPENDING_COLUMN, oDTDEPENDING_RESULT)
|
ClassControlCreator.GridTables.Item(oControl.Name).Add(oDEPENDING_COLUMN, oDTDEPENDING_RESULT)
|
||||||
_dependingColumn_in_action = False
|
_dependingColumn_in_action = False
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
@ -2006,7 +2007,7 @@ Public Class frmValidator
|
|||||||
LOGGER.Debug($"Trying to fill the DropDown (DC) for ControlID [{oDEPENDING_CONTROL_ID}]..RowCount: [{oDTDEPENDING_RESULT.Rows.Count}] ")
|
LOGGER.Debug($"Trying to fill the DropDown (DC) for ControlID [{oDEPENDING_CONTROL_ID}]..RowCount: [{oDTDEPENDING_RESULT.Rows.Count}] ")
|
||||||
For Each oControl As Control In pnldesigner.Controls
|
For Each oControl As Control In pnldesigner.Controls
|
||||||
If DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid = oDEPENDING_CONTROL_ID Then
|
If DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid = oDEPENDING_CONTROL_ID Then
|
||||||
ClassControlCreator.GridTables.Add(oDEPENDING_COLUMN, oDTDEPENDING_RESULT)
|
ClassControlCreator.GridTables.Item(oControl.Name).Add(oDEPENDING_COLUMN, oDTDEPENDING_RESULT)
|
||||||
_dependingColumn_in_action = False
|
_dependingColumn_in_action = False
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
@ -3546,7 +3547,7 @@ Public Class frmValidator
|
|||||||
LOGGER.Debug($"Trying to create a DropDown(FIV) for oDEPENDING_CTRL_ID [{oDEPENDING_CTRL_ID}]..RowCount: [{oDTRESULT_FOR_COLUMN.Rows.Count}] ")
|
LOGGER.Debug($"Trying to create a DropDown(FIV) for oDEPENDING_CTRL_ID [{oDEPENDING_CTRL_ID}]..RowCount: [{oDTRESULT_FOR_COLUMN.Rows.Count}] ")
|
||||||
For Each oControl As Control In pnldesigner.Controls
|
For Each oControl As Control In pnldesigner.Controls
|
||||||
If DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid = oDEPENDING_CTRL_ID Then
|
If DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid = oDEPENDING_CTRL_ID Then
|
||||||
ClassControlCreator.GridTables.Add(oDEPENDING_COLUMN, oDTRESULT_FOR_COLUMN)
|
ClassControlCreator.GridTables.Item(oControl.Name).Add(oDEPENDING_COLUMN, oDTRESULT_FOR_COLUMN)
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
@ -3671,6 +3672,23 @@ Public Class frmValidator
|
|||||||
End Sub
|
End Sub
|
||||||
Private Sub btnSave_Click(sender As System.Object, e As System.EventArgs) Handles btnSave.Click
|
Private Sub btnSave_Click(sender As System.Object, e As System.EventArgs) Handles btnSave.Click
|
||||||
btnSave.Enabled = False
|
btnSave.Enabled = False
|
||||||
|
|
||||||
|
Dim oGrids = (From oControl In pnldesigner.Controls
|
||||||
|
Where TypeOf oControl Is GridControl
|
||||||
|
Select oControl).ToList()
|
||||||
|
|
||||||
|
For Each oGrid As GridControl In oGrids
|
||||||
|
Dim oView As GridView = oGrid.MainView
|
||||||
|
|
||||||
|
For index = 0 To oView.RowCount - 1
|
||||||
|
oView.FocusedRowHandle = index
|
||||||
|
oView.UpdateCurrentRow()
|
||||||
|
Next
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
Return
|
||||||
|
|
||||||
Finish_WFStep()
|
Finish_WFStep()
|
||||||
btnSave.Enabled = True
|
btnSave.Enabled = True
|
||||||
End Sub
|
End Sub
|
||||||
@ -5467,10 +5485,10 @@ Public Class frmValidator
|
|||||||
End If
|
End If
|
||||||
Conversations_Init_Rights()
|
Conversations_Init_Rights()
|
||||||
Conversations_load()
|
Conversations_load()
|
||||||
End If
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user