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