MS_1603
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
Imports DevExpress.XtraGrid.Views.Tile
|
||||
Imports DevExpress.XtraEditors
|
||||
Imports System.Text.RegularExpressions
|
||||
|
||||
Public Class frmConstructorDesigner
|
||||
Dim SELECTED_ENTITY_ID As Integer
|
||||
Dim SELECTED_CONSTRUCTOR_DETAIL_ID As Integer
|
||||
Dim formloaded As Boolean = False
|
||||
Dim AtPlaceholderPattern As String = "@[A-Za-z_]+"
|
||||
Private Sub TBPMO_FORM_CONSTRUCTORBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles TBPMO_FORM_CONSTRUCTORBindingNavigatorSaveItem.Click
|
||||
Try
|
||||
Me.Validate()
|
||||
@@ -314,62 +316,85 @@ Public Class frmConstructorDesigner
|
||||
End Sub
|
||||
|
||||
Private Sub tsbtnSave_Click(sender As Object, e As EventArgs) Handles tsbtnSave.Click
|
||||
Try
|
||||
Me.TBPMO_FORM_CONSTRUCTOR_DETAILBindingSource.EndEdit()
|
||||
If DD_ECMAdmin.TBPMO_FORM_CONSTRUCTOR_DETAIL.GetChanges Is Nothing = False Then
|
||||
Me.CHANGED_WHOTextBox1.Text = Environment.UserName
|
||||
Me.TBPMO_FORM_CONSTRUCTOR_DETAILBindingSource.EndEdit()
|
||||
Me.TBPMO_FORM_CONSTRUCTOR_DETAILTableAdapter.Update(DD_ECMAdmin.TBPMO_FORM_CONSTRUCTOR_DETAIL)
|
||||
tslblSaveDetail.Text = "Constructor-Details erfolgreich gespeichert - " & Now
|
||||
Me.tslblSaveDetail.Visible = True
|
||||
Else
|
||||
Me.tslblSaveDetail.Visible = False
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox("Error in Save Constructor-Details:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
End Try
|
||||
Try
|
||||
If XtraTabControl2.SelectedTabPageIndex = 1 Then
|
||||
Try
|
||||
Dim SP1, SP2, SP3, SP4, SP5
|
||||
If cmbSearchPattern1.SelectedIndex <> -1 Then
|
||||
SP1 = "@" & cmbSearchPattern1.Text
|
||||
Me.TBPMO_FORM_CONSTRUCTOR_DETAILBindingSource.EndEdit()
|
||||
If DD_ECMAdmin.TBPMO_FORM_CONSTRUCTOR_DETAIL.GetChanges Is Nothing = False Then
|
||||
Me.CHANGED_WHOTextBox1.Text = Environment.UserName
|
||||
Me.TBPMO_FORM_CONSTRUCTOR_DETAILBindingSource.EndEdit()
|
||||
Me.TBPMO_FORM_CONSTRUCTOR_DETAILTableAdapter.Update(DD_ECMAdmin.TBPMO_FORM_CONSTRUCTOR_DETAIL)
|
||||
tslblSaveDetail.Text = "Constructor-Details erfolgreich gespeichert - " & Now
|
||||
Me.tslblSaveDetail.Visible = True
|
||||
Else
|
||||
SP1 = ""
|
||||
End If
|
||||
If cmbSearchPattern2.SelectedIndex <> -1 Then
|
||||
SP2 = "@" & cmbSearchPattern2.Text
|
||||
Else
|
||||
SP2 = ""
|
||||
End If
|
||||
If cmbSearchPattern3.SelectedIndex <> -1 Then
|
||||
SP3 = "@" & cmbSearchPattern3.Text
|
||||
Else
|
||||
SP3 = ""
|
||||
End If
|
||||
If cmbSearchPattern4.SelectedIndex <> -1 Then
|
||||
SP4 = "@" & cmbSearchPattern4.Text
|
||||
Else
|
||||
SP4 = ""
|
||||
End If
|
||||
If cmbSearchPattern5.SelectedIndex <> -1 Then
|
||||
SP5 = "@" & cmbSearchPattern5.Text
|
||||
Else
|
||||
SP5 = ""
|
||||
End If
|
||||
Dim sql = "UPDATE TBPMO_FORM_VIEW SET WINDREAM_SEARCH = '" & txtWindreamsuche.Text & "',SEARCH_PATTERN1 = '" & SP1 & "',SEARCH_PATTERN2= '" & SP2 & "',SEARCH_PATTERN3= '" & SP3 & _
|
||||
"',SEARCH_PATTERN4 = '" & SP4 & "',SEARCH_PATTERN5 = '" & SP5 & "', CHANGED_WHO = '" & Environment.UserName & "' where FORM_ID = " & SELECTED_ENTITY_ID & " and SCREEN_ID = " & CURRENT_SCREEN_ID
|
||||
If ClassDatabase.Execute_non_Query(sql) = True Then
|
||||
lblSave1.Visible = True
|
||||
lblSave1.Text = "Erfolgreich gespeichert - " & Now
|
||||
Me.tslblSaveDetail.Visible = False
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox("Error in Save DocView-properties:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
MsgBox("Error in Save Constructor-Details:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
End Try
|
||||
End If
|
||||
|
||||
If XtraTabControl2.SelectedTabPageIndex = 2 Then
|
||||
Try
|
||||
Try
|
||||
Dim SP1, SP2, SP3, SP4, SP5
|
||||
If cmbSearchPattern1.SelectedIndex <> -1 Then
|
||||
SP1 = "@" & cmbSearchPattern1.Text
|
||||
Else
|
||||
SP1 = ""
|
||||
End If
|
||||
If cmbSearchPattern2.SelectedIndex <> -1 Then
|
||||
SP2 = "@" & cmbSearchPattern2.Text
|
||||
Else
|
||||
SP2 = ""
|
||||
End If
|
||||
If cmbSearchPattern3.SelectedIndex <> -1 Then
|
||||
SP3 = "@" & cmbSearchPattern3.Text
|
||||
Else
|
||||
SP3 = ""
|
||||
End If
|
||||
If cmbSearchPattern4.SelectedIndex <> -1 Then
|
||||
SP4 = "@" & cmbSearchPattern4.Text
|
||||
Else
|
||||
SP4 = ""
|
||||
End If
|
||||
If cmbSearchPattern5.SelectedIndex <> -1 Then
|
||||
SP5 = "@" & cmbSearchPattern5.Text
|
||||
Else
|
||||
SP5 = ""
|
||||
End If
|
||||
Dim sql = "UPDATE TBPMO_FORM_VIEW SET WINDREAM_SEARCH = '" & txtWindreamsuche.Text & "',SEARCH_PATTERN1 = '" & SP1 & "',SEARCH_PATTERN2= '" & SP2 & "',SEARCH_PATTERN3= '" & SP3 & _
|
||||
"',SEARCH_PATTERN4 = '" & SP4 & "',SEARCH_PATTERN5 = '" & SP5 & "', CHANGED_WHO = '" & Environment.UserName & "' where FORM_ID = " & SELECTED_ENTITY_ID & " and SCREEN_ID = " & CURRENT_SCREEN_ID
|
||||
If ClassDatabase.Execute_non_Query(sql) = True Then
|
||||
lblSave1.Visible = True
|
||||
lblSave1.Text = "Erfolgreich gespeichert - " & Now
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox("Error in Save DocView-properties 2:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
lblSave1.Visible = False
|
||||
End Try
|
||||
Catch ex As Exception
|
||||
MsgBox("Error in Save DocView-properties 1:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
lblSave1.Visible = False
|
||||
End Try
|
||||
Catch ex As Exception
|
||||
End If
|
||||
|
||||
End Try
|
||||
If XtraTabControl2.SelectedTabPageIndex = 3 And TabControl1.SelectedIndex = 0 Then
|
||||
Try
|
||||
Me.TBPMO_CONSTRUCTOR_USER_SQLBindingSource.EndEdit()
|
||||
If DD_DMSDataSet.TBPMO_CONSTRUCTOR_USER_SQL.GetChanges Is Nothing = False Then
|
||||
Me.CHANGED_WHOTextBox2.Text = Environment.UserName
|
||||
Me.TBPMO_CONSTRUCTOR_USER_SQLBindingSource.EndEdit()
|
||||
Me.TBPMO_CONSTRUCTOR_USER_SQLTableAdapter.Update(DD_DMSDataSet.TBPMO_CONSTRUCTOR_USER_SQL)
|
||||
lblsaveSQLUser.Visible = True
|
||||
Else
|
||||
lblsaveSQLUser.Visible = False
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox("Error in Save User SQL:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
End Try
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
||||
@@ -420,10 +445,21 @@ Public Class frmConstructorDesigner
|
||||
Case 2
|
||||
RecordSearch_Config()
|
||||
Case 3
|
||||
'Load_ConstructorUser()
|
||||
Load_UserSQL()
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Public Sub Load_UserSQL()
|
||||
Try
|
||||
lbxUserSQL.Items.Clear()
|
||||
Dim sql = String.Format("SELECT DISTINCT T.GUID, T.USERNAME FROM TBDD_USER T, TBDD_CLIENT_USER T1 WHERE T.MODULE_RECORD_ORG = 1 AND T.GUID = T1.USER_ID AND T1.CLIENT_ID IN ({0}) ORDER BY T.USERNAME", USER_CLIENTS_COMMA_SEPERATED)
|
||||
Dim DT As DataTable = ClassDatabase.Return_Datatable(sql)
|
||||
lbxUserSQL.DataSource = DT
|
||||
lbxUserSQL.DisplayMember = DT.Columns(1).ColumnName
|
||||
lbxUserSQL.ValueMember = DT.Columns(0).ColumnName
|
||||
Catch ex As Exception
|
||||
MsgBox("UnexpectedError Load_UserSQL:" & vbNewLine & ex.Message)
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub btnAddControl_Click(sender As Object, e As EventArgs) Handles btnAddControl.Click
|
||||
Try
|
||||
Dim i = listBoxControls.SelectedValue
|
||||
@@ -602,4 +638,99 @@ Public Class frmConstructorDesigner
|
||||
MsgBox("Error while deleting user to Constructor-Relation: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub txtSearchUser_TextChanged(sender As Object, e As EventArgs) Handles txtSearchUser.TextChanged
|
||||
Dim i As Integer = lbxUserSQL.FindString(txtSearchUser.Text)
|
||||
lbxUserSQL.SelectedIndex = i
|
||||
If txtSearchUser.Text = "" Then
|
||||
lbxUserSQL.SelectedIndex = -1
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub lbxUserSQL_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lbxUserSQL.SelectedIndexChanged
|
||||
Try
|
||||
Me.TBPMO_CONSTRUCTOR_USER_SQLTableAdapter.Connection.ConnectionString = MyConnectionString
|
||||
Me.TBPMO_CONSTRUCTOR_USER_SQLTableAdapter.Fill(Me.DD_DMSDataSet.TBPMO_CONSTRUCTOR_USER_SQL, SELECTED_CONSTRUCTOR_DETAIL_ID, lbxUserSQL.SelectedValue)
|
||||
Catch ex As System.Exception
|
||||
If Not ex.Message.ToLower.Contains("atarowview") Then
|
||||
MsgBox("Error while loading User-Restrictions:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
End If
|
||||
End Try
|
||||
lblsaveSQLUser.Visible = False
|
||||
End Sub
|
||||
|
||||
Private Sub btnAddUserSQL_Click(sender As Object, e As EventArgs) Handles btnAddUserSQL.Click
|
||||
If GUIDTextBox.Text = "" Then
|
||||
TBPMO_CONSTRUCTOR_USER_SQLBindingSource.AddNew()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub TBPMO_CONSTRUCTOR_USER_SQLBindingSource_AddingNew(sender As Object, e As System.ComponentModel.AddingNewEventArgs) Handles TBPMO_CONSTRUCTOR_USER_SQLBindingSource.AddingNew
|
||||
Try
|
||||
DD_DMSDataSet.TBPMO_CONSTRUCTOR_USER_SQL.ADDED_WHOColumn.DefaultValue = Environment.UserName
|
||||
DD_DMSDataSet.TBPMO_CONSTRUCTOR_USER_SQL.CONSTR_DET_IDColumn.DefaultValue = SELECTED_CONSTRUCTOR_DETAIL_ID
|
||||
DD_DMSDataSet.TBPMO_CONSTRUCTOR_USER_SQL.USER_IDColumn.DefaultValue = lbxUserSQL.SelectedValue
|
||||
Catch ex As Exception
|
||||
MsgBox("Error while Adding User-Restrictions:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub SQL_COMMANDTextBox_TextChanged(sender As Object, e As EventArgs) Handles SQL_COMMANDTextBox.TextChanged
|
||||
If SQL_COMMANDTextBox.Text.Trim().Count = 0 Then
|
||||
dgvPlaceholders.Enabled = False
|
||||
Else
|
||||
dgvPlaceholders.Enabled = True
|
||||
End If
|
||||
|
||||
CheckForPlaceholders()
|
||||
End Sub
|
||||
|
||||
Private Sub CheckForPlaceholders()
|
||||
Dim count As Integer = 0
|
||||
Dim text As String = Me.SQL_COMMANDTextBox.Text
|
||||
Dim atPlaceholderRegex = New Regex(AtPlaceholderPattern, RegexOptions.IgnoreCase)
|
||||
Dim matches As MatchCollection = atPlaceholderRegex.Matches(text)
|
||||
|
||||
dgvPlaceholders.Rows.Clear()
|
||||
|
||||
For Each match As Match In matches
|
||||
Dim placeholder = ""
|
||||
Select Case match.Value.ToUpper
|
||||
Case "@USER_ID"
|
||||
placeholder = lbxUserSQL.SelectedValue
|
||||
End Select
|
||||
dgvPlaceholders.Rows.Add({match.Value, placeholder})
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Sub btnTestSQL_Click(sender As Object, e As EventArgs) Handles btnTestSQL.Click
|
||||
Try
|
||||
Dim ENTITY_ID = ClassDatabase.Execute_Scalar("SELECT FORM_ID FROM TBPMO_FORM_CONSTRUCTOR_DETAIL WHERE GUID = " & SELECTED_CONSTRUCTOR_DETAIL_ID)
|
||||
Dim EntSQL = "SELECT T.* FROM VWTEMP_PMO_FORM" & ENTITY_ID.ToString & " T"
|
||||
Dim query As String = EntSQL & " " & SQL_COMMANDTextBox.Text
|
||||
|
||||
For Each row As DataGridViewRow In dgvPlaceholders.Rows
|
||||
Dim placeholder As String = row.Cells(0).Value
|
||||
Dim replacement As String = row.Cells(1).Value
|
||||
|
||||
' Wenn Ersetzung ausgefüllt wurde, Platzhalter damit ersetzen
|
||||
If Not String.IsNullOrEmpty(replacement) Then
|
||||
query = query.Replace(placeholder, replacement)
|
||||
Else
|
||||
MsgBox("Please add a test-value for the placeholder '" & placeholder & "'!", MsgBoxStyle.Exclamation, "Missing value:")
|
||||
Exit Sub
|
||||
End If
|
||||
Next
|
||||
Dim DT As DataTable = ClassDatabase.Return_Datatable(query)
|
||||
|
||||
If DT IsNot Nothing Then
|
||||
dgvResult.DataSource = DT
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox("Error in Testing User-Restriction SQL:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
End Try
|
||||
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user