MS .6 nach WISAG1

This commit is contained in:
2020-01-24 10:23:26 +01:00
parent e0fae60798
commit 0ce34a3290
10 changed files with 1278 additions and 1236 deletions

View File

@@ -403,16 +403,16 @@ Public Class frmValidator
Sub LoadSQLData(control As Control, controlId As Integer)
Try
If TypeOf control Is Label Then Exit Sub
LOGGER.Debug($"in LoadSQLData for ControlID [{controlId}]...")
Dim oSql As String = $"SELECT GUID,NAME, CONNECTION_ID, SQL_UEBERPRUEFUNG FROM TBPM_PROFILE_CONTROLS WHERE GUID = {controlId} AND PROFIL_ID = {CURRENT_ProfilGUID} AND LEN(ISNULL(SQL_UEBERPRUEFUNG,'')) > 0 AND CTRL_TYPE <> 'BUTTON'"
' And SQL_UEBERPRUEFUNG Not Like '%#WMI#%' AND SQL_UEBERPRUEFUNG NOT LIKE '%#CTRL#%'
Dim dt As DataTable = ClassDatabase.Return_Datatable(oSql)
Dim oDTforControl As DataTable = ClassDatabase.Return_Datatable(oSql)
If IsNothing(dt) Then Exit Sub
If dt.Rows.Count = 0 Then Exit Sub
If IsNothing(oDTforControl) Then Exit Sub
If oDTforControl.Rows.Count = 0 Then Exit Sub
For Each row As DataRow In dt.Rows
For Each row As DataRow In oDTforControl.Rows
Dim name As String = row.Item("NAME")
Dim oGUID As String = row.Item("GUID")
'If clsPatterns.HasComplexPatterns(row.Item("SQL_UEBERPRUEFUNG")) Then
@@ -425,37 +425,37 @@ Public Class frmValidator
End If
If IsDBNull(row.Item("SQL_UEBERPRUEFUNG")) Then Continue For
Dim sqlStatement As String = row.Item("SQL_UEBERPRUEFUNG")
Dim connectionId As Integer = row.Item("CONNECTION_ID")
Dim oSQLStatement As String = row.Item("SQL_UEBERPRUEFUNG")
Dim oConnectionId As Integer = row.Item("CONNECTION_ID")
'If clsPatterns.HasComplexPatterns(sqlStatement) Then
' Continue For
'End If
If IsNothing(sqlStatement) Then
If IsNothing(oSQLStatement) Then
Continue For
End If
'oSql = clsPatterns.ReplaceUserValues(sqlStatement, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
'oSql = clsPatterns.ReplaceInternalValues(oSql)
sqlStatement = clsPatterns.ReplaceAllValues(sqlStatement, pnldesigner, CURRENT_WMFILE, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
If IsNothing(sqlStatement) Then
oSQLStatement = clsPatterns.ReplaceAllValues(oSQLStatement, pnldesigner, CURRENT_WMFILE, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
If IsNothing(oSQLStatement) Then
Continue For
End If
If clsPatterns.HasComplexPatterns(sqlStatement) Then
If clsPatterns.HasComplexPatterns(oSQLStatement) Then
LOGGER.Warn($"Unexpected error LoadSQLData2 - sql Statement still has complex patterns! [{oSql}]")
Continue For
End If
'sql = ClassPatterns.ReplaceInternalValues(sqlStatement)
dt = ClassDatabase.Return_Datatable_ConId(oSql, connectionId)
Dim oDTContent As DataTable = ClassDatabase.Return_Datatable_ConId(oSQLStatement, oConnectionId)
If IsNothing(dt) Then
LOGGER.Warn($"SQL-Query [{oSql}] for control {control.Name} is invalid.")
If IsNothing(oDTContent) Then
LOGGER.Warn($"SQL-Query [{oSQLStatement}] for control {control.Name} is invalid.")
Exit Sub
End If
Dim oValue
If TypeOf control Is TextBox Then
Try
Dim firstRow As DataRow = dt.Rows(0)
Dim firstRow As DataRow = oDTContent.Rows(0)
Dim value = firstRow.Item(0)
@@ -472,7 +472,7 @@ Public Class frmValidator
LOGGER.Debug($"oMyComboBox {oMyComboBox.Name} - Saving selected index {oselectedIndex}")
Dim list As New List(Of String)
For Each _row As DataRow In dt.Rows
For Each _row As DataRow In oDTContent.Rows
list.Add(_row.Item(0))
Next
@@ -487,7 +487,7 @@ Public Class frmValidator
Try
Dim lookup As LookupControl2 = control
lookup.DataSource = dt
lookup.DataSource = oDTContent
Catch ex As Exception
LOGGER.Error(ex)
clsLogger.Add("Error in LoadSimpleData for LookupControl2: " & ex.Message)
@@ -500,7 +500,7 @@ Public Class frmValidator
If oDataSource Is Nothing OrElse oDataSource.Rows.Count = 0 Then
'dataGridView.DataSource = dt
Dim oDatatable As DataTable = dt.Clone()
Dim oDatatable As DataTable = oDTContent.Clone()
For Each oColumn As DataColumn In oDatatable.Columns
If oDataSource.Columns(oColumn.ColumnName) Is Nothing Then
@@ -509,7 +509,7 @@ Public Class frmValidator
End If
Next
For Each oRow As DataRow In dt.Rows
For Each oRow As DataRow In oDTContent.Rows
oDataSource.ImportRow(oRow)
Next
@@ -530,16 +530,16 @@ Public Class frmValidator
Sub LoadSQLData2(control As Control, controlId As Integer)
Try
If TypeOf control Is Label Then Exit Sub
LOGGER.Debug($"in LoadSQLData2 for ControlID [{controlId}]...")
Dim oSql As String = $"SELECT GUID,NAME, CONNECTION_ID, SQL_UEBERPRUEFUNG FROM TBPM_PROFILE_CONTROLS WHERE GUID = {controlId} AND PROFIL_ID = {CURRENT_ProfilGUID} AND LEN(ISNULL(SQL_UEBERPRUEFUNG,'')) > 0 AND CTRL_TYPE <> 'BUTTON'"
' And SQL_UEBERPRUEFUNG Not Like '%#WMI#%' AND SQL_UEBERPRUEFUNG NOT LIKE '%#CTRL#%'
Dim dt As DataTable = ClassDatabase.Return_Datatable(oSql)
Dim oDTforControl As DataTable = ClassDatabase.Return_Datatable(oSql)
If IsNothing(dt) Then Exit Sub
If dt.Rows.Count = 0 Then Exit Sub
If IsNothing(oDTforControl) Then Exit Sub
If oDTforControl.Rows.Count = 0 Then Exit Sub
For Each row As DataRow In dt.Rows
For Each row As DataRow In oDTforControl.Rows
Dim oControlName As String = row.Item("NAME")
Dim oControlID As String = row.Item("GUID")
If IsDBNull(row.Item("CONNECTION_ID")) Then
@@ -557,9 +557,9 @@ Public Class frmValidator
Continue For
End If
'sql = ClassPatterns.ReplaceInternalValues(sqlStatement)
dt = ClassDatabase.Return_Datatable_ConId(oSql, oConnectionId)
oDTforControl = ClassDatabase.Return_Datatable_ConId(oSql, oConnectionId)
If IsNothing(dt) Then
If IsNothing(oDTforControl) Then
MsgBox($"SQL-Query for control {control.Name} is invalid.")
Exit Sub
End If
@@ -567,7 +567,7 @@ Public Class frmValidator
If TypeOf control Is TextBox Then
Try
Dim firstRow As DataRow = dt.Rows(0)
Dim firstRow As DataRow = oDTforControl.Rows(0)
Dim value = firstRow.Item(0)
@@ -584,7 +584,7 @@ Public Class frmValidator
LOGGER.Debug($"oMyComboBox {oMyComboBox.Name} - Saving selected index {oselectedIndex}")
Dim list As New List(Of String)
For Each _row As DataRow In dt.Rows
For Each _row As DataRow In oDTforControl.Rows
list.Add(_row.Item(0))
Next
@@ -599,7 +599,7 @@ Public Class frmValidator
Try
Dim lookup As LookupControl2 = control
lookup.DataSource = dt
lookup.DataSource = oDTforControl
Catch ex As Exception
LOGGER.Error(ex)
clsLogger.Add("Error in LoadSimpleData for LookupControl2: " & ex.Message)
@@ -612,7 +612,7 @@ Public Class frmValidator
If oDataSource Is Nothing OrElse oDataSource.Rows.Count = 0 Then
'dataGridView.DataSource = dt
Dim oDatatable As DataTable = dt.Clone()
Dim oDatatable As DataTable = oDTforControl.Clone()
For Each oColumn As DataColumn In oDatatable.Columns
If oDataSource.Columns(oColumn.ColumnName) Is Nothing Then
@@ -621,7 +621,7 @@ Public Class frmValidator
End If
Next
For Each oRow As DataRow In dt.Rows
For Each oRow As DataRow In oDTforControl.Rows
oDataSource.ImportRow(oRow)
Next