More logging for Class Control Creator
This commit is contained in:
@@ -13,6 +13,7 @@ Imports DevExpress.XtraGrid.Views.Grid
|
|||||||
Imports DigitalData.Controls.LookupGrid
|
Imports DigitalData.Controls.LookupGrid
|
||||||
Imports DigitalData.Modules.Language.Utils
|
Imports DigitalData.Modules.Language.Utils
|
||||||
Imports DigitalData.GUIs.Common
|
Imports DigitalData.GUIs.Common
|
||||||
|
Imports DigitalData.Modules.Logging
|
||||||
|
|
||||||
Public Class ClassControlCreator
|
Public Class ClassControlCreator
|
||||||
|
|
||||||
@@ -48,6 +49,8 @@ Public Class ClassControlCreator
|
|||||||
Public Const AGGREGATE_TOTAL_AVG = "TOTAL_AVG"
|
Public Const AGGREGATE_TOTAL_AVG = "TOTAL_AVG"
|
||||||
Public Const AGGREGATE_TOTAL_COUNT = "TOTAL_COUNT"
|
Public Const AGGREGATE_TOTAL_COUNT = "TOTAL_COUNT"
|
||||||
|
|
||||||
|
Public Shared Property Logger As Logger
|
||||||
|
|
||||||
''' <summary>
|
''' <summary>
|
||||||
''' Saves the column data for each grid and each column in that grid
|
''' Saves the column data for each grid and each column in that grid
|
||||||
''' </summary>
|
''' </summary>
|
||||||
@@ -120,7 +123,7 @@ Public Class ClassControlCreator
|
|||||||
|
|
||||||
Return ctrl
|
Return ctrl
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
LOGGER.Error(ex)
|
Logger.Error(ex)
|
||||||
Return Nothing
|
Return Nothing
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
@@ -288,7 +291,7 @@ Public Class ClassControlCreator
|
|||||||
|
|
||||||
Return control
|
Return control
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
LOGGER.Error(ex)
|
Logger.Error(ex)
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
End Function
|
End Function
|
||||||
@@ -524,8 +527,8 @@ Public Class ClassControlCreator
|
|||||||
GridTables.Item(oControlId).Add(oColumnName, oRepositoryItem)
|
GridTables.Item(oControlId).Add(oColumnName, oRepositoryItem)
|
||||||
End If
|
End If
|
||||||
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)
|
||||||
End Try
|
End Try
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
@@ -589,6 +592,8 @@ Public Class ClassControlCreator
|
|||||||
|
|
||||||
AddHandler oView.InitNewRow, Sub(sender As Object, e As InitNewRowEventArgs)
|
AddHandler oView.InitNewRow, Sub(sender As Object, e As InitNewRowEventArgs)
|
||||||
Try
|
Try
|
||||||
|
Logger.Debug("Initialzing new row")
|
||||||
|
|
||||||
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
|
||||||
If oGridColumn.FieldName <> oColumnData.Item("SPALTENNAME") Then
|
If oGridColumn.FieldName <> oColumnData.Item("SPALTENNAME") Then
|
||||||
@@ -598,12 +603,13 @@ Public Class ClassControlCreator
|
|||||||
Dim oDefaultValue = NotNull(oColumnData.Item("DEFAULT_VALUE"), String.Empty)
|
Dim oDefaultValue = NotNull(oColumnData.Item("DEFAULT_VALUE"), String.Empty)
|
||||||
|
|
||||||
If oDefaultValue <> String.Empty Then
|
If oDefaultValue <> String.Empty Then
|
||||||
|
Logger.Debug("Setting default value [{0}] for column [{0}]", oDefaultValue, oGridColumn.FieldName)
|
||||||
oView.SetRowCellValue(e.RowHandle, oGridColumn.FieldName, oDefaultValue)
|
oView.SetRowCellValue(e.RowHandle, oGridColumn.FieldName, oDefaultValue)
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
Next
|
Next
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
LOGGER.Error(ex)
|
Logger.Error(ex)
|
||||||
Finally
|
Finally
|
||||||
newRowModified = False
|
newRowModified = False
|
||||||
End Try
|
End Try
|
||||||
@@ -611,34 +617,40 @@ Public Class ClassControlCreator
|
|||||||
|
|
||||||
AddHandler oView.CustomRowCellEdit, Sub(sender As Object, e As CustomRowCellEditEventArgs)
|
AddHandler oView.CustomRowCellEdit, Sub(sender As Object, e As CustomRowCellEditEventArgs)
|
||||||
Try
|
Try
|
||||||
|
Logger.Debug("Assigning editors to cells.")
|
||||||
|
|
||||||
For Each oRow As DataRow In DT_MY_COLUMNS.Rows
|
For Each oRow As DataRow In DT_MY_COLUMNS.Rows
|
||||||
Dim oColumnName = oRow.Item("SPALTENNAME")
|
Dim oColumnName = oRow.Item("SPALTENNAME")
|
||||||
Dim oEditorExists = GridTables_TestEditorExistsByControlAndColumn(oControlId, oColumnName)
|
Dim oEditorExists = GridTables_TestEditorExistsByControlAndColumn(oControlId, oColumnName)
|
||||||
|
If oColumnName <> e.Column.FieldName Then
|
||||||
|
Continue For
|
||||||
|
End If
|
||||||
|
|
||||||
If oColumnName = e.Column.FieldName And oEditorExists Then
|
If oEditorExists Then
|
||||||
Dim oEditor = GridTables.Item(oControlId).Item(oColumnName)
|
Dim oEditor = GridTables.Item(oControlId).Item(oColumnName)
|
||||||
|
Logger.Debug("Assigning Editor to Column [{0}]", oColumnName)
|
||||||
e.RepositoryItem = oEditor
|
e.RepositoryItem = oEditor
|
||||||
|
Else
|
||||||
|
Logger.Debug("Editor for Column [{0}] does not exist", oColumnName)
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
LOGGER.Warn("Error in CustomRowCellEdit for [{0}]", e.CellValue)
|
Logger.Warn("Error in CustomRowCellEdit for [{0}]", e.CellValue)
|
||||||
LOGGER.Error(ex)
|
Logger.Error(ex)
|
||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
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)
|
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
|
' These handlers are all used for the custom DefaultValue functionality, additionally some code in the 'InitNewRow' event.
|
||||||
' https://supportcenter.devexpress.com/ticket/details/t1035580/how-to-default-a-value-in-a-column-when-add-new-row-in-data-grid
|
' 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
|
||||||
@@ -647,12 +659,13 @@ Public Class ClassControlCreator
|
|||||||
Return oControl
|
Return oControl
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Shared newRowModified As Boolean
|
Private Shared newRowModified As Boolean = False
|
||||||
|
|
||||||
Private Shared Sub View_ShowingEditor(sender As Object, e As CancelEventArgs)
|
Private Shared Sub View_ShowingEditor(sender As Object, e As CancelEventArgs)
|
||||||
Dim view As GridView = TryCast(sender, GridView)
|
Dim view As GridView = TryCast(sender, GridView)
|
||||||
|
Logger.Debug("Showing editor.")
|
||||||
If view.IsNewItemRow(view.FocusedRowHandle) AndAlso Not newRowModified Then
|
If view.IsNewItemRow(view.FocusedRowHandle) AndAlso Not newRowModified Then
|
||||||
|
Logger.Debug("Adding new row.")
|
||||||
view.AddNewRow()
|
view.AddNewRow()
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
@@ -660,8 +673,9 @@ Public Class ClassControlCreator
|
|||||||
Private Shared Sub View_ShownEditor(sender As Object, e As EventArgs)
|
Private Shared Sub View_ShownEditor(sender As Object, e As EventArgs)
|
||||||
Dim view As GridView = TryCast(sender, GridView)
|
Dim view As GridView = TryCast(sender, GridView)
|
||||||
If view.IsNewItemRow(view.FocusedRowHandle) Then
|
If view.IsNewItemRow(view.FocusedRowHandle) Then
|
||||||
|
Logger.Debug("Attaching Modified Handler.")
|
||||||
AddHandler view.ActiveEditor.Modified, Sub()
|
AddHandler view.ActiveEditor.Modified, Sub()
|
||||||
LOGGER.Debug("Row was modified")
|
Logger.Debug("Row was modified.")
|
||||||
newRowModified = True
|
newRowModified = True
|
||||||
End Sub
|
End Sub
|
||||||
End If
|
End If
|
||||||
@@ -670,12 +684,11 @@ Public Class ClassControlCreator
|
|||||||
Private Shared Sub View_ValidateRow(sender As Object, e As ValidateRowEventArgs)
|
Private Shared Sub View_ValidateRow(sender As Object, e As ValidateRowEventArgs)
|
||||||
Dim view As GridView = TryCast(sender, GridView)
|
Dim view As GridView = TryCast(sender, GridView)
|
||||||
If view.IsNewItemRow(e.RowHandle) AndAlso Not newRowModified Then
|
If view.IsNewItemRow(e.RowHandle) AndAlso Not newRowModified Then
|
||||||
LOGGER.Debug("Deleting unused row")
|
Logger.Debug("Deleting unused row")
|
||||||
view.DeleteRow(e.RowHandle)
|
view.DeleteRow(e.RowHandle)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
LOGGER.Debug("Validating row. Resetting Modified.")
|
Logger.Debug("Validating row. Resetting Modified.")
|
||||||
|
|
||||||
newRowModified = False
|
newRowModified = False
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -737,7 +750,7 @@ Public Class ClassControlCreator
|
|||||||
CURRENT_CONTROL_ID = row("GUID")
|
CURRENT_CONTROL_ID = row("GUID")
|
||||||
CURR_CON_ID = IIf(IsDBNull(row("CONNECTION_ID")), 0, row("CONNECTION_ID"))
|
CURR_CON_ID = IIf(IsDBNull(row("CONNECTION_ID")), 0, row("CONNECTION_ID"))
|
||||||
If CURR_CON_ID = 0 Then
|
If CURR_CON_ID = 0 Then
|
||||||
LOGGER.Info("CONNECTION NOT DEFINED - CTRL_GUID:" & CURRENT_CONTROL_ID)
|
Logger.Info("CONNECTION NOT DEFINED - CTRL_GUID:" & CURRENT_CONTROL_ID)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
CURR_SELECT_CONTROL = IIf(IsDBNull(row("SQL_UEBERPRUEFUNG")), "", row("SQL_UEBERPRUEFUNG"))
|
CURR_SELECT_CONTROL = IIf(IsDBNull(row("SQL_UEBERPRUEFUNG")), "", row("SQL_UEBERPRUEFUNG"))
|
||||||
@@ -748,8 +761,8 @@ Public Class ClassControlCreator
|
|||||||
Return 0
|
Return 0
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
LOGGER.Error(ex)
|
Logger.Error(ex)
|
||||||
LOGGER.Info("Unexpected Error in GET_CONTROL_PROPERTIES (" & ControlName & "):" & ex.Message)
|
Logger.Info("Unexpected Error in GET_CONTROL_PROPERTIES (" & ControlName & "):" & ex.Message)
|
||||||
Return 0
|
Return 0
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
@@ -775,8 +788,8 @@ Public Class ClassControlCreator
|
|||||||
Return Nothing
|
Return Nothing
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
LOGGER.Error(ex)
|
Logger.Error(ex)
|
||||||
LOGGER.Info("Unexpected Error in GET_CONTROL_PROPERTY (" & ControlGUID & "#" & ColNAME & "):" & ex.Message)
|
Logger.Info("Unexpected Error in GET_CONTROL_PROPERTY (" & ControlGUID & "#" & ColNAME & "):" & ex.Message)
|
||||||
Return Nothing
|
Return Nothing
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
@@ -795,8 +808,8 @@ Public Class ClassControlCreator
|
|||||||
|
|
||||||
Return True
|
Return True
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
LOGGER.Error(ex)
|
Logger.Error(ex)
|
||||||
LOGGER.Info("Unexpected Error in GET_DEPENDING_CONTROLS (" & ControlName & "):" & ex.Message)
|
Logger.Info("Unexpected Error in GET_DEPENDING_CONTROLS (" & ControlName & "):" & ex.Message)
|
||||||
Return 0
|
Return 0
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
@@ -816,8 +829,8 @@ Public Class ClassControlCreator
|
|||||||
Return Nothing
|
Return Nothing
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
LOGGER.Error(ex)
|
Logger.Error(ex)
|
||||||
LOGGER.Info("Unexpected Error in GET_CONNECTION_INFO (" & CON_ID.ToString & "):" & ex.Message)
|
Logger.Info("Unexpected Error in GET_CONNECTION_INFO (" & CON_ID.ToString & "):" & ex.Message)
|
||||||
Return Nothing
|
Return Nothing
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
@@ -841,7 +854,7 @@ Public Class ClassControlCreator
|
|||||||
oColumnDictionary.Add(pColumnName, oRepositoryItem)
|
oColumnDictionary.Add(pColumnName, oRepositoryItem)
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
LOGGER.Error(ex)
|
Logger.Error(ex)
|
||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -914,15 +927,15 @@ Public Class ClassControlCreator
|
|||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
LOGGER.Error(ex)
|
Logger.Error(ex)
|
||||||
End Try
|
End Try
|
||||||
Next
|
Next
|
||||||
' === End
|
' === End
|
||||||
|
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
LOGGER.Error(ex)
|
Logger.Error(ex)
|
||||||
LOGGER.Info("Unexpected Error in Display SQL result for grid column: " & oRow.Item("CONTROL_ID") & " - ERROR: " & ex.Message)
|
Logger.Info("Unexpected Error in Display SQL result for grid column: " & oRow.Item("CONTROL_ID") & " - ERROR: " & ex.Message)
|
||||||
End Try
|
End Try
|
||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
@@ -967,7 +980,7 @@ Public Class ClassControlCreator
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
LOGGER.Error(ex)
|
Logger.Error(ex)
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
If oIsRequired And pValue.ToString = "" Then
|
If oIsRequired And pValue.ToString = "" Then
|
||||||
|
|||||||
@@ -763,6 +763,8 @@ Public Class frmValidator
|
|||||||
|
|
||||||
Dim oTabIndexCounter As Integer = 0
|
Dim oTabIndexCounter As Integer = 0
|
||||||
|
|
||||||
|
ClassControlCreator.Logger = LOGCONFIG.GetLoggerFor("ControlCreator")
|
||||||
|
|
||||||
For Each oControlRow As DataRow In DT_CONTROLS.Rows
|
For Each oControlRow As DataRow In DT_CONTROLS.Rows
|
||||||
Dim oMyControl As Control
|
Dim oMyControl As Control
|
||||||
Dim oControlID = oControlRow.Item("GUID")
|
Dim oControlID = oControlRow.Item("GUID")
|
||||||
|
|||||||
Reference in New Issue
Block a user