From 12c36eeb92d4e1d47ea4f85d57b7474542cdb7c6 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Tue, 13 Jun 2023 09:12:45 +0200 Subject: [PATCH] WIP move grid functions to extra class --- app/TaskFlow/ClassControlCreator.vb | 294 +++++++-------------- app/TaskFlow/ControlCreator/Constants.vb | 21 ++ app/TaskFlow/ControlCreator/GridControl.vb | 215 +++++++++++++++ app/TaskFlow/TaskFlow.vbproj | 2 + app/TaskFlow/frmValidator.vb | 3 - 5 files changed, 332 insertions(+), 203 deletions(-) create mode 100644 app/TaskFlow/ControlCreator/Constants.vb create mode 100644 app/TaskFlow/ControlCreator/GridControl.vb diff --git a/app/TaskFlow/ClassControlCreator.vb b/app/TaskFlow/ClassControlCreator.vb index b016cad..43c7b8d 100644 --- a/app/TaskFlow/ClassControlCreator.vb +++ b/app/TaskFlow/ClassControlCreator.vb @@ -155,19 +155,6 @@ Public Class ClassControlCreator ' ----------------------- NEW CONTROLS ----------------------- - 'Public Function CreateNewTextBox(location As Point) As TextBox - ' Dim control As New TextBox With { - ' .Name = $"{PREFIX_TEXTBOX}_{clsTools.ShortGuid()}", - ' .Size = New Size(DEFAULT_WIDTH, DEFAULT_HEIGHT), - ' .Location = location, - ' .ReadOnly = True, - ' .BackColor = Color.White, - ' .Cursor = Cursors.Hand - ' } - - ' Return control - 'End Function - Public Function CreateNewTextBox(location As Point) As TextEdit Dim control As New TextEdit With { .Name = $"{PREFIX_TEXTBOX}_{clsTools.ShortGuid()}", @@ -264,9 +251,9 @@ Public Class ClassControlCreator .Name = $"{PREFIX_TABLE}_{clsTools.ShortGuid}", .Size = New Size(DEFAULT_WIDTH, DEFAULT_HEIGHT_TABLE), .Cursor = Cursors.Hand, - .Location = location + .Location = location, + .UseEmbeddedNavigator = True } - oControl.UseEmbeddedNavigator = True oControl.ForceInitialize() Dim oView As GridView = oControl.DefaultView oView.OptionsView.ShowGroupPanel = False @@ -302,37 +289,6 @@ Public Class ClassControlCreator ' ----------------------- EXISITING CONTROLS ----------------------- - 'Public Function CreateExistingTextbox(oControlRow As DataRow, designMode As Boolean) As TextBox - ' Try - ' Dim control As TextBox = CreateBaseControl(New TextBox(), oControlRow, designMode) - - ' control.BackColor = Color.White - - ' If oControlRow.Item("HEIGHT") > 27 Then - ' control.Multiline = True - - ' End If - - ' control.Height = oControlRow.Item("HEIGHT") - ' control.Width = oControlRow.Item("WIDTH") - - ' If Not designMode Then - ' control.AcceptsReturn = True - ' control.ReadOnly = oControlRow.Item("READ_ONLY") - ' control.TabStop = Not oControlRow.Item("READ_ONLY") - ' control.BackColor = IIf(oControlRow.Item("READ_ONLY"), Color.LightGray, Color.White) - ' control.ScrollBars = ScrollBars.Vertical - ' Else - ' control.ReadOnly = True - ' End If - - ' Return control - ' Catch ex As Exception - ' Logger.Error(ex) - ' End Try - - 'End Function - Public Function CreateExistingTextbox(oControlRow As DataRow, designMode As Boolean) As BaseEdit Try Dim oHeight = oControlRow.ItemEx("HEIGHT", 0) @@ -349,17 +305,11 @@ Public Class ClassControlCreator oControl = CreateBaseControl(New TextEdit(), oControlRow, designMode) End If - 'Dim oControl As TextEdit = CreateBaseControl(New TextEdit(), oControlRow, designMode) Dim oMeta As ControlMetadata = oControl.Tag oControl.BackColor = Color.White oMeta.BackColor = Color.White - ' TODO: Add separate function for MultilineEdit - 'If oControlRow.Item("HEIGHT") > 27 Then - ' control.Multiline = True - 'End If - oControl.Height = oHeight oControl.Width = oWidth @@ -380,10 +330,6 @@ Public Class ClassControlCreator oControl.Properties.EditFormat.FormatType = FormatType.Custom oControl.Properties.EditFormat.FormatString = ClassFormat.GetFormatString(oFormatString) End If - - 'TODO: Find alternatives for TextEdit - 'control.ScrollBars = ScrollBars.Vertical - 'control.AcceptsReturn = True Else oControl.ReadOnly = True End If @@ -391,6 +337,7 @@ Public Class ClassControlCreator Return oControl Catch ex As Exception Logger.Error(ex) + Return Nothing End Try End Function @@ -407,6 +354,7 @@ Public Class ClassControlCreator Return control End Function + Public Function CreateExistingButton(row As DataRow, designMode As Boolean) As Button Dim oControl As Button = CreateBaseControl(New Button(), row, designMode) @@ -524,9 +472,9 @@ Public Class ClassControlCreator End Function Public Function CreateExistingGridControl(row As DataRow, DT_MY_COLUMNS As DataTable, designMode As Boolean) As GridControl + Dim oGridControlCreator = New ControlCreator.GridControl(LogConfig, GridTables) Dim oControl As GridControl = CreateBaseControl(New GridControl(), row, designMode) Dim oControlId = DirectCast(oControl.Tag, ControlMetadata).Guid - Dim oDatatable As New DataTable Dim oView As GridView oControl.ForceInitialize() @@ -593,64 +541,8 @@ Public Class ClassControlCreator GridTables.Add(oControlId, New Dictionary(Of String, RepositoryItem)()) End If - For Each oRow As DataRow In DT_MY_COLUMNS.Rows - ' Create Columns in Datatable - - Dim oColumn = New DataColumn() With { - .ColumnName = oRow.Item("SPALTENNAME"), - .Caption = oRow.Item("SPALTEN_HEADER_LANG"), - .ReadOnly = False - } - Select Case oRow.Item("TYPE_COLUMN") - Case CONTROL_TYPE_TEXT - oColumn.DataType = GetType(String) - Case CONTROL_TYPE_INTEGER - oColumn.DataType = GetType(Integer) - Case CONTROL_TYPE_DOUBLE - oColumn.DataType = GetType(Double) - Case CONTROL_TYPE_CURRENCY - oColumn.DataType = GetType(Double) - Case CONTROL_TYPE_BOOLEAN - oColumn.DataType = GetType(Boolean) - Case Else - oColumn.DataType = GetType(String) - End Select - - oDatatable.Columns.Add(oColumn) - - ' Fetch and cache Combobox results - Dim oConnectionId As Integer = NotNull(oRow.Item("CONNECTION_ID"), 0) - Dim oSqlCommand As String = NotNull(oRow.Item("SQL_COMMAND"), "") - - If oConnectionId > 0 And oSqlCommand <> "" Then - Try - Dim oComboboxDataTable As DataTable = Nothing - Dim oColumnName As String = oRow.Item("SPALTENNAME") - Logger.Debug("Working on SQL for Column[{0}]...", oColumnName) - If Not clsPatterns.HasComplexPatterns(oSqlCommand) Then - Logger.Debug("SQL has no complex patterns!") - 'oComboboxDataTable = ClassDatabase.Return_Datatable_ConId(oSqlCommand, oConnectionId) - oComboboxDataTable = DatabaseFallback.GetDatatable(New GetDatatableOptions(oSqlCommand, DatabaseType.ECM) With { - .ConnectionId = oConnectionId - }) - Else - Logger.Debug("...has complex patterns!!") - End If - - Dim oRepositoryItem = GridTables_GetRepositoryItemForColumn(oColumnName, oComboboxDataTable, oRow.Item("ADVANCED_LOOKUP")) - - If GridTables.Item(oControlId).ContainsKey(oColumnName) Then - GridTables.Item(oControlId).Item(oColumnName) = oRepositoryItem - Else - GridTables.Item(oControlId).Add(oColumnName, oRepositoryItem) - End If - Catch ex As Exception - Logger.Warn("Could not load data for column {0} in control {1}", oRow.Item("SPALTENNAME"), oControl.Name) - Logger.Error(ex) - End Try - End If - Next - + Dim oDataTable = oGridControlCreator.CreateGridColumns(DT_MY_COLUMNS) + GridTables = oGridControlCreator.FillGridTables(DT_MY_COLUMNS, oControlId, oControl.Name) oView.PopulateColumns(oDatatable) oControl.DataSource = oDatatable oControl.RefreshDataSource() @@ -679,79 +571,80 @@ Public Class ClassControlCreator End Try End If - - Dim oShouldDisplayFooter As Boolean = False - - For Each oCol As GridColumn In oView.Columns - Dim oColumnData As DataRow = DT_MY_COLUMNS. - Select($"SPALTENNAME = '{oCol.FieldName}'"). - FirstOrDefault() - - If oColumnData Is Nothing Then - Continue For - End If - - Dim oSequence As Integer = oColumnData.Item("SEQUENCE") - oCol.VisibleIndex = oSequence - - Dim oColumnType As String = oColumnData.Item("TYPE_COLUMN") - - Select Case oColumnType - Case "INTEGER" - oCol.DisplayFormat.FormatType = FormatType.Custom - oCol.DisplayFormat.FormatString = "N0" - - Case "DOUBLE" - oCol.DisplayFormat.FormatType = FormatType.Custom - oCol.DisplayFormat.FormatString = "N2" - - Case "CURRENCY" - oCol.DisplayFormat.FormatType = FormatType.Custom - oCol.DisplayFormat.FormatString = "C2" - End Select - - Dim oSummaryFunction As String = oColumnData.Item("SUMMARY_FUNCTION") - - Select Case oSummaryFunction - Case AGGREGATE_TOTAL_INTEGER - oCol.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum - oCol.SummaryItem.DisplayFormat = "SUM: {0:N0}" - oShouldDisplayFooter = True - - Case AGGREGATE_TOTAL_FLOAT - oCol.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum - oCol.SummaryItem.DisplayFormat = "SUM: {0:N2}" - oShouldDisplayFooter = True - - Case AGGREGATE_TOTAL_CURRENCY - oCol.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum - oCol.SummaryItem.DisplayFormat = "SUM: {0:C2}" - oShouldDisplayFooter = True - - Case AGGREGATE_TOTAL_AVG - oCol.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Average - oCol.SummaryItem.DisplayFormat = "AVG: {0}" - oShouldDisplayFooter = True - - Case AGGREGATE_TOTAL_MAX - oCol.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Max - oCol.SummaryItem.DisplayFormat = "MAX: {0}" - oShouldDisplayFooter = True - - Case AGGREGATE_TOTAL_MIN - oCol.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Min - oCol.SummaryItem.DisplayFormat = "MIN: {0}" - oShouldDisplayFooter = True - - Case AGGREGATE_TOTAL_COUNT - oCol.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Count - oCol.SummaryItem.DisplayFormat = "NUM: {0}" - oShouldDisplayFooter = True - - End Select - Next - - oView.OptionsView.ShowFooter = oShouldDisplayFooter + oGridControlCreator.ConfigureViewColumns(DT_MY_COLUMNS, oView) + + ' Dim oShouldDisplayFooter As Boolean = False + ' + 'For Each oCol As GridColumn In oView.Columns + ' Dim oColumnData As DataRow = DT_MY_COLUMNS. + ' Select($"SPALTENNAME = '{oCol.FieldName}'"). + ' FirstOrDefault() + + ' If oColumnData Is Nothing Then + ' Continue For + ' End If + + ' Dim oSequence As Integer = oColumnData.Item("SEQUENCE") + ' oCol.VisibleIndex = oSequence + + ' Dim oColumnType As String = oColumnData.Item("TYPE_COLUMN") + + ' Select Case oColumnType + ' Case "INTEGER" + ' oCol.DisplayFormat.FormatType = FormatType.Custom + ' oCol.DisplayFormat.FormatString = "N0" + + ' Case "DOUBLE" + ' oCol.DisplayFormat.FormatType = FormatType.Custom + ' oCol.DisplayFormat.FormatString = "N2" + + ' Case "CURRENCY" + ' oCol.DisplayFormat.FormatType = FormatType.Custom + ' oCol.DisplayFormat.FormatString = "C2" + ' End Select + + ' Dim oSummaryFunction As String = oColumnData.Item("SUMMARY_FUNCTION") + + ' Select Case oSummaryFunction + ' Case AGGREGATE_TOTAL_INTEGER + ' oCol.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum + ' oCol.SummaryItem.DisplayFormat = "SUM: {0:N0}" + ' oShouldDisplayFooter = True + + ' Case AGGREGATE_TOTAL_FLOAT + ' oCol.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum + ' oCol.SummaryItem.DisplayFormat = "SUM: {0:N2}" + ' oShouldDisplayFooter = True + + ' Case AGGREGATE_TOTAL_CURRENCY + ' oCol.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum + ' oCol.SummaryItem.DisplayFormat = "SUM: {0:C2}" + ' oShouldDisplayFooter = True + + ' Case AGGREGATE_TOTAL_AVG + ' oCol.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Average + ' oCol.SummaryItem.DisplayFormat = "AVG: {0}" + ' oShouldDisplayFooter = True + + ' Case AGGREGATE_TOTAL_MAX + ' oCol.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Max + ' oCol.SummaryItem.DisplayFormat = "MAX: {0}" + ' oShouldDisplayFooter = True + + ' Case AGGREGATE_TOTAL_MIN + ' oCol.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Min + ' oCol.SummaryItem.DisplayFormat = "MIN: {0}" + ' oShouldDisplayFooter = True + + ' Case AGGREGATE_TOTAL_COUNT + ' oCol.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Count + ' oCol.SummaryItem.DisplayFormat = "NUM: {0}" + ' oShouldDisplayFooter = True + + ' End Select + 'Next + ' + ' oView.OptionsView.ShowFooter = oShouldDisplayFooter AddHandler oView.InitNewRow, Sub(sender As Object, e As InitNewRowEventArgs) Try @@ -817,18 +710,7 @@ Public Class ClassControlCreator AddHandler oView.ShowingEditor, AddressOf View_ShowingEditor AddHandler oView.ShownEditor, AddressOf View_ShownEditor AddHandler oView.ValidateRow, AddressOf View_ValidateRow - AddHandler oControl.LostFocus, Sub(sender As GridControl, e As EventArgs) - Dim oView2 As GridView = sender.FocusedView - - ' 19.08.2022: - ' Calling UpdateCurrentRow when newRowModified Is true - ' leads to some weird jumping of focus in the current cell. - ' This seems to fix it. - If newRowModified = False Then - oView2.UpdateCurrentRow() - End If - - End Sub + AddHandler oControl.LostFocus, AddressOf Control_LostFocus ' 08.11.2021: Fix editor being empty on first open oView.FocusInvalidRow() @@ -838,6 +720,18 @@ Public Class ClassControlCreator Private newRowModified As Boolean = False + Private Sub Control_LostFocus(sender As GridControl, e As EventArgs) + Dim oView2 As GridView = sender.FocusedView + + ' 19.08.2022: + ' Calling UpdateCurrentRow when newRowModified Is true + ' leads to some weird jumping of focus in the current cell. + ' This seems to fix it. + If newRowModified = False Then + oView2.UpdateCurrentRow() + End If + End Sub + Private Sub View_ShowingEditor(sender As Object, e As CancelEventArgs) Dim view As GridView = TryCast(sender, GridView) Logger.Debug("Showing editor.") diff --git a/app/TaskFlow/ControlCreator/Constants.vb b/app/TaskFlow/ControlCreator/Constants.vb new file mode 100644 index 0000000..fd5c4d3 --- /dev/null +++ b/app/TaskFlow/ControlCreator/Constants.vb @@ -0,0 +1,21 @@ +Namespace ControlCreator + Public Class Constants + Public Const CONTROL_TYPE_TEXT = "TEXT" + Public Const CONTROL_TYPE_INTEGER = "INTEGER" + Public Const CONTROL_TYPE_BOOLEAN = "BOOLEAN" + Public Const CONTROL_TYPE_DOUBLE = "DOUBLE" + Public Const CONTROL_TYPE_CURRENCY = "CURRENCY" + Public Const CONTROL_TYPE_DATE = "DATE" + Public Const CONTROL_TYPE_DATETIME = "DATETIME" + + Public Const AGGREGATE_NONE = "NONE" + Public Const AGGREGATE_TOTAL_INTEGER = "TOTAL_INTEGER" + Public Const AGGREGATE_TOTAL_FLOAT = "TOTAL_FLOAT" + Public Const AGGREGATE_TOTAL_CURRENCY = "TOTAL_CURRENCY" + Public Const AGGREGATE_TOTAL_MIN = "TOTAL_MIN" + Public Const AGGREGATE_TOTAL_MAX = "TOTAL_MAX" + Public Const AGGREGATE_TOTAL_AVG = "TOTAL_AVG" + Public Const AGGREGATE_TOTAL_COUNT = "TOTAL_COUNT" + End Class + +End Namespace diff --git a/app/TaskFlow/ControlCreator/GridControl.vb b/app/TaskFlow/ControlCreator/GridControl.vb new file mode 100644 index 0000000..2bb7f8d --- /dev/null +++ b/app/TaskFlow/ControlCreator/GridControl.vb @@ -0,0 +1,215 @@ +Imports DevExpress.Utils +Imports DevExpress.XtraEditors +Imports DevExpress.XtraEditors.Repository +Imports DevExpress.XtraGrid.Columns +Imports DevExpress.XtraGrid.Views.Grid +Imports DigitalData.Controls.LookupGrid +Imports DigitalData.Modules.EDMI.API.Constants +Imports DigitalData.Modules.EDMI.API.DatabaseWithFallback +Imports DigitalData.Modules.Logging +Imports DigitalData.Modules.Base +Imports System.ComponentModel + +Namespace ControlCreator + Public Class GridControl + Private ReadOnly _LogConfig As LogConfig + Private ReadOnly _GridTables As Dictionary(Of Integer, Dictionary(Of String, RepositoryItem)) + + Public Sub New(pLogConfig As LogConfig, pGridTables As Dictionary(Of Integer, Dictionary(Of String, RepositoryItem))) + _LogConfig = pLogConfig + _GridTables = pGridTables + End Sub + + Public Function CreateGridColumns(pColumnTable As DataTable) As DataTable + Dim oDataTable As New DataTable + + For Each oRow As DataRow In pColumnTable.Rows + ' Create Columns in Datatable + + Dim oColumn = New DataColumn() With { + .ColumnName = oRow.Item("SPALTENNAME"), + .Caption = oRow.Item("SPALTEN_HEADER_LANG"), + .ReadOnly = False + } + Select Case oRow.Item("TYPE_COLUMN") + Case Constants.CONTROL_TYPE_TEXT + oColumn.DataType = GetType(String) + Case Constants.CONTROL_TYPE_INTEGER + oColumn.DataType = GetType(Integer) + Case Constants.CONTROL_TYPE_DOUBLE + oColumn.DataType = GetType(Double) + Case Constants.CONTROL_TYPE_CURRENCY + oColumn.DataType = GetType(Double) + Case Constants.CONTROL_TYPE_BOOLEAN + oColumn.DataType = GetType(Boolean) + Case Else + oColumn.DataType = GetType(String) + End Select + + oDataTable.Columns.Add(oColumn) + Next + + Return oDataTable + End Function + + Public Function FillGridTables(pColumnTable As DataTable, pControlId As Integer, pControlName As String) As Dictionary(Of Integer, Dictionary(Of String, RepositoryItem)) + For Each oRow As DataRow In pColumnTable.Rows + ' Fetch and cache Combobox results + Dim oConnectionId As Integer = oRow.ItemEx("CONNECTION_ID", 0) + Dim oSqlCommand As String = oRow.ItemEx("SQL_COMMAND", "") + + If oConnectionId > 0 And oSqlCommand <> "" Then + Try + Dim oComboboxDataTable As DataTable = Nothing + Dim oColumnName As String = oRow.Item("SPALTENNAME") + LOGGER.Debug("Working on SQL for Column[{0}]...", oColumnName) + If Not clsPatterns.HasComplexPatterns(oSqlCommand) Then + LOGGER.Debug("SQL has no complex patterns!") + 'oComboboxDataTable = ClassDatabase.Return_Datatable_ConId(oSqlCommand, oConnectionId) + oComboboxDataTable = DatabaseFallback.GetDatatable(New GetDatatableOptions(oSqlCommand, DatabaseType.ECM) With { + .ConnectionId = oConnectionId + }) + Else + LOGGER.Debug("...has complex patterns!!") + End If + + Dim oRepositoryItem = GridTables_GetRepositoryItemForColumn(oColumnName, oComboboxDataTable, oRow.Item("ADVANCED_LOOKUP")) + + If _GridTables.Item(pControlId).ContainsKey(oColumnName) Then + _GridTables.Item(pControlId).Item(oColumnName) = oRepositoryItem + Else + _GridTables.Item(pControlId).Add(oColumnName, oRepositoryItem) + End If + Catch ex As Exception + LOGGER.Warn("Could not load data for column {0} in control {1}", oRow.Item("SPALTENNAME"), pControlName) + LOGGER.Error(ex) + End Try + End If + Next + + Return _GridTables + End Function + + Private Function GridTables_GetRepositoryItemForColumn(pColumnName As String, pDataTable As DataTable, pIsAdvancedLookup As Boolean) As RepositoryItem + If pIsAdvancedLookup Then + + Dim oEditor = New RepositoryItemLookupControl3 + + If pDataTable IsNot Nothing Then + oEditor.DisplayMember = pDataTable.Columns.Item(0).ColumnName + oEditor.ValueMember = pDataTable.Columns.Item(0).ColumnName + oEditor.DataSource = pDataTable + End If + + Return oEditor + Else + Dim oEditor = New RepositoryItemComboBox() + Dim oItems As New List(Of String) + + AddHandler oEditor.Validating, Sub(_sender As ComboBoxEdit, _e As CancelEventArgs) + If oItems.Contains(_sender.EditValue) Then + _e.Cancel = False + Else + _e.Cancel = True + End If + + End Sub + + If pDataTable IsNot Nothing Then + For Each oRow2 As DataRow In pDataTable.Rows + Dim oValue = oRow2.Item(0) + + Try + If oRow2.ItemArray.Length > 1 Then + oValue &= $" | {oRow2.Item(1)}" + End If + Catch ex As Exception + End Try + + oEditor.Items.Add(oValue) + oItems.Add(oValue) + Next + End If + + Return oEditor + End If + End Function + + Public Sub ConfigureViewColumns(pColumnTable As DataTable, pGridView As GridView) + Dim oShouldDisplayFooter As Boolean = False + + For Each oCol As GridColumn In pGridView.Columns + Dim oColumnData As DataRow = pColumnTable. + Select($"SPALTENNAME = '{oCol.FieldName}'"). + FirstOrDefault() + + If oColumnData Is Nothing Then + Continue For + End If + + Dim oSequence As Integer = oColumnData.Item("SEQUENCE") + oCol.VisibleIndex = oSequence + + Dim oColumnType As String = oColumnData.Item("TYPE_COLUMN") + + Select Case oColumnType + Case "INTEGER" + oCol.DisplayFormat.FormatType = FormatType.Custom + oCol.DisplayFormat.FormatString = "N0" + + Case "DOUBLE" + oCol.DisplayFormat.FormatType = FormatType.Custom + oCol.DisplayFormat.FormatString = "N2" + + Case "CURRENCY" + oCol.DisplayFormat.FormatType = FormatType.Custom + oCol.DisplayFormat.FormatString = "C2" + End Select + + Dim oSummaryFunction As String = oColumnData.Item("SUMMARY_FUNCTION") + + Select Case oSummaryFunction + Case Constants.AGGREGATE_TOTAL_INTEGER + oCol.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum + oCol.SummaryItem.DisplayFormat = "SUM: {0:N0}" + oShouldDisplayFooter = True + + Case Constants.AGGREGATE_TOTAL_FLOAT + oCol.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum + oCol.SummaryItem.DisplayFormat = "SUM: {0:N2}" + oShouldDisplayFooter = True + + Case Constants.AGGREGATE_TOTAL_CURRENCY + oCol.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum + oCol.SummaryItem.DisplayFormat = "SUM: {0:C2}" + oShouldDisplayFooter = True + + Case Constants.AGGREGATE_TOTAL_AVG + oCol.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Average + oCol.SummaryItem.DisplayFormat = "AVG: {0}" + oShouldDisplayFooter = True + + Case Constants.AGGREGATE_TOTAL_MAX + oCol.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Max + oCol.SummaryItem.DisplayFormat = "MAX: {0}" + oShouldDisplayFooter = True + + Case Constants.AGGREGATE_TOTAL_MIN + oCol.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Min + oCol.SummaryItem.DisplayFormat = "MIN: {0}" + oShouldDisplayFooter = True + + Case Constants.AGGREGATE_TOTAL_COUNT + oCol.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Count + oCol.SummaryItem.DisplayFormat = "NUM: {0}" + oShouldDisplayFooter = True + + End Select + Next + + pGridView.OptionsView.ShowFooter = oShouldDisplayFooter + End Sub + End Class + + +End Namespace diff --git a/app/TaskFlow/TaskFlow.vbproj b/app/TaskFlow/TaskFlow.vbproj index 351f479..8271227 100644 --- a/app/TaskFlow/TaskFlow.vbproj +++ b/app/TaskFlow/TaskFlow.vbproj @@ -282,6 +282,8 @@ + + True True diff --git a/app/TaskFlow/frmValidator.vb b/app/TaskFlow/frmValidator.vb index e6c2a61..d143fc8 100644 --- a/app/TaskFlow/frmValidator.vb +++ b/app/TaskFlow/frmValidator.vb @@ -2445,9 +2445,6 @@ Public Class frmValidator End If End If - - - FillIndexValues(first) For Each oControl As Control In PanelValidatorControl.Controls