add profile_id placeholder
This commit is contained in:
parent
726d79ef3b
commit
d6c5e16d08
@ -37,7 +37,7 @@
|
||||
' LOGGER.Info("Unexpected Error in Checking control values for Variable SQL Result - ERROR: " & ex.Message)
|
||||
' End Try
|
||||
'Next
|
||||
Dim sql_Statement = clsPatterns.ReplaceUserValues(dr.Item("SQL_COMMAND"), USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID)
|
||||
Dim sql_Statement = clsPatterns.ReplaceUserValues(dr.Item("SQL_COMMAND"), USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
||||
sql_Statement = clsPatterns.ReplaceInternalValues(sql_Statement)
|
||||
sql_Statement = clsPatterns.ReplaceWindreamIndicies(sql_Statement, WMObject)
|
||||
|
||||
|
||||
@ -17,7 +17,6 @@ Public Class clsPatterns
|
||||
' Complex patterns that rely on a datasource like a Database or Windream
|
||||
Public Const PATTERN_WMI = "WMI"
|
||||
Public Const PATTERN_CTRL = "CTRL"
|
||||
Public Const PATTERN_PRO = "PRO"
|
||||
' Simple patterns that only rely on .NET functions
|
||||
Public Const PATTERN_INT = "INT"
|
||||
' Simple patterns that rely on Data from the TBDD_USER table
|
||||
@ -28,20 +27,19 @@ Public Class clsPatterns
|
||||
Public Const USER_VALUE_EMAIL = "EMAIL"
|
||||
Public Const USER_VALUE_SHORTNAME = "SHORTNAME"
|
||||
Public Const USER_VALUE_USER_ID = "USER_ID"
|
||||
Public Const USER_VALUE_PROFILE_ID = "PROFILE_ID"
|
||||
|
||||
Public Const INT_VALUE_USERNAME = "USERNAME"
|
||||
Public Const INT_VALUE_MACHINE = "MACHINE"
|
||||
Public Const INT_VALUE_DOMAIN = "DOMAIN"
|
||||
Public Const INT_VALUE_DATE = "DATE"
|
||||
|
||||
Public Const PRO_VALUE_PROFILE_ID = "PROFILE_ID"
|
||||
|
||||
Public Const MAX_TRY_COUNT = 100
|
||||
|
||||
Private Shared regex As Regex = New Regex("{#(\w+)#([\w\s_-]+)}+")
|
||||
Private Shared allPatterns As New List(Of String) From {PATTERN_WMI, PATTERN_CTRL, PATTERN_USER, PATTERN_INT, PATTERN_PRO}
|
||||
Private Shared allPatterns As New List(Of String) From {PATTERN_WMI, PATTERN_CTRL, PATTERN_USER, PATTERN_INT}
|
||||
Private Shared complexPatterns As New List(Of String) From {PATTERN_WMI, PATTERN_CTRL}
|
||||
Private Shared simplePatterns As New List(Of String) From {PATTERN_USER, PATTERN_INT, PATTERN_PRO}
|
||||
Private Shared simplePatterns As New List(Of String) From {PATTERN_USER, PATTERN_INT}
|
||||
|
||||
''' <summary>
|
||||
''' Wraps a pattern-type and -value in the common format: {#type#value}
|
||||
@ -58,8 +56,7 @@ Public Class clsPatterns
|
||||
result = ReplaceInternalValues(result)
|
||||
result = ReplaceControlValues(result, panel)
|
||||
If Not IsNothing(document) Then result = ReplaceWindreamIndicies(result, document)
|
||||
If Not IsNothing(profileId) AndAlso profileId > 0 Then result = ReplaceProfileValues(result, profileId)
|
||||
result = ReplaceUserValues(result, prename, surname, shortname, email, userId)
|
||||
result = ReplaceUserValues(result, prename, surname, shortname, email, userId, profileId)
|
||||
|
||||
Return result
|
||||
Catch ex As Exception
|
||||
@ -99,7 +96,7 @@ Public Class clsPatterns
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Shared Function ReplaceUserValues(input As String, prename As Object, surname As Object, shortname As Object, email As Object, userId As Object) As String
|
||||
Public Shared Function ReplaceUserValues(input As String, prename As Object, surname As Object, shortname As Object, email As Object, userId As Object, profileId As Object) As String
|
||||
Try
|
||||
Dim result = input
|
||||
|
||||
@ -123,6 +120,10 @@ Public Class clsPatterns
|
||||
result = ReplacePattern(input, PATTERN_USER, email)
|
||||
End While
|
||||
|
||||
While ContainsPatternAndValue(result, PATTERN_USER, USER_VALUE_PROFILE_ID)
|
||||
result = ReplacePattern(input, PATTERN_USER, profileId)
|
||||
End While
|
||||
|
||||
Return result
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
@ -130,22 +131,6 @@ Public Class clsPatterns
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Shared Function ReplaceProfileValues(Input As String, profileId As Object)
|
||||
Try
|
||||
Dim result = Input
|
||||
|
||||
While ContainsPatternAndValue(result, PATTERN_PRO, PRO_VALUE_PROFILE_ID)
|
||||
ReplacePattern(result, PATTERN_PRO, profileId)
|
||||
End While
|
||||
|
||||
Return result
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
LOGGER.Info("Error in ReplaceProfileValues:" & ex.Message)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
|
||||
Public Shared Function ReplaceControlValues(input As String, panel As Panel) As String
|
||||
Try
|
||||
Dim result = input
|
||||
|
||||
@ -478,7 +478,7 @@ Public Class frmMain
|
||||
Dim sqlchart = row.Item("SQL_COMMAND")
|
||||
|
||||
sqlchart = clsPatterns.ReplaceInternalValues(sqlchart)
|
||||
sqlchart = clsPatterns.ReplaceUserValues(sqlchart, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID)
|
||||
sqlchart = clsPatterns.ReplaceUserValues(sqlchart, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
||||
|
||||
sqlchart = sqlchart.ToString.ToUpper.Replace("@USER_ID", USER_ID)
|
||||
sqlchart = sqlchart.ToString.ToUpper.Replace("@USER", USER_USERNAME)
|
||||
@ -594,7 +594,7 @@ Public Class frmMain
|
||||
Dim sql = foundRows(0)("SQL_VIEW")
|
||||
|
||||
sql = clsPatterns.ReplaceInternalValues(sql)
|
||||
sql = clsPatterns.ReplaceUserValues(sql, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID)
|
||||
sql = clsPatterns.ReplaceUserValues(sql, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
||||
|
||||
sql = sql.Replace("@USER_ID", USER_ID)
|
||||
sql = sql.Replace("@USERNAME", Environment.UserName)
|
||||
@ -730,7 +730,7 @@ Public Class frmMain
|
||||
Dim sql = CURRENT_DT_CONFIG.Rows(0).Item("SQL_PROFILE_MAIN_VIEW")
|
||||
|
||||
sql = clsPatterns.ReplaceInternalValues(sql)
|
||||
sql = clsPatterns.ReplaceUserValues(sql, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID)
|
||||
sql = clsPatterns.ReplaceUserValues(sql, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
||||
|
||||
' this needs to stay for backwards compatibility
|
||||
sql = sql.Replace("@USER_ID", USER_ID)
|
||||
@ -1185,7 +1185,7 @@ Public Class frmMain
|
||||
End If
|
||||
|
||||
oSQLOverview = clsPatterns.ReplaceInternalValues(oSQLOverview)
|
||||
oSQLOverview = clsPatterns.ReplaceUserValues(oSQLOverview, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID)
|
||||
oSQLOverview = clsPatterns.ReplaceUserValues(oSQLOverview, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
||||
|
||||
oSQLOverview = oSQLOverview.Replace("@USER_ID", USER_ID)
|
||||
oSQLOverview = oSQLOverview.Replace("@USERNAME", Environment.UserName)
|
||||
|
||||
@ -1007,7 +1007,7 @@ Public Class frmMassValidator
|
||||
Continue For
|
||||
End If
|
||||
|
||||
sql = clsPatterns.ReplaceUserValues(sqlStatement, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID)
|
||||
sql = clsPatterns.ReplaceUserValues(sqlStatement, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
||||
sql = clsPatterns.ReplaceInternalValues(sql)
|
||||
LOGGER.Debug(">>> sql after ReplaceInternalValues: " & sql)
|
||||
'sql = ClassPatterns.ReplaceInternalValues(sqlStatement)
|
||||
|
||||
22
app/DD_PM_WINDREAM/frmSQL_DESIGNER.Designer.vb
generated
22
app/DD_PM_WINDREAM/frmSQL_DESIGNER.Designer.vb
generated
@ -23,8 +23,8 @@ Partial Class frmSQL_DESIGNER
|
||||
<System.Diagnostics.DebuggerStepThrough()> _
|
||||
Private Sub InitializeComponent()
|
||||
Me.components = New System.ComponentModel.Container()
|
||||
Dim DataGridViewCellStyle7 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
|
||||
Dim DataGridViewCellStyle8 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
|
||||
Dim DataGridViewCellStyle11 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
|
||||
Dim DataGridViewCellStyle12 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
|
||||
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmSQL_DESIGNER))
|
||||
Me.DD_DMSLiteDataSet = New DD_PM_WINDREAM.DD_DMSLiteDataSet()
|
||||
Me.TableAdapterManager = New DD_PM_WINDREAM.DD_DMSLiteDataSetTableAdapters.TableAdapterManager()
|
||||
@ -180,8 +180,8 @@ Partial Class frmSQL_DESIGNER
|
||||
'
|
||||
Me.dgvResult.AllowUserToAddRows = False
|
||||
Me.dgvResult.AllowUserToDeleteRows = False
|
||||
DataGridViewCellStyle7.BackColor = System.Drawing.Color.Cyan
|
||||
Me.dgvResult.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle7
|
||||
DataGridViewCellStyle11.BackColor = System.Drawing.Color.Cyan
|
||||
Me.dgvResult.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle11
|
||||
Me.dgvResult.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _
|
||||
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
|
||||
Me.dgvResult.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
|
||||
@ -195,8 +195,8 @@ Partial Class frmSQL_DESIGNER
|
||||
'
|
||||
Me.dgvPlaceholders.AllowUserToAddRows = False
|
||||
Me.dgvPlaceholders.AllowUserToDeleteRows = False
|
||||
DataGridViewCellStyle8.BackColor = System.Drawing.Color.Cyan
|
||||
Me.dgvPlaceholders.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle8
|
||||
DataGridViewCellStyle12.BackColor = System.Drawing.Color.Cyan
|
||||
Me.dgvPlaceholders.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle12
|
||||
Me.dgvPlaceholders.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
|
||||
Me.dgvPlaceholders.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
|
||||
Me.dgvPlaceholders.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.colPlaceholder, Me.colReplace})
|
||||
@ -336,14 +336,14 @@ Partial Class frmSQL_DESIGNER
|
||||
Me.Label2.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
|
||||
Me.Label2.Location = New System.Drawing.Point(442, 67)
|
||||
Me.Label2.Name = "Label2"
|
||||
Me.Label2.Size = New System.Drawing.Size(97, 16)
|
||||
Me.Label2.Size = New System.Drawing.Size(112, 16)
|
||||
Me.Label2.TabIndex = 98
|
||||
Me.Label2.Text = "Windowsdaten:"
|
||||
Me.Label2.Text = "Umgebungsdaten:"
|
||||
'
|
||||
'cmbUser
|
||||
'
|
||||
Me.cmbUser.FormattingEnabled = True
|
||||
Me.cmbUser.Items.AddRange(New Object() {"PRENAME", "SURNAME", "SHORTNAME", "EMAIL", "USER_ID"})
|
||||
Me.cmbUser.Items.AddRange(New Object() {"PRENAME", "SURNAME", "SHORTNAME", "EMAIL", "USER_ID", "PROFILE_ID"})
|
||||
Me.cmbUser.Location = New System.Drawing.Point(681, 86)
|
||||
Me.cmbUser.Name = "cmbUser"
|
||||
Me.cmbUser.Size = New System.Drawing.Size(194, 21)
|
||||
@ -355,9 +355,9 @@ Partial Class frmSQL_DESIGNER
|
||||
Me.Label3.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
|
||||
Me.Label3.Location = New System.Drawing.Point(678, 67)
|
||||
Me.Label3.Name = "Label3"
|
||||
Me.Label3.Size = New System.Drawing.Size(95, 16)
|
||||
Me.Label3.Size = New System.Drawing.Size(118, 16)
|
||||
Me.Label3.TabIndex = 98
|
||||
Me.Label3.Text = "Benutzerdaten:"
|
||||
Me.Label3.Text = "Anwendungsdaten:"
|
||||
'
|
||||
'btnAddUser
|
||||
'
|
||||
|
||||
@ -504,7 +504,7 @@ Public Class frmValidator
|
||||
Continue For
|
||||
End If
|
||||
|
||||
sql = clsPatterns.ReplaceUserValues(sqlStatement, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID)
|
||||
sql = clsPatterns.ReplaceUserValues(sqlStatement, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
||||
sql = clsPatterns.ReplaceInternalValues(sql)
|
||||
LOGGER.Debug(">>> sql after ReplaceInternalValues: " & sql)
|
||||
'sql = ClassPatterns.ReplaceInternalValues(sqlStatement)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user