DAtabase integriert

This commit is contained in:
2023-05-22 16:55:44 +02:00
parent 2db575d944
commit c2deb54f11
114 changed files with 8526 additions and 14722 deletions

View File

@@ -283,7 +283,7 @@ Public Class ClassControlBuilder
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)
LOGGER.Debug(msg, False)
LOGGER.Debug(msg)
If IsNothing(sqlcommand) Then
Continue For
End If
@@ -291,7 +291,7 @@ Public Class ClassControlBuilder
' Versuchen, die RecordId zu ersetzen, falls eine existiert
sqlcommand = sqlcommand.ToUpper.Replace("@RECORD_ID", CURRENT_RECORD_ID)
msg = String.Format("sqlcommand-replaced1: {0}", sqlcommand)
LOGGER.Debug(msg, False)
LOGGER.Debug(msg)
' 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,11 +306,11 @@ 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)
LOGGER.Debug("" & 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))
' Jetzt wird das SQL Command ausgeführt, es MUSS einen Boolschen Wert zurückgeben, True, False, 0, 1
Dim dt_result As DataTable = Nothing
dt_result = ClassDatabase.Return_Datatable(sqlcommand)
dt_result = MYDB_ECM.GetDatatable(sqlcommand)
If dt_result.Rows.Count = 1 Then
Dim enabled As Boolean = True
@@ -324,14 +324,14 @@ Public Class ClassControlBuilder
If enabled = False Then
msg = String.Format("Control {0} will be disabled." & vbNewLine, dependingControlId.ToString)
LOGGER.Debug(msg, False)
LOGGER.Debug(msg)
Else
msg = String.Format("Control {0} will be enabled." & vbNewLine, dependingControlId.ToString)
LOGGER.Debug(msg, False)
LOGGER.Debug(msg)
End If
dependingControl.Enabled = enabled
Else
LOGGER.Warn("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 & "'")
End If
End If
@@ -381,7 +381,7 @@ Public Class ClassControlBuilder
End If
LOGGER.Debug("DependingControls - For Each row As DataRow In TableResult.Rows", False, False)
LOGGER.Debug("DependingControls - For Each row As DataRow In TableResult.Rows")
For Each row As DataRow In TableResult.Rows
Dim sqlcommand As String = row.Item("SQL_COMMAND_1")
@@ -394,7 +394,7 @@ Public Class ClassControlBuilder
Dim match As System.Text.RegularExpressions.Match = regex.Match(sqlcommand)
If match.Success Then
Dim sqlguid = String.Format("SELECT GUID FROM TBPMO_CONTROL_VALUE WHERE CONTROL_ID = {0} AND RECORD_ID = {1}", CONTROL_ID, CURRENT_RECORD_ID)
Dim ctrlvalID = ClassDatabase.Execute_Scalar(sqlguid, True)
Dim ctrlvalID = MYDB_ECM.ExecuteNonQuery(sqlguid)
' Diese Abfrage verhindert, dass Werte, die aus z.B. CheckedListBoxen kommen,
' nicht überschrieben werden. Diese Werte werden bereits mit UpdateMultipleValues gespeichert
@@ -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
LOGGER.Warn(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))
Else
ControlsChanged.Remove(CONTROL_ID)
End If
Else
LOGGER.Debug("ctrlvalID is Nothing - Attention.....", False, False)
LOGGER.Debug("ctrlvalID is Nothing - Attention.....")
If CURRENT_RECORD_ID <> 0 Then
If ClassControlCommandsUI.CreateControlProcedure(CONTROL_ID, CURRENT_RECORD_ID, value, CURRENT_ENTITY_ID) = 0 Then
LOGGER.Warn(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))
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
LOGGER.Debug("dependingControlId: " + dependingControlId.ToString, False, False)
LOGGER.Debug("dependingControlId: " + dependingControlId.ToString)
End If
Dim panel As Panel = Me.MasterPanel
'Dim panel As Panel = DirectCast(control.Parent, Panel)
@@ -435,9 +435,9 @@ Public Class ClassControlBuilder
End If
sqlcommand = sqlcommand.Replace(match.Groups(1).Value, value)
LOGGER.Debug("" & 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))
Dim dt As DataTable = ClassDatabase.Return_Datatable(sqlcommand, True)
Dim dt As DataTable = MYDB_ECM.GetDatatable(sqlcommand)
Dim type = dependingControl.GetType().Name
Select Case type
@@ -457,23 +457,23 @@ Public Class ClassControlBuilder
ControlLoader.DateTimePicker.LoadValue(dependingControl, dateValue)
Dim sql1 = String.Format("SELECT GUID FROM TBPMO_CONTROL_VALUE WHERE CONTROL_ID = {0} AND RECORD_ID = {1}", dependingControlId, CURRENT_RECORD_ID)
Dim id = ClassDatabase.Execute_Scalar(sql1, True)
Dim id = MYDB_ECM.ExecuteNonQuery(sql1)
If Not IsNothing(id) Then
'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)
LOGGER.Debug("Value was not nothing - Updated the ControlValue'", False) '" & upd)
LOGGER.Debug("Value was not nothing - Updated the ControlValue'") '" & upd)
Else
LOGGER.Warn("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 '") ' & upd & "'")
End If
Else
If ClassControlCommandsUI.CreateControlProcedure(dependingControlId, CURRENT_RECORD_ID, dateValue, CURRENT_ENTITY_ID) = 1 Then
ControlsChanged.Remove(dependingControlId)
LOGGER.Debug("Value was nothing - Inserted the ControlValue (DateEdit)!", False)
LOGGER.Debug("Value was nothing - Inserted the ControlValue (DateEdit)!")
Else
LOGGER.Warn(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))
End If
@@ -488,10 +488,10 @@ Public Class ClassControlBuilder
Case "CustomComboBox"
ControlLoader.Combobox.SetDataSource(DirectCast(dependingControl, CustomComboBox), dt)
Case "CheckedListBoxControl"
LOGGER.Debug("DependingControls - CheckedListBoxControl", False, False)
LOGGER.Debug("DependingControls - CheckedListBoxControl")
Dim checkedlistbox = DirectCast(dependingControl, DevExpress.XtraEditors.CheckedListBoxControl)
If IsNothing(checkedlistbox) Then
LOGGER.Debug("checkedlistbox is Nothing - Attention.....", False, False)
LOGGER.Debug("checkedlistbox is Nothing - Attention.....")
End If
ControlLoader.CheckedListBox.SetDataSource(checkedlistbox, dt)
@@ -520,17 +520,17 @@ Public Class ClassControlBuilder
Dim value1 As String = dt.Rows(0).Item(0)
ControlLoader.TextBox.LoadValue(DirectCast(dependingControl, TextBox), 9999, 9999, value1, 999, True)
Dim sqltextbox = String.Format("SELECT GUID FROM TBPMO_CONTROL_VALUE WHERE CONTROL_ID = {0} AND RECORD_ID = {1}", dependingControlId, CURRENT_RECORD_ID)
Dim id = ClassDatabase.Execute_Scalar(sqltextbox, True)
Dim id = MYDB_ECM.ExecuteNonQuery(sqltextbox)
If Not IsNothing(id) Then
If ClassControlCommandsUI.UpdateControlValue(dependingControlId, CURRENT_RECORD_ID, value1, CURRENT_ENTITY_ID) = True Then
LOGGER.Debug("Value was not nothing - Updated the ControlValue'", False) '" & upd)
LOGGER.Debug("Value was not nothing - Updated the ControlValue'") '" & upd)
ControlsChanged.Remove(dependingControlId)
Else
LOGGER.Warn(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))
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 MYDB_ECM.ExecuteNonQuery(upd) = True Then
' LOGGER.Debug("Value was not nothing - Updated the ControlValue '" & upd)
'Else
' Logger.Warn("Check Update depending control value as it was nothing and Update was not successful - Update-Command '" & upd & "'")
@@ -539,9 +539,9 @@ Public Class ClassControlBuilder
Else
If ClassControlCommandsUI.CreateControlProcedure(dependingControlId, CURRENT_RECORD_ID, value1, CURRENT_ENTITY_ID) = 1 Then
ControlsChanged.Remove(dependingControlId)
LOGGER.Debug("Value was nothing - Inserted the ControlValue (TextBox)!", False)
LOGGER.Debug("Value was nothing - Inserted the ControlValue (TextBox)!")
Else
LOGGER.Warn(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))
End If
@@ -593,8 +593,8 @@ Public Class ClassControlBuilder
Exit Sub
End If
Dim datatable As DataTable = ClassDatabase.Return_Datatable(SQL)
Dim datatable1 As DataTable = ClassDatabase.Return_Datatable(SQLenable)
Dim datatable As DataTable = MYDB_ECM.GetDatatable(SQL)
Dim datatable1 As DataTable = MYDB_ECM.GetDatatable(SQLenable)
Depending_Controls(control, datatable, value)
Enable_Controls(control, datatable1, value)
@@ -702,8 +702,8 @@ Public Class ClassControlBuilder
Exit Sub
End If
Dim datatable As DataTable = ClassDatabase.Return_Datatable(SQL)
Dim datatable1 As DataTable = ClassDatabase.Return_Datatable(SQLenable)
Dim datatable As DataTable = MYDB_ECM.GetDatatable(SQL)
Dim datatable1 As DataTable = MYDB_ECM.GetDatatable(SQLenable)
Depending_Controls(control, datatable, value)
Enable_Controls(control, datatable1, value)
@@ -785,11 +785,11 @@ Public Class ClassControlBuilder
'End If
Dim SQL1 As String = String.Format("SELECT * FROM VWPMO_VALUES WHERE RECORD_ID = {0}", CURRENT_RECORD_ID)
Dim DT_ControlValues As DataTable = ClassDatabase.Return_Datatable(SQL1, True)
Dim DT_ControlValues As DataTable = MYDB_ECM.GetDatatable(SQL1)
CURRENT_CONTROL_VALUES = DT_ControlValues
Dim datatable As DataTable = ClassDatabase.Return_Datatable(SQL, True)
Dim datatable1 As DataTable = ClassDatabase.Return_Datatable(SQLenable, True)
Dim datatable As DataTable = MYDB_ECM.GetDatatable(SQL)
Dim datatable1 As DataTable = MYDB_ECM.GetDatatable(SQLenable)
Depending_Controls(control, datatable, CONTROL_VALUE)
If IsNothing(CONTROL_VALUE) Then
Exit Sub
@@ -874,11 +874,11 @@ Public Class ClassControlBuilder
'End If
Dim SQL1 As String = String.Format("SELECT * FROM VWPMO_VALUES WHERE RECORD_ID = {0}", CURRENT_RECORD_ID)
Dim DT_ControlValues As DataTable = ClassDatabase.Return_Datatable(SQL1, True)
Dim DT_ControlValues As DataTable = MYDB_ECM.GetDatatable(SQL1)
CURRENT_CONTROL_VALUES = DT_ControlValues
Dim datatable As DataTable = ClassDatabase.Return_Datatable(SQL)
Dim datatable1 As DataTable = ClassDatabase.Return_Datatable(SQLenable)
Dim datatable As DataTable = MYDB_ECM.GetDatatable(SQL)
Dim datatable1 As DataTable = MYDB_ECM.GetDatatable(SQLenable)
Depending_Controls(control, datatable, CONTROL_VALUE)
If IsNothing(CONTROL_VALUE) Then
Exit Sub
@@ -907,7 +907,7 @@ Public Class ClassControlBuilder
If filter.IsEmpty Then
Try
Dim sql As String = $"SELECT VALUE FROM TBPMO_CONTROL_VALUE WHERE CONTROL_ID = {controlId} AND RECORD_ID = {recordId}"
Dim dt As DataTable = ClassDatabase.Return_Datatable(sql)
Dim dt As DataTable = MYDB_ECM.GetDatatable(sql)
Dim values As New List(Of Object)
For Each row As DataRow In dt.Rows
@@ -952,39 +952,10 @@ Public Class ClassControlBuilder
'End If
Dim datatable1 As DataTable = ClassDatabase.Return_Datatable(SQLenable)
Dim datatable1 As DataTable = MYDB_ECM.GetDatatable(SQLenable)
Enable_Controls(control, datatable1, checkstate)
'Dim sqlcommand As String = datatable.Rows(0).Item("SQL_COMMAND_1")
'If IsNothing(sqlcommand) Then
' Exit Sub
'End If
'If String.IsNullOrEmpty(value) Then
' Exit Sub
'End If
'Dim regex As New System.Text.RegularExpressions.Regex("(@(\d+)@)")
'Dim match As System.Text.RegularExpressions.Match = regex.Match(sqlcommand)
'If match.Success Then
' ' DependingControlId bezeichnet das Control, das die Abhängigkeit enthält
' Dim dependingControlId As Integer = datatable.Rows(0).Item("GUID")
' Dim panel As Panel = DirectCast(control.Parent, Panel)
' ' Über die Id das Control finden
' Dim dependingControl As CustomComboBox = panel.Controls.OfType(Of CustomComboBox)().Where(Function(c As CustomComboBox)
' Return DirectCast(c.Tag, ClassControlMetadata).Id = dependingControlId
' End Function).SingleOrDefault()
' sqlcommand = sqlcommand.Replace(match.Groups(1).Value, value)
' Console.WriteLine("Executing SQL_COMMAND: {0}", sqlcommand)
' Dim dt As DataTable = ClassDatabase.Return_Datatable(sqlcommand)
' ControlLoader.Combobox.SetDataSource(dependingControl, dt)
'End If
Console.WriteLine("value changed")
Catch ex As Exception
@@ -1503,7 +1474,7 @@ Public Class ClassControlBuilder
If sqlcommand.Contains("@RECORD_ID") Or sqlcommand.Contains("@RECORDID") Or sqlcommand.Contains("@ENTITY_ID") Or sqlcommand.Contains("@PARENTRECORD_ID") Or sqlcommand.Contains("@PARENTRECORDID") Then
result = Nothing
Else
result = ClassDatabase.Execute_Scalar(sqlcommand, True)
result = MYDB_ECM.ExecuteNonQuery(sqlcommand)
End If
If Not IsNothing(result) Then
If Not IsDBNull(result) Then
@@ -1622,7 +1593,7 @@ Public Class ClassControlBuilder
control.AutoCompleteSource = AutoCompleteSource.CustomSource
Dim suggestSource As New AutoCompleteStringCollection()
Dim dt As DataTable = ClassDatabase.Return_Datatable($"SELECT DISTINCT VALUE FROM VWPMO_VALUES WHERE CONTROL_ID = {id}")
Dim dt As DataTable = MYDB_ECM.GetDatatable($"SELECT DISTINCT VALUE FROM VWPMO_VALUES WHERE CONTROL_ID = {id}")
For Each row As DataRow In dt.Rows
suggestSource.Add(row.Item("VALUE"))
@@ -2528,7 +2499,7 @@ Public Class ClassControlBuilder
'Ja also überprüfen ob parametrisiert??
If Not sqlcommand.ToString.Contains("@") Then
'SQL-Command vorhanden also Ausführen des SQL
Dim DT_ListBox As DataTable = ClassDatabase.Return_Datatable(sqlcommand)
Dim DT_ListBox As DataTable = MYDB_ECM.GetDatatable(sqlcommand)
If DT_ListBox Is Nothing = False Then
If DT_ListBox.Rows.Count > 0 Then
control.DataSource = DT_ListBox
@@ -2638,7 +2609,7 @@ Public Class ClassControlBuilder
If sqlcommand.Length > 1 Then
If Not sqlcommand.ToString.Contains("@") Then
'SQL-Command vorhanden also Ausführen des SQL
Dim DT_ListBox As DataTable = ClassDatabase.Return_Datatable(sqlcommand)
Dim DT_ListBox As DataTable = MYDB_ECM.GetDatatable(sqlcommand)
If DT_ListBox Is Nothing = False Then
If DT_ListBox.Rows.Count > 0 Then
control.DataSource = DT_ListBox