jj: Add & Use ClassPatterns
This commit is contained in:
@@ -9,6 +9,7 @@ Imports Independentsoft
|
||||
Imports System.IO
|
||||
Imports DevExpress.Pdf.pdfdo
|
||||
Imports DevExpress.Pdf
|
||||
Imports System.Text.RegularExpressions
|
||||
|
||||
Public Class frmValidator
|
||||
Dim viewerID
|
||||
@@ -196,24 +197,24 @@ Public Class frmValidator
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
Private Function process_terminate(processname As String)
|
||||
Try
|
||||
Dim selectQuery As SelectQuery = New SelectQuery("Win32_Process")
|
||||
Dim searcher As ManagementObjectSearcher = New ManagementObjectSearcher(selectQuery)
|
||||
For Each proc As ManagementObject In searcher.Get
|
||||
If proc("Name").ToString = processname Then
|
||||
Dim s(1) As String
|
||||
proc.InvokeMethod("GetOwner", CType(s, Object()))
|
||||
If CStr(s(0)).ToLower.Contains(Environment.UserName.ToLower) Then
|
||||
proc.InvokeMethod("Terminate", Nothing)
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
Return False
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add(">> Fehler in process_terminate: " & ex.Message, True)
|
||||
End Try
|
||||
End Function
|
||||
'Private Function process_terminate(processname As String)
|
||||
' Try
|
||||
' Dim selectQuery As SelectQuery = New SelectQuery("Win32_Process")
|
||||
' Dim searcher As ManagementObjectSearcher = New ManagementObjectSearcher(selectQuery)
|
||||
' For Each proc As ManagementObject In searcher.Get
|
||||
' If proc("Name").ToString = processname Then
|
||||
' Dim s(1) As String
|
||||
' proc.InvokeMethod("GetOwner", CType(s, Object()))
|
||||
' If CStr(s(0)).ToLower.Contains(Environment.UserName.ToLower) Then
|
||||
' proc.InvokeMethod("Terminate", Nothing)
|
||||
' End If
|
||||
' End If
|
||||
' Next
|
||||
' Return False
|
||||
' Catch ex As Exception
|
||||
' ClassLogger.Add(">> Fehler in process_terminate: " & ex.Message, True)
|
||||
' End Try
|
||||
'End Function
|
||||
Sub Close_PDF_Viewer(vorherigefile As String)
|
||||
Try
|
||||
If vpdfviewer = "pdfxchange" Then
|
||||
@@ -342,7 +343,7 @@ Public Class frmValidator
|
||||
WD_Search = dr.Item("WD_SEARCH")
|
||||
finalProfile = dr.Item("FINAL_PROFILE")
|
||||
Move2Folder = dr.Item("MOVE2Folder")
|
||||
Dim sql = String.Format("SELECT RIGHT1 FROM TBDD_USER_MODULES WHERE USER_ID = {0} AND MODULE_ID = (SELECT GUID FROM TBDD_MODULES WHERE SHORT_NAME = 'PM')", CURRENT_USERID)
|
||||
Dim sql = String.Format("SELECT RIGHT1 FROM TBDD_USER_MODULES WHERE USER_ID = {0} AND MODULE_ID = (SELECT GUID FROM TBDD_MODULES WHERE SHORT_NAME = 'PM')", CURRENT_USER_ID)
|
||||
Right_Delete = CBool(ClassDatabase.Execute_Scalar(sql, MyConnectionString))
|
||||
|
||||
If CURRENT_JUMP_DOC_GUID <> 0 Then
|
||||
@@ -371,10 +372,12 @@ Public Class frmValidator
|
||||
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Right_Delete: " & Right_Delete.ToString, False)
|
||||
Load_Controls()
|
||||
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
Catch ex As System.Exception
|
||||
Catch ex As Exception
|
||||
MsgBox("Error SAVING Profile-Data:" & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Attention:")
|
||||
allgFunk.Insert_LogEntry(CURRENT_ProfilGUID, "Error SAVING Profile-Data: " & ex.Message, Environment.UserName)
|
||||
ClassLogger.Add(">> Fehler in SAVING Profile-Data: " & ex.Message, True)
|
||||
@@ -401,101 +404,149 @@ Public Class frmValidator
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Sub ComboBoxData(profileId As Integer, controlName As String)
|
||||
' Informationen über Profil und Control holen
|
||||
Dim ControlId As Integer = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetGUID(profileId, controlName)
|
||||
Dim ConnectionId As Integer
|
||||
Dim SQLCommand As String
|
||||
Sub LoadSimpleData(control As Control, controlId As Integer)
|
||||
If TypeOf control Is Label Then Exit Sub
|
||||
|
||||
If ControlId = 0 Then
|
||||
Exit Sub
|
||||
End If
|
||||
Dim sql As String = $"SELECT NAME, CONNECTION_ID, SQL_UEBERPRUEFUNG FROM TBPM_PROFILE_CONTROLS WHERE GUID = {controlId} AND PROFIL_ID = {CURRENT_ProfilGUID} AND LEN(ISNULL(SQL_UEBERPRUEFUNG,'')) > 0 AND SQL_UEBERPRUEFUNG NOT LIKE '%#WMI#%' AND SQL_UEBERPRUEFUNG NOT LIKE '%#CTRL#%'"
|
||||
Dim dt As DataTable = ClassDatabase.Return_Datatable(sql)
|
||||
|
||||
ConnectionId = TBPM_PROFILE_CONTROLSTableAdapter.cmdgetConnectionID(ControlId)
|
||||
If IsNothing(dt) Then Exit Sub
|
||||
If dt.Rows.Count = 0 Then Exit Sub
|
||||
|
||||
If ConnectionId = 0 Then
|
||||
Exit Sub
|
||||
End If
|
||||
For Each row As DataRow In dt.Rows
|
||||
Dim name As String = row.Item("NAME")
|
||||
|
||||
SQLCommand = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetSQL(ControlId)
|
||||
If IsDBNull(row.Item("CONNECTION_ID")) Then Continue For
|
||||
If IsDBNull(row.Item("SQL_UEBERPRUEFUNG")) Then Continue For
|
||||
|
||||
If SQLCommand = String.Empty Then
|
||||
Exit Sub
|
||||
End If
|
||||
Dim sqlStatement As String = row.Item("SQL_UEBERPRUEFUNG")
|
||||
Dim connectionId As Integer = row.Item("CONNECTION_ID")
|
||||
|
||||
TBDD_CONNECTIONTableAdapter.FillByID(DD_DMSLiteDataSet.TBDD_CONNECTION, ConnectionId)
|
||||
sql = ClassPatterns.ReplaceInternalValues(sqlStatement)
|
||||
dt = ClassDatabase.Return_Datatable(sqlStatement)
|
||||
|
||||
Dim connectionString As String
|
||||
If IsNothing(dt) Then
|
||||
MsgBox($"SQL-Query for control {control.Name} is invalid.")
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
For Each row As DataRow In DD_DMSLiteDataSet.TBDD_CONNECTION.Rows
|
||||
Select Case row.Item("SQL_PROVIDER").ToString().ToLower()
|
||||
Case "ms-sql"
|
||||
If row.Item("USERNAME") = "WINAUTH" Then
|
||||
connectionString = $"Data Source={row.Item("SERVER")};Initial Catalog=${row.Item("DATENBANK")};Trusted_Connection=True;"
|
||||
Else
|
||||
connectionString = $"Data Source={row.Item("SERVER")};Initial Catalog=${row.Item("DATENBANK")};User Id={row.Item("USERNAME")};Password={row.Item("PASSWORD")}"
|
||||
End If
|
||||
Case "oracle"
|
||||
Dim csBuilder As New OracleConnectionStringBuilder()
|
||||
If TypeOf control Is TextBox Then
|
||||
Dim firstRow As DataRow = dt.Rows(0)
|
||||
Dim value = firstRow.Item(0)
|
||||
|
||||
If row.Item("SERVER") <> String.Empty And Not IsDBNull(row.Item("SERVER")) Then
|
||||
connectionString = $"""
|
||||
Data Source=(
|
||||
DESCRIPTION=
|
||||
ADDRESS_LIST=
|
||||
(ADDRESS=
|
||||
(PROTOCOL=TCP)
|
||||
(HOST={row.Item("SERVER")})
|
||||
(PORT=1521)
|
||||
)
|
||||
)
|
||||
(CONNECT_DATA=
|
||||
(SERVER=DEDICATED)
|
||||
(SERVICE_NAME={row.Item("DATENBANK")})
|
||||
)
|
||||
)
|
||||
);User Id={row.Item("USERNAME")};Password={row.Item("PASSWORD")}
|
||||
"""
|
||||
Else
|
||||
csBuilder.DataSource = row.Item("SERVER")
|
||||
csBuilder.UserID = row.Item("USERNAME")
|
||||
csBuilder.Password = row.Item("PASSWORD")
|
||||
csBuilder.PersistSecurityInfo = True
|
||||
csBuilder.ConnectionTimeout = 120
|
||||
control.Text = value
|
||||
ElseIf TypeOf control Is ComboBox Then
|
||||
Dim comboxBox As ComboBox = control
|
||||
Dim list As New List(Of String)
|
||||
|
||||
connectionString = csBuilder.ConnectionString
|
||||
End If
|
||||
Case Else
|
||||
Exit Sub
|
||||
End Select
|
||||
For Each _row As DataRow In dt.Rows
|
||||
list.Add(_row.Item(0))
|
||||
Next
|
||||
|
||||
comboxBox.DataSource = list
|
||||
ElseIf TypeOf control Is DataGridView Then
|
||||
Dim dataGridView As DataGridView = control
|
||||
|
||||
dataGridView.DataSource = dt
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim items As New List(Of String)
|
||||
|
||||
Using adapter As New SqlClient.SqlDataAdapter()
|
||||
Using conn As New SqlClient.SqlConnection(connectionString)
|
||||
conn.Open()
|
||||
|
||||
Using cmd As New SqlClient.SqlCommand(SQLCommand, conn)
|
||||
|
||||
Dim dataSet As New DataSet()
|
||||
|
||||
adapter.SelectCommand = cmd
|
||||
adapter.Fill(dataSet)
|
||||
|
||||
Dim table = dataSet.Tables(0)
|
||||
|
||||
For Each row As DataRow In table.Rows
|
||||
items.Add(row.Item(0))
|
||||
Next
|
||||
End Using
|
||||
End Using
|
||||
End Using
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
'Sub ComboBoxData(profileId As Integer, controlName As String)
|
||||
' ' Informationen über Profil und Control holen
|
||||
' Dim ControlId As Integer = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetGUID(profileId, controlName)
|
||||
' Dim ConnectionId As Integer
|
||||
' Dim SQLCommand As String
|
||||
|
||||
' If ControlId = 0 Then
|
||||
' Exit Sub
|
||||
' End If
|
||||
|
||||
' ConnectionId = TBPM_PROFILE_CONTROLSTableAdapter.cmdgetConnectionID(ControlId)
|
||||
|
||||
' If ConnectionId = 0 Then
|
||||
' Exit Sub
|
||||
' End If
|
||||
|
||||
' SQLCommand = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetSQL(ControlId)
|
||||
|
||||
' If SQLCommand = String.Empty Then
|
||||
' Exit Sub
|
||||
' End If
|
||||
|
||||
' TBDD_CONNECTIONTableAdapter.FillByID(DD_DMSLiteDataSet.TBDD_CONNECTION, ConnectionId)
|
||||
|
||||
' Dim connectionString As String
|
||||
|
||||
' For Each row As DataRow In DD_DMSLiteDataSet.TBDD_CONNECTION.Rows
|
||||
' Select Case row.Item("SQL_PROVIDER").ToString().ToLower()
|
||||
' Case "ms-sql"
|
||||
' If row.Item("USERNAME") = "WINAUTH" Then
|
||||
' connectionString = $"Data Source={row.Item("SERVER")};Initial Catalog=${row.Item("DATENBANK")};Trusted_Connection=True;"
|
||||
' Else
|
||||
' connectionString = $"Data Source={row.Item("SERVER")};Initial Catalog=${row.Item("DATENBANK")};User Id={row.Item("USERNAME")};Password={row.Item("PASSWORD")}"
|
||||
' End If
|
||||
' Case "oracle"
|
||||
' Dim csBuilder As New OracleConnectionStringBuilder()
|
||||
|
||||
' If row.Item("SERVER") <> String.Empty And Not IsDBNull(row.Item("SERVER")) Then
|
||||
' connectionString = $"""
|
||||
' Data Source=(
|
||||
' DESCRIPTION=
|
||||
' ADDRESS_LIST=
|
||||
' (ADDRESS=
|
||||
' (PROTOCOL=TCP)
|
||||
' (HOST={row.Item("SERVER")})
|
||||
' (PORT=1521)
|
||||
' )
|
||||
' )
|
||||
' (CONNECT_DATA=
|
||||
' (SERVER=DEDICATED)
|
||||
' (SERVICE_NAME={row.Item("DATENBANK")})
|
||||
' )
|
||||
' )
|
||||
' );User Id={row.Item("USERNAME")};Password={row.Item("PASSWORD")}
|
||||
' """
|
||||
' Else
|
||||
' csBuilder.DataSource = row.Item("SERVER")
|
||||
' csBuilder.UserID = row.Item("USERNAME")
|
||||
' csBuilder.Password = row.Item("PASSWORD")
|
||||
' csBuilder.PersistSecurityInfo = True
|
||||
' csBuilder.ConnectionTimeout = 120
|
||||
|
||||
' connectionString = csBuilder.ConnectionString
|
||||
' End If
|
||||
' Case Else
|
||||
' Exit Sub
|
||||
' End Select
|
||||
' Next
|
||||
|
||||
' Dim items As New List(Of String)
|
||||
|
||||
' Using adapter As New SqlClient.SqlDataAdapter()
|
||||
' Using conn As New SqlClient.SqlConnection(connectionString)
|
||||
' conn.Open()
|
||||
|
||||
' Using cmd As New SqlClient.SqlCommand(SQLCommand, conn)
|
||||
|
||||
' Dim dataSet As New DataSet()
|
||||
|
||||
' adapter.SelectCommand = cmd
|
||||
' adapter.Fill(dataSet)
|
||||
|
||||
' Dim table = dataSet.Tables(0)
|
||||
|
||||
' For Each row As DataRow In table.Rows
|
||||
' items.Add(row.Item(0))
|
||||
' Next
|
||||
' End Using
|
||||
' End Using
|
||||
' End Using
|
||||
|
||||
|
||||
|
||||
'End Sub
|
||||
|
||||
Sub Load_Controls()
|
||||
Try
|
||||
pnldesigner.Controls.Clear()
|
||||
@@ -588,19 +639,26 @@ Public Class frmValidator
|
||||
|
||||
|
||||
sql = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetSQL(ControlID)
|
||||
sqlCnn = New SqlClient.SqlConnection(connectionString)
|
||||
' Try
|
||||
sqlCnn.Open()
|
||||
sqlCmd = New SqlClient.SqlCommand(sql, sqlCnn)
|
||||
adapter.SelectCommand = sqlCmd
|
||||
adapter.Fill(NewDataset)
|
||||
Dim msg As String
|
||||
For i = 0 To NewDataset.Tables(0).Rows.Count - 1
|
||||
cmb.Items.Add(NewDataset.Tables(0).Rows(i).Item(0))
|
||||
Next
|
||||
adapter.Dispose()
|
||||
sqlCmd.Dispose()
|
||||
sqlCnn.Close()
|
||||
|
||||
'sql = ClassPatterns.ReplaceAllValues(sql, pnldesigner, aktivesDokument)
|
||||
If ClassPatterns.HasOnlySimplePatterns(sql) Then
|
||||
sql = ClassPatterns.ReplaceInternalValues(sql)
|
||||
sql = ClassPatterns.ReplaceControlValues(sql, pnldesigner)
|
||||
|
||||
sqlCnn = New SqlClient.SqlConnection(connectionString)
|
||||
' Try
|
||||
sqlCnn.Open()
|
||||
sqlCmd = New SqlClient.SqlCommand(sql, sqlCnn)
|
||||
adapter.SelectCommand = sqlCmd
|
||||
adapter.Fill(NewDataset)
|
||||
Dim msg As String
|
||||
For i = 0 To NewDataset.Tables(0).Rows.Count - 1
|
||||
cmb.Items.Add(NewDataset.Tables(0).Rows(i).Item(0))
|
||||
Next
|
||||
adapter.Dispose()
|
||||
sqlCmd.Dispose()
|
||||
sqlCnn.Close()
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add(" - Unvorhergesehener Fehler bei GetValues SQL - Fehler: " & vbNewLine & ex.Message)
|
||||
MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler bei GetValues SQL:")
|
||||
@@ -691,6 +749,7 @@ Public Class frmValidator
|
||||
|
||||
pnldesigner.Controls.Add(ctrl)
|
||||
|
||||
LoadSimpleData(ctrl, dr.Item("GUID"))
|
||||
Next
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Controls geladen", False)
|
||||
ClassLogger.Add("", False)
|
||||
@@ -705,295 +764,6 @@ Public Class frmValidator
|
||||
|
||||
End Sub
|
||||
|
||||
'Function add_label(CONTROL_ID As Integer, lblname As String, text As String, x As Integer, y As Integer)
|
||||
' If LogErrorsOnly = False Then ClassLogger.Add(" >> In add_label - lblname: " & lblname & " x/y: " & x.ToString & "/" & y.ToString, False)
|
||||
' Dim lbl As New Label
|
||||
' lbl.Name = lblname
|
||||
' lbl.Text = text
|
||||
' lbl.AutoSize = True
|
||||
' lbl.Tag = CONTROL_ID
|
||||
' 'lbl.Size = New Size(CInt(lbl.Text.Length * 10), 16)
|
||||
' lbl.Location = New Point(x, y)
|
||||
' pnldesigner.Controls.Add(lbl)
|
||||
' If LogErrorsOnly = False Then ClassLogger.Add(" >> LBL: " & lblname & " hinzugefügt", False)
|
||||
'End Function
|
||||
Function add_textbox(CONTROL_ID As Integer, ByVal txtname As String, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal read_only As Boolean, loadindex As Boolean) 'idxName As String,
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> In add_textbox - txtname: " & txtname & " x/y: " & x.ToString & "/" & y.ToString, False)
|
||||
Dim txt As New TextBox
|
||||
txt.Name = txtname
|
||||
txt.Tag = CONTROL_ID
|
||||
If height > 27 Then
|
||||
txt.Multiline = True
|
||||
txt.AcceptsReturn = True
|
||||
Else
|
||||
txt.Multiline = False
|
||||
txt.AcceptsReturn = False
|
||||
End If
|
||||
If read_only = True Then
|
||||
txt.ReadOnly = True
|
||||
txt.TabStop = False
|
||||
'txt.Enabled = False
|
||||
End If
|
||||
txt.Size = New Size(width, height)
|
||||
txt.Location = New Point(x, y)
|
||||
pnldesigner.Controls.Add(txt)
|
||||
AddHandler txt.GotFocus, AddressOf OnTextBoxFocus
|
||||
AddHandler txt.LostFocus, AddressOf OnTextBoxLostFocus
|
||||
AddHandler txt.KeyUp, AddressOf OnTextBoxKeyUp
|
||||
If first_control Is Nothing And read_only = False Then
|
||||
first_control = txt
|
||||
End If
|
||||
last_control = txt
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> TXT: " & txtname & " hinzugefügt", False)
|
||||
End Function
|
||||
Function add_ComboBox(CONTROL_ID As Integer, cmbname As String, x As Integer, y As Integer, width As Integer, height As Integer, read_only As Boolean, loadindex As Boolean) 'idxName As String,
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> In add_ComboBox - cmbname: " & cmbname & " x/y: " & x.ToString & "/" & y.ToString, False)
|
||||
Dim cmb As New ComboBox
|
||||
cmb.Name = cmbname
|
||||
cmb.Size = New Size(width, height)
|
||||
cmb.Location = New Point(x, y)
|
||||
cmb.Tag = CONTROL_ID
|
||||
If read_only = True Then
|
||||
cmb.Enabled = False
|
||||
cmb.TabStop = False
|
||||
End If
|
||||
cmb.AutoCompleteMode = AutoCompleteMode.SuggestAppend
|
||||
cmb.AutoCompleteSource = AutoCompleteSource.ListItems
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> In add_ComboBox - Get GUID ", False)
|
||||
'Überprüfen ob es eine Auswahllsite gibt
|
||||
Dim ControlID = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetGUID(CURRENT_ProfilGUID, cmbname)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> In add_ComboBox - GUID: " & ControlID, False)
|
||||
If ControlID > 0 Then
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >>ControlID > 0", False)
|
||||
Dim ConID = Me.TBPM_PROFILE_CONTROLSTableAdapter.cmdgetConnectionID(ControlID)
|
||||
If ConID Is Nothing = False Then
|
||||
Dim commandsql = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetSQL(ControlID)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> ConID Is Nothing = False", False)
|
||||
If ConID > 0 And commandsql <> "" Then
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> CConID > 0 And TBPM_PROFILE_CONTROLSTableAdapter.cmdGetSQL(ControlID)", False)
|
||||
Dim connectionString As String
|
||||
TBDD_CONNECTIONTableAdapter.FillByID(DD_DMSLiteDataSet.TBDD_CONNECTION, ConID)
|
||||
Dim DT As DataTable = DD_DMSLiteDataSet.TBDD_CONNECTION
|
||||
Dim drConnection As DataRow
|
||||
For Each drConnection In DT.Rows
|
||||
Select Case drConnection.Item("SQL_PROVIDER").ToString.ToLower
|
||||
Case "ms-sql"
|
||||
If drConnection.Item("USERNAME") = "WINAUTH" Then
|
||||
connectionString = "Data Source=" & drConnection.Item("SERVER") & ";Initial Catalog=" & drConnection.Item("DATENBANK") & ";Trusted_Connection=True;"
|
||||
Else
|
||||
connectionString = "Data Source=" & drConnection.Item("SERVER") & ";Initial Catalog= " & drConnection.Item("DATENBANK") & ";User Id=" & drConnection.Item("USERNAME") & ";Password=" & drConnection.Item("PASSWORD") & ";"
|
||||
End If
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> ConnString Sql-Server: " & connectionString)
|
||||
Case "oracle"
|
||||
Dim conn As New OracleConnectionStringBuilder
|
||||
Dim connstr As String
|
||||
If drConnection.Item("SERVER") <> "" And drConnection.Item("DATENBANK").GetType.ToString <> "system.dbnull" Then
|
||||
connstr = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=" & drConnection.Item("SERVER") & ")(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=" &
|
||||
drConnection.Item("DATENBANK") & ")));User Id=" & drConnection.Item("USERNAME") & ";Password=" & drConnection.Item("PASSWORD") & ";"
|
||||
Else
|
||||
conn.DataSource = drConnection.Item("SERVER")
|
||||
conn.UserID = drConnection.Item("USERNAME")
|
||||
conn.Password = drConnection.Item("PASSWORD")
|
||||
conn.PersistSecurityInfo = True
|
||||
conn.ConnectionTimeout = 120
|
||||
connstr = conn.ConnectionString
|
||||
End If
|
||||
|
||||
connectionString = connstr
|
||||
Case Else
|
||||
ClassLogger.Add(" - ConnectionType nicht integriert", False)
|
||||
MsgBox("ConnectionType nicht integriert", MsgBoxStyle.Critical, "Bitte Konfiguration Connection überprüfen!")
|
||||
End Select
|
||||
Next
|
||||
If connectionString Is Nothing = False Then
|
||||
Try
|
||||
Dim sqlCnn As SqlClient.SqlConnection
|
||||
Dim sqlCmd As SqlClient.SqlCommand
|
||||
Dim adapter As New SqlClient.SqlDataAdapter
|
||||
Dim NewDataset As New DataSet
|
||||
Dim i As Integer
|
||||
Dim sql As String
|
||||
|
||||
|
||||
sql = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetSQL(ControlID)
|
||||
sqlCnn = New SqlClient.SqlConnection(connectionString)
|
||||
' Try
|
||||
sqlCnn.Open()
|
||||
sqlCmd = New SqlClient.SqlCommand(sql, sqlCnn)
|
||||
adapter.SelectCommand = sqlCmd
|
||||
adapter.Fill(NewDataset)
|
||||
Dim msg As String
|
||||
For i = 0 To NewDataset.Tables(0).Rows.Count - 1
|
||||
cmb.Items.Add(NewDataset.Tables(0).Rows(i).Item(0))
|
||||
Next
|
||||
adapter.Dispose()
|
||||
sqlCmd.Dispose()
|
||||
sqlCnn.Close()
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add(" - Unvorhergesehener Fehler bei GetValues SQL - Fehler: " & vbNewLine & ex.Message)
|
||||
MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler bei GetValues SQL:")
|
||||
End Try
|
||||
End If
|
||||
Else
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Else Row 571", False)
|
||||
End If
|
||||
Else
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> AListe Handling", False)
|
||||
Dim AListe As String = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetChoiceListName(ControlID)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> In add_ComboBox - AListe: " & AListe, False)
|
||||
If AListe Is Nothing = False Then
|
||||
Dim liste = _windream.GetValuesfromAuswahlliste(AListe)
|
||||
If liste IsNot Nothing Then
|
||||
cmb.Items.Add("")
|
||||
For Each index As String In liste
|
||||
cmb.Items.Add(index)
|
||||
Next
|
||||
cmb.SelectedIndex = -1
|
||||
Else
|
||||
MsgBox("Resultliste windream is nothing!", MsgBoxStyle.Exclamation, AListe)
|
||||
End If
|
||||
Else
|
||||
MsgBox("AListe from database is nothing!", MsgBoxStyle.Exclamation, AListe)
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
'Die BReite der DropDown-Lsit anpassen
|
||||
Dim iWidestWidth As Integer = 300
|
||||
Using g As Graphics = Me.CreateGraphics
|
||||
For Each oItem As Object In cmb.Items 'Für alle Einträge...
|
||||
Dim g1 As Graphics = cmb.CreateGraphics
|
||||
If g1.MeasureString(Text, cmb.Font).Width + 30 > iWidestWidth Then
|
||||
iWidestWidth = g1.MeasureString(Text, cmb.Font).Width + 30
|
||||
End If
|
||||
g1.Dispose()
|
||||
Next oItem
|
||||
End Using
|
||||
|
||||
'If Me.Items.Count > Me.MaxDropDownItems Then 'Wenn die Scrollleiste angezeigt wird...
|
||||
' iWidestWidth += 15
|
||||
'End If
|
||||
|
||||
cmb.DropDownWidth = Math.Max(iWidestWidth, cmb.Width)
|
||||
pnldesigner.Controls.Add(cmb)
|
||||
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> CMB: " & cmbname & " hinzugefügt", False)
|
||||
AddHandler cmb.SelectedIndexChanged, AddressOf OnCmbselectedIndex
|
||||
If first_control Is Nothing And read_only = False Then
|
||||
first_control = cmb
|
||||
End If
|
||||
last_control = cmb
|
||||
End Function
|
||||
Function add_DTP(CONTROL_ID As Integer, dtpname As String, x As Integer, y As Integer, width As Integer, height As Integer, read_only As Boolean, loadindex As Boolean) 'idxName As String,
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> In add_DTP - dtpname: " & dtpname & " x/y: " & x.ToString & "/" & y.ToString, False)
|
||||
Dim dtp As New DateTimePicker
|
||||
dtp.Name = dtpname
|
||||
dtp.Tag = CONTROL_ID
|
||||
dtp.Size = New Size(width, height)
|
||||
dtp.Location = New Point(x, y)
|
||||
dtp.Format = DateTimePickerFormat.Short
|
||||
If read_only = True Then
|
||||
dtp.Enabled = True
|
||||
dtp.TabStop = False
|
||||
End If
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> In add_DTP - Get GUID ", False)
|
||||
'Überprüfen ob es eine Auswahllsite gibt
|
||||
Dim guid = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetGUID(CURRENT_ProfilGUID, dtpname)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> In add_DTP - GUID: " & guid.ToString, False)
|
||||
|
||||
pnldesigner.Controls.Add(dtp)
|
||||
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> CMB: " & dtpname & " hinzugefügt", False)
|
||||
AddHandler dtp.ValueChanged, AddressOf OnDTPValueChanged
|
||||
If first_control Is Nothing And read_only = False Then
|
||||
first_control = dtp
|
||||
End If
|
||||
last_control = dtp
|
||||
End Function
|
||||
Function add_DGV(CONTROL_ID As Integer, dgvname As String, height As Integer, width As Integer, x As Integer, y As Integer, read_only As Boolean, loadindex As Boolean) 'idxName As String,
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> In add_DGV - dgvname: " & dgvname & " x/y: " & x.ToString & "/" & y.ToString, False)
|
||||
Dim dgv As New DataGridView
|
||||
dgv.AllowUserToOrderColumns = False
|
||||
dgv.Name = dgvname
|
||||
dgv.Tag = CONTROL_ID
|
||||
dgv.Size = New Size(width, height)
|
||||
dgv.Location = New Point(x, y)
|
||||
dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.Aqua
|
||||
Dim col As New DataGridViewTextBoxColumn
|
||||
col.HeaderText = ""
|
||||
col.Name = "column1"
|
||||
col.Width = dgv.Width - 30
|
||||
dgv.Columns.Add(col)
|
||||
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> In add_DGV - Get GUID ", False)
|
||||
'Überprüfen ob es eine Auswahllsite gibt
|
||||
Dim guid = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetGUID(CURRENT_ProfilGUID, dgvname)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> In add_DGV - GUID: " & guid.ToString, False)
|
||||
'jkjjjk
|
||||
If guid > 0 Then
|
||||
|
||||
End If
|
||||
pnldesigner.Controls.Add(dgv)
|
||||
AddHandler dgv.RowValidating, AddressOf onDGVRowValidating
|
||||
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> dgv: " & dgvname & " hinzugefügt", False)
|
||||
If first_control Is Nothing And read_only = False Then
|
||||
first_control = dgv
|
||||
End If
|
||||
last_control = dgv
|
||||
End Function
|
||||
|
||||
Function add_TABLE(CONTROL_ID As Integer, tableName As String, x As Integer, y As Integer, vwidth As Integer, vheight As Integer, read_only As Boolean)
|
||||
Dim table As New DataGridView
|
||||
table.Name = tableName
|
||||
table.Size = New Size(vwidth, vheight)
|
||||
table.Cursor = Cursors.Hand
|
||||
table.Tag = CONTROL_ID
|
||||
table.Location = New Point(x, y)
|
||||
table.AllowUserToAddRows = True
|
||||
table.AllowUserToDeleteRows = False
|
||||
table.AllowUserToResizeColumns = False
|
||||
table.AllowUserToResizeRows = False
|
||||
table.AlternatingRowsDefaultCellStyle.BackColor = Color.Aqua
|
||||
'Columns laden
|
||||
Dim guid = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetGUID(CURRENT_ProfilGUID, tableName)
|
||||
If guid > 0 Then
|
||||
TBPM_CONTROL_TABLETableAdapter.Fill(Me.DD_DMSLiteDataSet.TBPM_CONTROL_TABLE, guid)
|
||||
Dim DT As DataTable = Me.DD_DMSLiteDataSet.TBPM_CONTROL_TABLE
|
||||
If DT.Rows.Count > 0 Then
|
||||
For Each Row As DataRow In DT.Rows
|
||||
Dim col As New DataGridViewTextBoxColumn
|
||||
col.HeaderText = Row.Item("SPALTEN_HEADER")
|
||||
col.Name = Row.Item("SPALTENNAME")
|
||||
col.Width = Row.Item("SPALTENBREITE")
|
||||
table.Columns.Add(col)
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
' table.AutoResizeColumns()
|
||||
|
||||
pnldesigner.Controls.Add(table)
|
||||
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Tabelle: " & tableName & " hinzugefügt", False)
|
||||
If first_control Is Nothing And read_only = False Then
|
||||
first_control = table
|
||||
End If
|
||||
last_control = table
|
||||
End Function
|
||||
|
||||
Function add_Checkbox(CONTROL_ID As Integer, chkname As String, text As String, x As Integer, y As Integer, read_only As Boolean, loadindex As Boolean)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> In add_label - lblname: " & chkname & " x/y: " & x.ToString & "/" & y.ToString, False)
|
||||
Dim chk As New CheckBox
|
||||
chk.Name = chkname
|
||||
chk.Text = text
|
||||
chk.Tag = CONTROL_ID
|
||||
chk.AutoSize = True
|
||||
'chk.Size = New Size(CInt(chk.Text.Length * 15), 20)
|
||||
chk.Location = New Point(x, y)
|
||||
pnldesigner.Controls.Add(chk)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> CHK: " & chkname & " hinzugefügt", False)
|
||||
End Function
|
||||
Sub Clear_all_Input()
|
||||
For Each inctrl As Control In Me.pnldesigner.Controls
|
||||
Dim Type As String = inctrl.GetType.ToString
|
||||
@@ -1028,27 +798,6 @@ Public Class frmValidator
|
||||
Public Sub OnTextBoxLostFocus(sender As System.Object, e As System.EventArgs)
|
||||
Dim box As TextBox = sender
|
||||
box.BackColor = Color.White
|
||||
'If box.Text <> String.Empty And me_closing = False And _Indexe_Loaded = True Then
|
||||
' If CheckValueExists(box) = False Then
|
||||
' box.Text = ""
|
||||
' box.Focus()
|
||||
' frmError.ShowDialog()
|
||||
' End If
|
||||
'End If
|
||||
'If navStep Is Nothing = False Then
|
||||
' Select Case navStep
|
||||
' Case "first"
|
||||
' MovePosition(0)
|
||||
' Case "previous"
|
||||
' MovePosition(aktIndex - 1)
|
||||
' Case "next"
|
||||
' MovePosition(aktIndex + 1)
|
||||
' Case "last"
|
||||
' MovePosition(Anzahl_ValDoks - 1)
|
||||
' End Select
|
||||
' first_control.Focus()
|
||||
|
||||
'End If
|
||||
End Sub
|
||||
Public Sub OnTextBoxKeyUp(sender As Object, e As KeyEventArgs)
|
||||
Dim box As TextBox = sender
|
||||
@@ -1065,33 +814,37 @@ Public Class frmValidator
|
||||
Dim displayboxname = ROW.Item(0).ToString
|
||||
If Not IsDBNull(ROW.Item(1)) And Not IsDBNull(ROW.Item(2)) Then
|
||||
Dim sql_Statement = ROW.Item(2)
|
||||
' Regulären Ausdruck zum Auslesen der Indexe definieren
|
||||
Dim preg As String = "\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}"
|
||||
' einen Regulären Ausdruck laden
|
||||
Dim regulärerAusdruck As Text.RegularExpressions.Regex = New Text.RegularExpressions.Regex(preg)
|
||||
' die Vorkommen im SQL-String auslesen
|
||||
Dim elemente As Text.RegularExpressions.MatchCollection = regulärerAusdruck.Matches(sql_Statement)
|
||||
'####
|
||||
' alle Vorkommen innerhalbd er Namenkonvention durchlaufen
|
||||
For Each element As Text.RegularExpressions.Match In elemente
|
||||
Try
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> element in RegeX: " & element.Value, False)
|
||||
Dim MyPattern = element.Value.Substring(2, element.Value.Length - 3)
|
||||
Dim input_value
|
||||
|
||||
If MyPattern.Contains(ClassControlCreator.PREFIX_TEXTBOX) Then
|
||||
Dim txt As TextBox = CType(pnldesigner.Controls(MyPattern), TextBox)
|
||||
input_value = txt.Text
|
||||
ElseIf MyPattern.Contains(ClassControlCreator.PREFIX_COMBOBOX) Then
|
||||
Dim cmb As ComboBox = CType(pnldesigner.Controls(MyPattern), ComboBox)
|
||||
input_value = cmb.Text
|
||||
End If
|
||||
sql_Statement = sql_Statement.ToString.Replace(element.Value, input_value)
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add("Unexpected Error in Checking control values for Variable SQL Result - ERROR: " & ex.Message)
|
||||
End Try
|
||||
|
||||
Next
|
||||
sql_Statement = ClassPatterns.ReplaceAllValues(sql_Statement, pnldesigner, aktivesDokument, CURRENT_USER_PRENAME, CURRENT_USER_SURNAME, CURRENT_USER_SHORTNAME, CURRENT_USER_EMAIL)
|
||||
|
||||
'' Regulären Ausdruck zum Auslesen der Indexe definieren
|
||||
'Dim preg As String = "\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}"
|
||||
'' einen Regulären Ausdruck laden
|
||||
'Dim regulärerAusdruck As Regex = New Regex(preg)
|
||||
'' die Vorkommen im SQL-String auslesen
|
||||
'Dim elemente As Text.RegularExpressions.MatchCollection = regulärerAusdruck.Matches(sql_Statement)
|
||||
''####
|
||||
'' alle Vorkommen innerhalbd er Namenkonvention durchlaufen
|
||||
'For Each element As Text.RegularExpressions.Match In elemente
|
||||
' Try
|
||||
' If LogErrorsOnly = False Then ClassLogger.Add(" >> element in RegeX: " & element.Value, False)
|
||||
' Dim MyPattern = element.Value.Substring(2, element.Value.Length - 3)
|
||||
' Dim input_value
|
||||
|
||||
' If MyPattern.Contains(ClassControlCreator.PREFIX_TEXTBOX) Then
|
||||
' Dim txt As TextBox = CType(pnldesigner.Controls(MyPattern), TextBox)
|
||||
' input_value = txt.Text
|
||||
' ElseIf MyPattern.Contains(ClassControlCreator.PREFIX_COMBOBOX) Then
|
||||
' Dim cmb As ComboBox = CType(pnldesigner.Controls(MyPattern), ComboBox)
|
||||
' input_value = cmb.Text
|
||||
' End If
|
||||
' sql_Statement = sql_Statement.ToString.Replace(element.Value, input_value)
|
||||
' Catch ex As Exception
|
||||
' ClassLogger.Add("Unexpected Error in Checking control values for Variable SQL Result - ERROR: " & ex.Message)
|
||||
' End Try
|
||||
|
||||
'Next
|
||||
_dependingControl_in_action = True
|
||||
Depending_Control_Set_Result(displayboxname, sql_Statement, ROW.Item(1))
|
||||
_dependingControl_in_action = False
|
||||
@@ -1183,37 +936,39 @@ Public Class frmValidator
|
||||
For Each ROW As DataRow In DT.Rows
|
||||
Try
|
||||
Dim displayboxname = ROW.Item(0).ToString
|
||||
If Not IsDBNull(ROW.Item(1)) And Not IsDBNull(ROW.Item(2)) Then
|
||||
Dim sql_Statement = ROW.Item(2)
|
||||
' Regulären Ausdruck zum Auslesen der Indexe definieren
|
||||
Dim preg As String = "\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}"
|
||||
' einen Regulären Ausdruck laden
|
||||
Dim regulärerAusdruck As Text.RegularExpressions.Regex = New Text.RegularExpressions.Regex(preg)
|
||||
' die Vorkommen im SQL-String auslesen
|
||||
Dim elemente As Text.RegularExpressions.MatchCollection = regulärerAusdruck.Matches(sql_Statement)
|
||||
'####
|
||||
' alle Vorkommen innerhalbd er Namenkonvention durchlaufen
|
||||
For Each element As Text.RegularExpressions.Match In elemente
|
||||
Try
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> element in RegeX: " & element.Value, False)
|
||||
Dim MyPattern = element.Value.Substring(2, element.Value.Length - 3)
|
||||
Dim input_value
|
||||
If Not IsDBNull(ROW.Item("CONNECTION_ID")) And Not IsDBNull(ROW.Item("SQL_UEBERPRUEFUNG")) Then
|
||||
Dim sql_Statement = ROW.Item("SQL_UEBERPRUEFUNG")
|
||||
|
||||
If MyPattern.Contains(ClassControlCreator.PREFIX_TEXTBOX) Then
|
||||
Dim txt As TextBox = CType(pnldesigner.Controls(MyPattern), TextBox)
|
||||
input_value = txt.Text
|
||||
ElseIf MyPattern.Contains(ClassControlCreator.PREFIX_COMBOBOX) Then
|
||||
Dim cmb1 As ComboBox = CType(pnldesigner.Controls(MyPattern), ComboBox)
|
||||
input_value = cmb1.Text
|
||||
End If
|
||||
sql_Statement = sql_Statement.ToString.Replace(element.Value, input_value)
|
||||
sql_Statement = ClassPatterns.ReplaceAllValues(sql_Statement, pnldesigner, aktivesDokument, CURRENT_USER_PRENAME, CURRENT_USER_SURNAME, CURRENT_USER_SHORTNAME, CURRENT_USER_EMAIL)
|
||||
'' Regulären Ausdruck zum Auslesen der Indexe definieren
|
||||
'Dim preg As String = "\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}"
|
||||
'' einen Regulären Ausdruck laden
|
||||
'Dim regulärerAusdruck As Text.RegularExpressions.Regex = New Text.RegularExpressions.Regex(preg)
|
||||
'' die Vorkommen im SQL-String auslesen
|
||||
'Dim elemente As Text.RegularExpressions.MatchCollection = regulärerAusdruck.Matches(sql_Statement)
|
||||
''####
|
||||
'' alle Vorkommen innerhalbd er Namenkonvention durchlaufen
|
||||
'For Each element As Text.RegularExpressions.Match In elemente
|
||||
' Try
|
||||
' If LogErrorsOnly = False Then ClassLogger.Add(" >> element in RegeX: " & element.Value, False)
|
||||
' Dim MyPattern = element.Value.Substring(2, element.Value.Length - 3)
|
||||
' Dim input_value
|
||||
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add("Unexpected Error in Checking control values for Variable SQL Result ComboBox - ERROR: " & ex.Message)
|
||||
End Try
|
||||
' If MyPattern.Contains(ClassControlCreator.PREFIX_TEXTBOX) Then
|
||||
' Dim txt As TextBox = CType(pnldesigner.Controls(MyPattern), TextBox)
|
||||
' input_value = txt.Text
|
||||
' ElseIf MyPattern.Contains(ClassControlCreator.PREFIX_COMBOBOX) Then
|
||||
' Dim cmb1 As ComboBox = CType(pnldesigner.Controls(MyPattern), ComboBox)
|
||||
' input_value = cmb1.Text
|
||||
' End If
|
||||
' sql_Statement = sql_Statement.ToString.Replace(element.Value, input_value)
|
||||
|
||||
Next
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">>> sql_Statement after replacement: " & sql_Statement)
|
||||
' Catch ex As Exception
|
||||
' ClassLogger.Add("Unexpected Error in Checking control values for Variable SQL Result ComboBox - ERROR: " & ex.Message)
|
||||
' End Try
|
||||
|
||||
'Next
|
||||
'If LogErrorsOnly = False Then ClassLogger.Add(">>> sql_Statement after replacement: " & sql_Statement)
|
||||
|
||||
_dependingControl_in_action = True
|
||||
Depending_Control_Set_Result(displayboxname, sql_Statement, ROW.Item(1))
|
||||
@@ -1571,6 +1326,8 @@ Public Class frmValidator
|
||||
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Viewer geladen", False)
|
||||
|
||||
|
||||
|
||||
FillIndexValues()
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Indexmaske geladen", False)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add("", False)
|
||||
|
||||
Reference in New Issue
Block a user