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

@@ -162,7 +162,7 @@ Public Class ClassControlValues
sw.Done()
If controls.Count = 0 Then
ClassLogger.Add("the control-Collection in LoadControlValuesNeu is empty!", True)
LOGGER.Warn("the control-Collection in LoadControlValuesNeu is empty!")
If (Not isGroupbox) Then
ENTITY_RELOAD_AFT_CONTROL_LOAD = True
End If
@@ -205,7 +205,7 @@ Public Class ClassControlValues
sw.Done()
Catch ex As Exception
ClassLogger.Add("Unexpected Error in LoadControlValuesNeu: " & ex.Message, True)
LOGGER.Warn("Unexpected Error in LoadControlValuesNeu: " & ex.Message)
MsgBox("Error in LoadControlValuesNeu:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
@@ -223,7 +223,7 @@ Public Class ClassControlValues
Return RESULT
End If
Catch ex As Exception
ClassLogger.Add("Unexpected Error in GetControlValuesREC_CONTROL: " & ex.Message, True)
LOGGER.Warn("Unexpected Error in GetControlValuesREC_CONTROL: " & ex.Message)
MsgBox("Error in GetControlValuesREC_CONTROL:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
Return Nothing
End Try
@@ -276,8 +276,8 @@ Public Class ClassControlValues
ControlLoader.Checkbox.LoadValue(checkbox, value)
Case GetType(RadioButton)
If LogErrorsOnly = False Then ClassLogger.Add(" >> Sub LoadControlValueNeu - GetType(RadioButton) ", False)
Dim radiobutton As RadioButton = DirectCast(control, RadioButton)
LOGGER.Debug("Sub LoadControlValueNeu - GetType(RadioButton) ", False)
Dim radiobutton As RadioButton = DirectCast(control, RadioButton)
ControlLoader.RadioButton.LoadValue(radiobutton, value)
Case GetType(DevExpress.XtraEditors.DateEdit)
@@ -305,12 +305,12 @@ Public Class ClassControlValues
ControlLoader.DataGridViewCheckable.LoadValue(gridcontrol, values)
Case Else
If GetType(Control).ToString() <> "System.Windows.Forms.Control" Then
ClassLogger.Add(" >> Sub LoadControlValue - Control-Type nicht berücksichtigt: " & GetType(Control).ToString(), False)
End If
LOGGER.Warn("Sub LoadControlValue - Control-Type nicht berücksichtigt: " & GetType(Control).ToString(), False)
End If
End Select
'Catch ex As Exception
' ClassLogger.Add("Unexpected Error in LoadControlValue: " & ex.Message, True)
' Logger.Warn("Unexpected Error in LoadControlValue: " & ex.Message)
' MsgBox("Error in LoadControlValue:" & vbNewLine & ex.Message)
'End Try
@@ -322,7 +322,7 @@ Public Class ClassControlValues
If controls.Count = 0 Then
'MsgBox("LoadControlValuesList: Control.ControlCollection is unexpected empty!", MsgBoxStyle.Exclamation)
ClassLogger.Add("LoadControlValuesList: Control.ControlCollection is unexpected empty!")
LOGGER.Warn("LoadControlValuesList: Control.ControlCollection is unexpected empty!")
Exit Sub
End If
@@ -380,7 +380,7 @@ Public Class ClassControlValues
sw.Done()
Catch ex As Exception
ClassLogger.Add("Unexpected Error in LoadControlValuesList: " & ex.Message, True)
LOGGER.Warn("Unexpected Error in LoadControlValuesList: " & ex.Message)
MsgBox("Unexpected Error in LoadControlValuesList:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
@@ -391,7 +391,7 @@ Public Class ClassControlValues
Try
If controls.Count = 0 Then
'MsgBox("LoadControlValuesListWithPlaceholders: Control.ControlCollection is unexpected empty!", MsgBoxStyle.Exclamation)
ClassLogger.Add("LoadControlValuesListWithPlaceholders: Control.ControlCollection is unexpected empty!")
LOGGER.Warn("LoadControlValuesListWithPlaceholders: Control.ControlCollection is unexpected empty!")
Exit Sub
End If
@@ -428,7 +428,7 @@ Public Class ClassControlValues
End If
End If
Catch ex As Exception
ClassLogger.Add("Unexpected Error in Getting Parent-Record cause PRecord was 0: " & ex.Message)
LOGGER.Warn("Unexpected Error in Getting Parent-Record cause PRecord was 0: " & ex.Message)
End Try
End If
@@ -459,7 +459,7 @@ Public Class ClassControlValues
Next
sw.Done()
Catch ex As Exception
ClassLogger.Add("Unexpected Error in LoadControlValuesListWithPlaceholders: " & ex.Message, True)
LOGGER.Warn("Unexpected Error in LoadControlValuesListWithPlaceholders: " & ex.Message)
MsgBox("Unexpected Error in LoadControlValuesListWithPlaceholders:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
@@ -474,7 +474,7 @@ Public Class ClassControlValues
Try
If controls.Count = 0 Then
'MsgBox("LoadControlValuesListWithPlaceholders: Control.ControlCollection is unexpected empty!", MsgBoxStyle.Exclamation)
ClassLogger.Add("Enable_Depending_Controls: Control.ControlCollection is unexpected empty!")
LOGGER.Warn("Enable_Depending_Controls: Control.ControlCollection is unexpected empty!")
Exit Sub
End If
' Alle Controls finden, die Abhängigkeiten haben
@@ -490,12 +490,12 @@ Public Class ClassControlValues
' Durchlaufe alle Controls, die eine Abhängigheit haben
For Each row As DataRow In dt.Rows
Dim msg = String.Format(" >> Working on Depending Control-ID: {0}", row.Item("GUID").ToString)
If LogErrorsOnly = False Then ClassLogger.Add(msg, False)
Dim msg = String.Format("Working on Depending Control-ID: {0}", row.Item("GUID").ToString)
LOGGER.Debug(msg, False)
Dim DependingControlId As Integer = row.Item("GUID")
Dim DependingControlSQL As String = row.Item("SQL_COMMAND_2")
msg = String.Format(" >> SQL: {0}", DependingControlSQL)
If LogErrorsOnly = False Then ClassLogger.Add(msg, False)
msg = String.Format("SQL: {0}", DependingControlSQL)
LOGGER.Debug(msg, False)
Dim DependingControl As Control = controls.OfType(Of Control)().Where(Function(c As Control)
Return DirectCast(c.Tag, ClassControlMetadata).Id = DependingControlId
End Function).SingleOrDefault()
@@ -525,31 +525,31 @@ Public Class ClassControlValues
' Jetzt lesen wir den Wert aus, der im SQL Command ersetzt werden soll
Select Case otherControlType
Case "CheckBox"
msg = String.Format(" >> CheckBox-CtrlID: {0}", otherControlId)
If LogErrorsOnly = False Then ClassLogger.Add(msg, False)
msg = String.Format("CheckBox-CtrlID: {0}", otherControlId)
LOGGER.Debug(msg, False)
value = DirectCast(otherControl, CheckBox).Checked
Case "TextBox"
msg = String.Format(" >> TextBox-CtrlID: {0}", otherControlId)
If LogErrorsOnly = False Then ClassLogger.Add(msg, False)
msg = String.Format("TextBox-CtrlID: {0}", otherControlId)
LOGGER.Debug(msg, False)
value = DirectCast(otherControl, TextBox).Text
Case "CustomComboBox"
msg = String.Format(" >> CustomComboBox-CtrlID: {0}", otherControlId)
If LogErrorsOnly = False Then ClassLogger.Add(msg, False)
msg = String.Format("CustomComboBox-CtrlID: {0}", otherControlId)
LOGGER.Debug(msg, False)
value = DirectCast(otherControl, CustomComboBox).Text
Case "DateEdit"
msg = String.Format(" >> DateEdit-CtrlID: {0}", otherControlId)
If LogErrorsOnly = False Then ClassLogger.Add(msg, False)
msg = String.Format("DateEdit-CtrlID: {0}", otherControlId)
LOGGER.Debug(msg, False)
value = DirectCast(otherControl, DevExpress.XtraEditors.DateEdit).EditValue
End Select
' Jetzt ersetzen wir den Platzhalter im SQL Command
DependingControlSQL = regex.Replace(DependingControlSQL, value)
msg = String.Format(" >> DependingControlSQL: {0}", DependingControlSQL)
If LogErrorsOnly = False Then ClassLogger.Add(msg, False)
msg = String.Format("DependingControlSQL: {0}", DependingControlSQL)
LOGGER.Debug(msg, False)
Dim enableDT As DataTable = ClassDatabase.Return_Datatable(DependingControlSQL)
If IsNothing(enableDT) Then
msg = String.Format(">> enableDT is nothing!! CHECK SQL {0}." & vbNewLine, DependingControlSQL)
ClassLogger.Add(msg)
msg = String.Format("enableDT is nothing!! CHECK SQL {0}." & vbNewLine, DependingControlSQL)
LOGGER.Warn(msg)
Continue For
End If
If enableDT.Rows.Count = 1 Then
@@ -557,28 +557,28 @@ Public Class ClassControlValues
Try
enabled = CBool(enableDT.Rows(0).Item(0))
Catch ex As Exception
msg = String.Format(">> Could not convert value of tablecontent to boolean!! SQL {0} # tablecontent: {1}" & vbNewLine, DependingControlSQL, enableDT.Rows(0).Item(0).ToString)
ClassLogger.Add(msg)
msg = String.Format("Could not convert value of tablecontent to boolean!! SQL {0} # tablecontent: {1}" & vbNewLine, DependingControlSQL, enableDT.Rows(0).Item(0).ToString)
LOGGER.Warn(msg)
End Try
DependingControl.Enabled = enabled
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
Else
ClassLogger.Add(" >> Attention in Enable_Depending_Controls: RowCount for enabling control was '" & enableDT.Rows.Count.ToString & "' and not 1 as expected - Check SQL: '" & DependingControlSQL & "'")
LOGGER.Warn("Attention in Enable_Depending_Controls: RowCount for enabling control was '" & enableDT.Rows.Count.ToString & "' and not 1 as expected - Check SQL: '" & DependingControlSQL & "'")
End If
End If
Next
sw.done
Catch ex As Exception
ClassLogger.Add("Unexpected Error in Enable_Depending_Controls: " & ex.Message, True)
LOGGER.Warn("Unexpected Error in Enable_Depending_Controls: " & ex.Message, True)
MsgBox("Unexpected Error in Enable_Depending_Controls:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
@@ -591,7 +591,7 @@ Public Class ClassControlValues
sqlCommand = sqlCommand.Replace("@PARENTRECORDID", parentRecordId)
Return sqlCommand
Catch ex As Exception
ClassLogger.Add("Unexpected Error in ReplaceSqlCommandPlaceholders: " & ex.Message, True)
LOGGER.Warn("Unexpected Error in ReplaceSqlCommandPlaceholders: " & ex.Message)
MsgBox("Unexpected Error in ReplaceSqlCommandPlaceholders:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
Return sqlCommand
End Try
@@ -728,7 +728,7 @@ Public Class ClassControlValues
Dim control As Control = controls.Find(controlName, False)(0)
LoadDefaultValue(controlId, RecordID, Control, parentRecordID, EntityID, defaultValue)
Catch ex As Exception
ClassLogger.Add("Unexpected Error in getting default value for control '" & controlName & " - " & ex.Message, True)
LOGGER.Warn("Unexpected Error in getting default value for control '" & controlName & " - " & ex.Message, True)
End Try
Next
@@ -884,7 +884,7 @@ Public Class ClassControlValues
CURRENT_LAST_SQL = sql
Return ClassDatabase.Execute_Scalar(sql)
Catch ex As Exception
ClassLogger.Add("Unexpected Error in GetControlValueForControlID: " & ex.Message, True)
LOGGER.Warn("Unexpected Error in GetControlValueForControlID: " & ex.Message)
MsgBox("Error in GetControlValueForControlID:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
Return Nothing
End Try