MS V2.7 .Net Logger etc

This commit is contained in:
2021-06-15 16:28:55 +02:00
parent e2619eb3ad
commit e796ae91cb
109 changed files with 295499 additions and 8793 deletions

View File

@@ -256,7 +256,7 @@ Public Class ClassControlBuilder
Dim combo As CustomComboBox = sender
combo.BackColor = Color.LemonChiffon
Catch ex As Exception
ClassLogger.Add("Unexpected error in OnComboBoxFocus: " & ex.Message, True)
LOGGER.Warn("Unexpected error in OnComboBoxFocus: " & ex.Message)
End Try
End Sub
@@ -265,7 +265,7 @@ Public Class ClassControlBuilder
Dim combo As CustomComboBox = sender
combo.BackColor = Color.White
Catch ex As Exception
ClassLogger.Add("Unexpected error in OnComboBoxLostFocus: " & ex.Message, True)
LOGGER.Warn("Unexpected error in OnComboBoxLostFocus: " & ex.Message)
End Try
End Sub
@@ -282,16 +282,16 @@ Public Class ClassControlBuilder
End If
For Each row As DataRow In TableResult.Rows
Dim sqlcommand As String = row.Item("SQL_COMMAND_2")
Dim msg = String.Format(" >> Working on enabling control {0} - SQL: {1}", CONTROL_ID.ToString, sqlcommand)
If LogErrorsOnly = False Then ClassLogger.Add(msg, False)
Dim msg = String.Format("Working on enabling control {0} - SQL: {1}", CONTROL_ID.ToString, sqlcommand)
LOGGER.Debug(msg, False)
If IsNothing(sqlcommand) Then
Continue For
End If
' Versuchen, die RecordId zu ersetzen, falls eine existiert
sqlcommand = sqlcommand.ToUpper.Replace("@RECORD_ID", CURRENT_RECORD_ID)
msg = String.Format(" >> sqlcommand-replaced1: {0}", sqlcommand)
If LogErrorsOnly = False Then ClassLogger.Add(msg, False)
msg = String.Format("sqlcommand-replaced1: {0}", sqlcommand)
LOGGER.Debug(msg, False)
' ControlId Platzhalter suchen und ersetzen
Dim regex As New System.Text.RegularExpressions.Regex("(@(\d+)@)")
Dim match As System.Text.RegularExpressions.Match = regex.Match(sqlcommand)
@@ -306,7 +306,7 @@ Public Class ClassControlBuilder
End Function).SingleOrDefault()
' Wir ersetzen den platzhalter im sql command mit dem übergebenen wert
sqlcommand = sqlcommand.Replace(match.Groups(1).Value, value)
If LogErrorsOnly = False Then ClassLogger.Add(" >> " & String.Format("Executing SQL_COMMAND: {0} for controlID {1}", sqlcommand, dependingControlId), False)
LOGGER.Debug("" & String.Format("Executing SQL_COMMAND: {0} for controlID {1}", sqlcommand, dependingControlId), False)
' Jetzt wird das SQL Command ausgeführt, es MUSS einen Boolschen Wert zurückgeben, True, False, 0, 1
Dim dt_result As DataTable = Nothing
@@ -318,20 +318,20 @@ Public Class ClassControlBuilder
Try
enabled = CBool(dt_result.Rows(0).Item(0))
Catch ex As Exception
msg = String.Format(">> Could not convert value of tablecontent to boolean!! SQL {0} # tablecontent: {1}" & vbNewLine, sqlcommand, dependingControlId)
ClassLogger.Add(msg)
msg = String.Format("Could not convert value of tablecontent to boolean!! SQL {0} # tablecontent: {1}" & vbNewLine, sqlcommand, dependingControlId)
LOGGER.Warn(msg)
End Try
If enabled = False Then
msg = String.Format(" >> Control {0} will be disabled." & vbNewLine, dependingControlId.ToString)
If LogErrorsOnly = False Then ClassLogger.Add(msg, False)
msg = String.Format("Control {0} will be disabled." & vbNewLine, dependingControlId.ToString)
LOGGER.Debug(msg, False)
Else
msg = String.Format(" >> Control {0} will be enabled." & vbNewLine, dependingControlId.ToString)
If LogErrorsOnly = False Then ClassLogger.Add(msg, False)
msg = String.Format("Control {0} will be enabled." & vbNewLine, dependingControlId.ToString)
LOGGER.Debug(msg, False)
End If
dependingControl.Enabled = enabled
Else
ClassLogger.Add(" >> Attention: RowCount for enabling control (" & dependingControlId.ToString & ") was '" & dt_result.Rows.Count.ToString & "' and not 1 as expected - Check SQL: '" & sqlcommand & "'", False)
LOGGER.Warn("Attention: RowCount for enabling control (" & dependingControlId.ToString & ") was '" & dt_result.Rows.Count.ToString & "' and not 1 as expected - Check SQL: '" & sqlcommand & "'", False)
End If
End If
@@ -381,7 +381,7 @@ Public Class ClassControlBuilder
End If
If LogErrorsOnly = False Then ClassLogger.Add(" >> DependingControls - For Each row As DataRow In TableResult.Rows", False, False)
LOGGER.Debug("DependingControls - For Each row As DataRow In TableResult.Rows", False, False)
For Each row As DataRow In TableResult.Rows
Dim sqlcommand As String = row.Item("SQL_COMMAND_1")
@@ -402,15 +402,15 @@ Public Class ClassControlBuilder
If Not IsNothing(ctrlvalID) Then
If ClassControlCommandsUI.UpdateControlValue(CONTROL_ID, CURRENT_RECORD_ID, value.ToString, CURRENT_ENTITY_ID) = False Then
ClassLogger.Add(String.Format(" >> ClassControlCommandsUI.UpdateControlValue (1) was not successfull - ControlID: {0},RecordID: {1},value: {2}'", CONTROL_ID, CURRENT_RECORD_ID, value), False)
LOGGER.Warn(String.Format("ClassControlCommandsUI.UpdateControlValue (1) was not successfull - ControlID: {0},RecordID: {1},value: {2}'", CONTROL_ID, CURRENT_RECORD_ID, value), False)
Else
ControlsChanged.Remove(CONTROL_ID)
End If
Else
If LogErrorsOnly = False Then ClassLogger.Add(" >> ctrlvalID is Nothing - Attention.....", False, False)
LOGGER.Debug("ctrlvalID is Nothing - Attention.....", False, False)
If CURRENT_RECORD_ID <> 0 Then
If ClassControlCommandsUI.CreateControlProcedure(CONTROL_ID, CURRENT_RECORD_ID, value, CURRENT_ENTITY_ID) = 0 Then
ClassLogger.Add(String.Format(" >> ClassControlCommandsUI.CreateControlProcedure (1) was not successfull - ControlID: {0},RecordID: {1},value: {2}'", CONTROL_ID, CURRENT_RECORD_ID, value), False)
LOGGER.Warn(String.Format("ClassControlCommandsUI.CreateControlProcedure (1) was not successfull - ControlID: {0},RecordID: {1},value: {2}'", CONTROL_ID, CURRENT_RECORD_ID, value), False)
Else
ControlsChanged.Remove(CONTROL_ID)
End If
@@ -421,7 +421,7 @@ Public Class ClassControlBuilder
' DependingControlId bezeichnet das Control, das die Abhängigkeit enthält
Dim dependingControlId As Integer = row.Item("GUID")
If dependingControlId > 0 Then
If LogErrorsOnly = False Then ClassLogger.Add(">> dependingControlId: " + dependingControlId.ToString, False, False)
LOGGER.Debug("dependingControlId: " + dependingControlId.ToString, False, False)
End If
Dim panel As Panel = Me.MasterPanel
'Dim panel As Panel = DirectCast(control.Parent, Panel)
@@ -430,12 +430,12 @@ Public Class ClassControlBuilder
Return DirectCast(c.Tag, ClassControlMetadata).Id = dependingControlId
End Function).SingleOrDefault()
If IsNothing(dependingControl) Then
ClassLogger.Add(">> dependingControl is Nothing - Attention.....", True)
LOGGER.Warn("dependingControl is Nothing - Attention.....")
Continue For
End If
sqlcommand = sqlcommand.Replace(match.Groups(1).Value, value)
If LogErrorsOnly = False Then ClassLogger.Add(" >> " & String.Format("Executing SQL_COMMAND: '{0}' for controlID '{1}'", sqlcommand, dependingControlId), False)
LOGGER.Debug("" & String.Format("Executing SQL_COMMAND: '{0}' for controlID '{1}'", sqlcommand, dependingControlId), False)
Dim dt As DataTable = ClassDatabase.Return_Datatable(sqlcommand, True)
Dim type = dependingControl.GetType().Name
@@ -450,7 +450,7 @@ Public Class ClassControlBuilder
dateValue = CStr(CDate(val)) 'Format(val, "dd-MM-yyyy"))
Catch ex As Exception
If val <> "" Then
ClassLogger.Add("Unexpected Error in converting Value '" & value & "' to date - Control-ID: " & dependingControlId.ToString & "- Error: " & ex.Message)
LOGGER.Warn("Unexpected Error in converting Value '" & value & "' to date - Control-ID: " & dependingControlId.ToString & "- Error: " & ex.Message)
End If
Continue For
End Try
@@ -463,35 +463,35 @@ Public Class ClassControlBuilder
'Dim upd = String.Format("UPDATE TBPMO_CONTROL_VALUE SET VALUE = '{0}', CHANGED_WHO = '{1}' WHERE GUID = {2}", dateValue, USER_USERNAME, id)
If ClassControlCommandsUI.UpdateControlValue(dependingControlId, CURRENT_RECORD_ID, dateValue, CURRENT_ENTITY_ID) = True Then
ControlsChanged.Remove(dependingControlId)
If LogErrorsOnly = False Then ClassLogger.Add(" >> Value was not nothing - Updated the ControlValue'", False) '" & upd)
LOGGER.Debug("Value was not nothing - Updated the ControlValue'", False) '" & upd)
Else
ClassLogger.Add(" >> Check Update depending control (DateEdit) value as it was nothing and Update was not successful - Update-Command '", False) ' & upd & "'")
LOGGER.Warn("Check Update depending control (DateEdit) value as it was nothing and Update was not successful - Update-Command '", False) ' & upd & "'")
End If
Else
If ClassControlCommandsUI.CreateControlProcedure(dependingControlId, CURRENT_RECORD_ID, dateValue, CURRENT_ENTITY_ID) = 1 Then
ControlsChanged.Remove(dependingControlId)
If LogErrorsOnly = False Then ClassLogger.Add(" >> Value was nothing - Inserted the ControlValue (DateEdit)!", False)
LOGGER.Debug("Value was nothing - Inserted the ControlValue (DateEdit)!", False)
Else
ClassLogger.Add(String.Format(" >> ClassControlCommandsUI.InsertControlValue (DateEdit) was not successfull - ControlID: {0},RecordID: {1},value: {2}'", CONTROL_ID, CURRENT_RECORD_ID, dateValue), False)
LOGGER.Warn(String.Format("ClassControlCommandsUI.InsertControlValue (DateEdit) was not successfull - ControlID: {0},RecordID: {1},value: {2}'", CONTROL_ID, CURRENT_RECORD_ID, dateValue), False)
End If
End If
Catch ex As Exception
ClassLogger.Add("Unexpected Error in OnComboBoxValueChanged - TextBox: " & ex.Message, True)
LOGGER.Warn("Unexpected Error in OnComboBoxValueChanged - TextBox: " & ex.Message)
End Try
Else
ClassLogger.Add(" >> Attention: RowCount for depending control was '" & dt.Rows.Count.ToString & "' and not 1 as expected - Check SQL: '" & sqlcommand & "'")
LOGGER.Warn("Attention: RowCount for depending control was '" & dt.Rows.Count.ToString & "' and not 1 as expected - Check SQL: '" & sqlcommand & "'")
End If
Case "CustomComboBox"
ControlLoader.Combobox.SetDataSource(DirectCast(dependingControl, CustomComboBox), dt)
Case "CheckedListBoxControl"
If LogErrorsOnly = False Then ClassLogger.Add(" >> DependingControls - CheckedListBoxControl", False, False)
LOGGER.Debug("DependingControls - CheckedListBoxControl", False, False)
Dim checkedlistbox = DirectCast(dependingControl, DevExpress.XtraEditors.CheckedListBoxControl)
If IsNothing(checkedlistbox) Then
If LogErrorsOnly = False Then ClassLogger.Add(" >> checkedlistbox is Nothing - Attention.....", False, False)
LOGGER.Debug("checkedlistbox is Nothing - Attention.....", False, False)
End If
ControlLoader.CheckedListBox.SetDataSource(checkedlistbox, dt)
@@ -511,7 +511,7 @@ Public Class ClassControlBuilder
Try
ControlLoader.Label.LoadValue(DirectCast(dependingControl, Label), 9999, 9999, dt.Rows(0).Item(0).ToString, True)
Catch ex As Exception
ClassLogger.Add("Unexpectet Error in OnComboBoxValueChanged - Label: " & ex.Message, True)
LOGGER.Warn("Unexpectet Error in OnComboBoxValueChanged - Label: " & ex.Message)
End Try
End If
Case "TextBox"
@@ -524,33 +524,33 @@ Public Class ClassControlBuilder
If Not IsNothing(id) Then
If ClassControlCommandsUI.UpdateControlValue(dependingControlId, CURRENT_RECORD_ID, value1, CURRENT_ENTITY_ID) = True Then
If LogErrorsOnly = False Then ClassLogger.Add(" >> Value was not nothing - Updated the ControlValue'", False) '" & upd)
LOGGER.Debug("Value was not nothing - Updated the ControlValue'", False) '" & upd)
ControlsChanged.Remove(dependingControlId)
Else
ClassLogger.Add(String.Format(" >> ClassControlCommandsUI.UpdateControlValue (TextBox) was not successfull - ControlID: {0},RecordID: {1},value: {2}'", CONTROL_ID, CURRENT_RECORD_ID, value1), False)
LOGGER.Warn(String.Format("ClassControlCommandsUI.UpdateControlValue (TextBox) was not successfull - ControlID: {0},RecordID: {1},value: {2}'", CONTROL_ID, CURRENT_RECORD_ID, value1), False)
End If
'Dim upd = String.Format("UPDATE TBPMO_CONTROL_VALUE SET VALUE = '{0}', CHANGED_WHO = '{1}' WHERE GUID = {2}", value1, USER_USERNAME, id)
'If ClassDatabase.Execute_non_Query(upd) = True Then
' If LogErrorsOnly = False Then ClassLogger.Add(" >> Value was not nothing - Updated the ControlValue '" & upd)
' LOGGER.Debug("Value was not nothing - Updated the ControlValue '" & upd)
'Else
' ClassLogger.Add(" >> Check Update depending control value as it was nothing and Update was not successful - Update-Command '" & upd & "'")
' Logger.Warn("Check Update depending control value as it was nothing and Update was not successful - Update-Command '" & upd & "'")
'End If
Else
If ClassControlCommandsUI.CreateControlProcedure(dependingControlId, CURRENT_RECORD_ID, value1, CURRENT_ENTITY_ID) = 1 Then
ControlsChanged.Remove(dependingControlId)
If LogErrorsOnly = False Then ClassLogger.Add(" >> Value was nothing - Inserted the ControlValue (TextBox)!", False)
LOGGER.Debug("Value was nothing - Inserted the ControlValue (TextBox)!", False)
Else
ClassLogger.Add(String.Format(" >> ClassControlCommandsUI.InsertControlValue (TextBox) was not successfull - ControlID: {0},RecordID: {1},value: {2}'", CONTROL_ID, CURRENT_RECORD_ID, value1), False)
LOGGER.Warn(String.Format("ClassControlCommandsUI.InsertControlValue (TextBox) was not successfull - ControlID: {0},RecordID: {1},value: {2}'", CONTROL_ID, CURRENT_RECORD_ID, value1), False)
End If
End If
Catch ex As Exception
ClassLogger.Add("Unexpected Error in OnComboBoxValueChanged - TextBox: " & ex.Message, True)
LOGGER.Warn("Unexpected Error in OnComboBoxValueChanged - TextBox: " & ex.Message)
End Try
Else
ClassLogger.Add(" >> Attention: RowCount for depending control was '" & dt.Rows.Count.ToString & "' and not 1 as expected - Check SQL: '" & sqlcommand & "'")
LOGGER.Warn("Attention: RowCount for depending control was '" & dt.Rows.Count.ToString & "' and not 1 as expected - Check SQL: '" & sqlcommand & "'")
End If
Case "GridControl"
Dim gridControl = DirectCast(dependingControl, DevExpress.XtraGrid.GridControl)
@@ -920,7 +920,7 @@ Public Class ClassControlBuilder
ControlLoader.DataGridViewCheckable.LoadValue(gridView.GridControl, values)
IsCancelCheck = False
Catch ex As Exception
ClassLogger.Add("Error in OnFilterChanged: " & ex.Message)
LOGGER.Warn("Error in OnFilterChanged: " & ex.Message)
End Try
End If
End Sub
@@ -1956,7 +1956,7 @@ Public Class ClassControlBuilder
'End If
Catch ex As Exception
ClassLogger.Add("Unexpected error in AutoCompleteComboKEyUp: " & ex.Message, True)
LOGGER.Warn("Unexpected error in AutoCompleteComboKEyUp: " & ex.Message)
End Try
@@ -2544,7 +2544,7 @@ Public Class ClassControlBuilder
For Each Col As DataColumn In DT_ListBox.Columns
colstring = colstring & ";" & Col.ColumnName
Next
ClassLogger.Add("Error in Binding CheckedListBox: " & ex.Message & " - Columns: " & colstring)
LOGGER.Warn("Error in Binding CheckedListBox: " & ex.Message & " - Columns: " & colstring)
control.DisplayMember = DT_ListBox.Columns(0).ColumnName
End Try
End If
@@ -2574,7 +2574,7 @@ Public Class ClassControlBuilder
Me.AddToPanel(control)
End If
Catch ex As Exception
ClassLogger.Add("Unexpected Error in AddCheckedListBox: " & ex.Message)
LOGGER.Warn("Unexpected Error in AddCheckedListBox: " & ex.Message)
MsgBox("Error in AddCheckedListBox: " + vbNewLine + ex.Message)
End Try
End Sub