2.4.1.7 Logging SQL from Task, replacing '

This commit is contained in:
2020-06-05 13:49:20 +02:00
parent fcf3ad53a4
commit 386e3b62b5
25 changed files with 892 additions and 473 deletions

View File

@@ -116,7 +116,7 @@ Public Class frmFormDesigner
Private Sub frmFormDesigner_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
If ProfileId > 0 Then
Dim sql As String = $"SELECT NAME, INDEX_NAME FROM TBPM_PROFILE_CONTROLS WHERE PROFIL_ID = {ProfileId} AND CTRL_TYPE NOT IN ('BUTTON','LBL','LINE')"
Dim dt As DataTable = ClassDatabase.Return_Datatable(sql)
Dim dt As DataTable = ClassDatabase.Return_Datatable(sql, "frmFormDesigner_FormClosing")
Dim missingIndexControls As New List(Of String)
@@ -267,7 +267,7 @@ Public Class frmFormDesigner
SetMovementHandlers(dgv)
Case "TABLE"
Dim oDTColumnsPerDevExGrid As DataTable = ClassDatabase.Return_Datatable($"SELECT * FROM TBPM_CONTROL_TABLE WHERE CONTROL_ID = {guid} ORDER BY [SEQUENCE]")
Dim oDTColumnsPerDevExGrid As DataTable = ClassDatabase.Return_Datatable($"SELECT * FROM TBPM_CONTROL_TABLE WHERE CONTROL_ID = {guid} ORDER BY [SEQUENCE]", "FDesignLaodControls")
Dim table = ClassControlCreator.CreateExistingGridControl(row, oDTColumnsPerDevExGrid, True)
@@ -517,7 +517,7 @@ Public Class frmFormDesigner
Private Function GetLastID()
Dim sql = String.Format("SELECT MAX(GUID) FROM TBPM_PROFILE_CONTROLS WHERE PROFIL_ID = {0}", ProfileId)
Return ClassDatabase.Execute_Scalar(sql, CONNECTION_STRING, True)
Return ClassDatabase.Execute_Scalar(sql, CONNECTION_STRING, "GetLastID")
End Function
Sub SetActiveControlColor()
@@ -778,6 +778,7 @@ Public Class frmFormDesigner
obj.Indicies = indicies
obj.ReadOnly = StrToBool(row.Item("READ_ONLY"))
obj.Required = StrToBool(row.Item("VALIDATION"))
obj.Active = StrToBool(row.Item("CONTROL_ACTIVE"))
obj.Index = NotNull(row.Item("INDEX_NAME"), "")
obj.DefaultValue = NotNull(row.Item("DEFAULT_VALUE"), Nothing)
obj.SQLCommand = New SQLValue(row.Item("SQL_UEBERPRUEFUNG"))
@@ -787,8 +788,8 @@ Public Class frmFormDesigner
Private Sub LoadControlProperties(sender As Control)
Try
Dim props
Dim dt As DataTable = DD_DMSLiteDataSet.TBPM_PROFILE_CONTROLS
Dim row As DataRow
Dim oDatatable As DataTable = DD_DMSLiteDataSet.TBPM_PROFILE_CONTROLS
Dim oRow As DataRow
pgControls.Enabled = True
@@ -804,12 +805,12 @@ Public Class frmFormDesigner
Dim oControlId = DirectCast(sender.Tag, ClassControlCreator.ControlMetadata).Guid
row = dt.AsEnumerable().Where(Function(r As DataRow)
Return r.Item("GUID") = oControlId
End Function).SingleOrDefault()
oRow = oDatatable.AsEnumerable().Where(Function(r As DataRow)
Return r.Item("GUID") = oControlId
End Function).SingleOrDefault()
' Control-Id wurde nicht in DataRow gefunden
If IsNothing(row) Then
If IsNothing(oRow) Then
LOGGER.Info($"Error while filtering Controls by Guid '{oControlId}' in LoadControlProperties:")
MsgBox($"Control mit der Id {oControlId} wurde nicht gefunden!", MsgBoxStyle.Critical, "Fehler beim Laden der Control Eigenschaften")
@@ -826,83 +827,86 @@ Public Class frmFormDesigner
' Eigenschaften angelegt. Danach können für jeden Control Typ spezifische Eigenschaften festgelegt werden.
If TypeOf sender Is ClassControlCreator.LineLabel Then
Dim line As ClassControlCreator.LineLabel = sender
Dim lineProps As LineLabelProperties = CreatePropsObject(New LineLabelProperties, row)
Dim lineProps As LineLabelProperties = CreatePropsObject(New LineLabelProperties, oRow)
props = lineProps
ElseIf TypeOf sender Is Label Then
Dim label As Label = sender
Dim labelProps As LabelProperties = CreatePropsObject(New LabelProperties, row)
Dim labelProps As LabelProperties = CreatePropsObject(New LabelProperties, oRow)
labelProps.Text = label.Text
props = labelProps
ElseIf TypeOf sender Is CheckBox Then
Dim check As CheckBox = sender
Dim checkProps As CheckboxProperties = CreatePropsObjectWithIndicies(New CheckboxProperties, row, Source_AllIndicies)
Dim checkProps As CheckboxProperties = CreatePropsObjectWithIndicies(New CheckboxProperties, oRow, Source_AllIndicies)
checkProps.Text = check.Text
checkProps.Enable_SQL = New SQLValue(NotNull(row.Item("SQL_ENABLE"), ""))
checkProps.Enable_SQL_OnLoad = New SQLValue(NotNull(row.Item("SQL_ENABLE_ON_LOAD"), ""))
checkProps.Enable_SQL = New SQLValue(NotNull(oRow.Item("SQL_ENABLE"), ""))
checkProps.Enable_SQL_OnLoad = New SQLValue(NotNull(oRow.Item("SQL_ENABLE_ON_LOAD"), ""))
checkProps.SetControlData = New SQLValue(NotNull(oRow.Item("SET_CONTROL_DATA"), ""))
props = checkProps
ElseIf TypeOf sender Is TextBox Then
Dim txt As TextBox = sender
Dim txtProps As TextboxProperties = CreatePropsObjectWithIndicies(New TextboxProperties, row, Source_AllIndicies)
txtProps.Regex = NotNull(row.Item("REGEX_MATCH"), String.Empty)
txtProps.RegexMessage = NotNull(row.Item("REGEX_MESSAGE_DE"), String.Empty)
txtProps.Enable_SQL = New SQLValue(NotNull(row.Item("SQL_ENABLE"), ""))
txtProps.Enable_SQL_OnLoad = New SQLValue(NotNull(row.Item("SQL_ENABLE_ON_LOAD"), ""))
Dim txtProps As TextboxProperties = CreatePropsObjectWithIndicies(New TextboxProperties, oRow, Source_AllIndicies)
txtProps.Regex = NotNull(oRow.Item("REGEX_MATCH"), String.Empty)
txtProps.RegexMessage = NotNull(oRow.Item("REGEX_MESSAGE_DE"), String.Empty)
txtProps.Enable_SQL = New SQLValue(NotNull(oRow.Item("SQL_ENABLE"), ""))
txtProps.Enable_SQL_OnLoad = New SQLValue(NotNull(oRow.Item("SQL_ENABLE_ON_LOAD"), ""))
txtProps.SetControlData = New SQLValue(NotNull(oRow.Item("SET_CONTROL_DATA"), ""))
props = txtProps
ElseIf TypeOf sender Is ComboBox Then
Dim cmb As ComboBox = sender
Dim cmbProps As ComboboxProperties = CreatePropsObjectWithIndicies(New ComboboxProperties, row, Source_AllIndicies)
Dim cmbProps As ComboboxProperties = CreatePropsObjectWithIndicies(New ComboboxProperties, oRow, Source_AllIndicies)
cmbProps.ChoiceLists = Windream_ChoiceLists
cmbProps.ChoiceList = NotNull(row.Item("CHOICE_LIST"), String.Empty)
cmbProps.Enable_SQL = New SQLValue(NotNull(row.Item("SQL_ENABLE"), ""))
cmbProps.Enable_SQL_OnLoad = New SQLValue(NotNull(row.Item("SQL_ENABLE_ON_LOAD"), ""))
cmbProps.ChoiceList = NotNull(oRow.Item("CHOICE_LIST"), String.Empty)
cmbProps.Enable_SQL = New SQLValue(NotNull(oRow.Item("SQL_ENABLE"), ""))
cmbProps.Enable_SQL_OnLoad = New SQLValue(NotNull(oRow.Item("SQL_ENABLE_ON_LOAD"), ""))
cmbProps.SetControlData = New SQLValue(NotNull(oRow.Item("SET_CONTROL_DATA"), ""))
props = cmbProps
cmbProps.DisplayAsLookUpControl = False
ElseIf TypeOf sender Is DateTimePicker Then
Dim dtp As DateTimePicker = sender
Dim dtpProps As DatepickerProperties = CreatePropsObjectWithIndicies(New DatepickerProperties, row, Source_AllIndicies)
dtpProps.Enable_SQL = New SQLValue(NotNull(row.Item("SQL_ENABLE"), ""))
dtpProps.Enable_SQL_OnLoad = New SQLValue(NotNull(row.Item("SQL_ENABLE_ON_LOAD"), ""))
Dim dtpProps As DatepickerProperties = CreatePropsObjectWithIndicies(New DatepickerProperties, oRow, Source_AllIndicies)
dtpProps.Enable_SQL = New SQLValue(NotNull(oRow.Item("SQL_ENABLE"), ""))
dtpProps.Enable_SQL_OnLoad = New SQLValue(NotNull(oRow.Item("SQL_ENABLE_ON_LOAD"), ""))
props = dtpProps
ElseIf TypeOf sender Is DataGridView Then
Dim grid As DataGridView = sender
Dim gridProps As GridViewProperties = CreatePropsObjectWithIndicies(New GridViewProperties, row, Source_VectorIndicies)
Dim gridProps As GridViewProperties = CreatePropsObjectWithIndicies(New GridViewProperties, oRow, Source_VectorIndicies)
props = gridProps
ElseIf TypeOf sender Is LookupControl2 Then
Dim grid As LookupControl2 = sender
Dim lookupProps As LookupControlProperties = CreatePropsObjectWithIndicies(New LookupControlProperties, row, Source_AllIndicies)
lookupProps.MultiSelect = StrToBool(row.Item("MULTISELECT"))
lookupProps.PreventDuplicates = StrToBool(row.Item("VKT_PREVENT_MULTIPLE_VALUES"))
lookupProps.AllowAddNewValues = StrToBool(row.Item("VKT_ADD_ITEM"))
Dim lookupProps As LookupControlProperties = CreatePropsObjectWithIndicies(New LookupControlProperties, oRow, Source_AllIndicies)
lookupProps.MultiSelect = StrToBool(oRow.Item("MULTISELECT"))
lookupProps.PreventDuplicates = StrToBool(oRow.Item("VKT_PREVENT_MULTIPLE_VALUES"))
lookupProps.AllowAddNewValues = StrToBool(oRow.Item("VKT_ADD_ITEM"))
lookupProps.DisplayAsComboBox = False
lookupProps.Enable_SQL = New SQLValue(NotNull(row.Item("SQL_ENABLE"), ""))
lookupProps.Enable_SQL_OnLoad = New SQLValue(NotNull(row.Item("SQL_ENABLE_ON_LOAD"), ""))
lookupProps.SetControlData = New SQLValue(NotNull(row.Item("SET_CONTROL_DATA"), ""))
lookupProps.Enable_SQL = New SQLValue(NotNull(oRow.Item("SQL_ENABLE"), ""))
lookupProps.Enable_SQL_OnLoad = New SQLValue(NotNull(oRow.Item("SQL_ENABLE_ON_LOAD"), ""))
lookupProps.SetControlData = New SQLValue(NotNull(oRow.Item("SET_CONTROL_DATA"), ""))
props = lookupProps
ElseIf TypeOf sender Is GridControl Then
Dim oGridControl As GridControl = sender
Dim oGridProps As GridControlProperties = CreatePropsObjectWithIndicies(New GridControlProperties, row, Source_VectorIndicies)
oGridProps.AllowAddNewValues = StrToBool(row.Item("VKT_ADD_ITEM"))
oGridProps.Enable_SQL = New SQLValue(NotNull(row.Item("SQL_ENABLE"), ""))
oGridProps.Enable_SQL_OnLoad = New SQLValue(NotNull(row.Item("SQL_ENABLE_ON_LOAD"), ""))
Dim oGridProps As GridControlProperties = CreatePropsObjectWithIndicies(New GridControlProperties, oRow, Source_VectorIndicies)
oGridProps.AllowAddNewValues = StrToBool(oRow.Item("VKT_ADD_ITEM"))
oGridProps.Enable_SQL = New SQLValue(NotNull(oRow.Item("SQL_ENABLE"), ""))
oGridProps.Enable_SQL_OnLoad = New SQLValue(NotNull(oRow.Item("SQL_ENABLE_ON_LOAD"), ""))
props = oGridProps
ElseIf TypeOf sender Is Button Then
Dim oButton As Button = sender
Dim oButtonProps As ButtonProperties = CreatePropsObject(New ButtonProperties, row, Source_VectorIndicies)
Dim oButtonProps As ButtonProperties = CreatePropsObject(New ButtonProperties, oRow, Source_VectorIndicies)
oButtonProps.Text = oButton.Text
oButtonProps.SQLCommand = New SQLValue(row.Item("SQL_UEBERPRUEFUNG"))
oButtonProps.Override_SQL = New SQLValue(NotNull(row.Item("SQL2"), ""))
oButtonProps.Enable_SQL = New SQLValue(NotNull(row.Item("SQL_ENABLE"), ""))
oButtonProps.Enable_SQL_OnLoad = New SQLValue(NotNull(row.Item("SQL_ENABLE_ON_LOAD"), ""))
If Not IsDBNull(row.Item("IMAGE_CONTROL")) Then
Dim obimg() As Byte = row.Item("IMAGE_CONTROL")
oButtonProps.SQLCommand = New SQLValue(oRow.Item("SQL_UEBERPRUEFUNG"))
oButtonProps.Override_SQL = New SQLValue(NotNull(oRow.Item("SQL2"), ""))
oButtonProps.Enable_SQL = New SQLValue(NotNull(oRow.Item("SQL_ENABLE"), ""))
oButtonProps.Enable_SQL_OnLoad = New SQLValue(NotNull(oRow.Item("SQL_ENABLE_ON_LOAD"), ""))
If Not IsDBNull(oRow.Item("IMAGE_CONTROL")) Then
Dim obimg() As Byte = oRow.Item("IMAGE_CONTROL")
Dim oBitmap As Bitmap = ByteArrayToBitmap(obimg)
oButtonProps.CtrlImage = New ImageValue("IMAGE")
oButton.Image = oBitmap
@@ -1045,6 +1049,8 @@ Public Class frmFormDesigner
Case "RegexMessage"
UpdateSingleValue("REGEX_MESSAGE_DE", newValue)
Case "Active"
UpdateSingleValue("CONTROL_ACTIVE", IIf(newValue = True, 1, 0))
Case "CtrlImage"
Dim myPath As ImageValue = newValue
UpdateImage(myPath.Value)
@@ -1136,7 +1142,7 @@ Public Class frmFormDesigner
Try
CURRENT_DESIGN_TYPE = "SQL_BTNFINISH"
Dim oSQL = $"SELECT SQL_BTN_FINISH FROM TBPM_PROFILE WHERE GUID = {ProfileId}"
Dim oldSQL = ClassDatabase.Execute_Scalar(oSQL, CONNECTION_STRING)
Dim oldSQL = ClassDatabase.Execute_Scalar(oSQL, CONNECTION_STRING, "bbtnItemFinishSQL_ItemClick")
Dim oForm As New frmSQL_DESIGNER() With {.SQLCommand = oldSQL}
Dim oResult = oForm.ShowDialog()