Fix SQL Command being overwritten for auto indexes, allow placeholders for manual indexes default value

This commit is contained in:
Jonathan Jenne 2020-07-09 12:01:10 +02:00
parent 1dc95d862f
commit b5708b851b
7 changed files with 2037 additions and 1725 deletions

View File

@ -180,8 +180,12 @@ Partial Class frmAdministration
Me.XtraTabControl2 = New DevExpress.XtraTab.XtraTabControl()
Me.XtraTabPageManualIndex = New DevExpress.XtraTab.XtraTabPage()
Me.Panel1 = New System.Windows.Forms.Panel()
Me.ACTIVECheckBox = New System.Windows.Forms.CheckBox()
Me.Button3 = New System.Windows.Forms.Button()
Me.lbManIndexDefaultValueParameter = New System.Windows.Forms.ListBox()
Me.txtManIndexConnectionId = New System.Windows.Forms.TextBox()
Me.TBDD_INDEX_MANBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.txtManIndexSQL = New System.Windows.Forms.TextBox()
Me.ACTIVECheckBox = New System.Windows.Forms.CheckBox()
Me.GUIDTextBox1 = New System.Windows.Forms.TextBox()
Me.VKT_PREVENT_MULTIPLE_VALUESCheckbox = New System.Windows.Forms.CheckBox()
Me.VKT_ADD_ITEMCheckbox = New System.Windows.Forms.CheckBox()
@ -300,8 +304,8 @@ Partial Class frmAdministration
Me.TBGI_REGEX_DOCTYPETableAdapter = New Global_Indexer.MyDatasetTableAdapters.TBGI_REGEX_DOCTYPETableAdapter()
Me.RibbonPage2 = New DevExpress.XtraBars.Ribbon.RibbonPage()
Me.RibbonPage8 = New DevExpress.XtraBars.Ribbon.RibbonPage()
Me.txtManIndexSQL = New System.Windows.Forms.TextBox()
Me.txtManIndexConnectionId = New System.Windows.Forms.TextBox()
Me.txtAutomIndexSQLResult = New System.Windows.Forms.TextBox()
Me.txtAutomIndexConnectionId = New System.Windows.Forms.TextBox()
GUIDLabel = New System.Windows.Forms.Label()
GUIDLabel1 = New System.Windows.Forms.Label()
NAMELabel = New System.Windows.Forms.Label()
@ -1294,6 +1298,8 @@ Partial Class frmAdministration
'
'Panel1
'
Me.Panel1.Controls.Add(Me.Button3)
Me.Panel1.Controls.Add(Me.lbManIndexDefaultValueParameter)
Me.Panel1.Controls.Add(Me.txtManIndexConnectionId)
Me.Panel1.Controls.Add(Me.txtManIndexSQL)
Me.Panel1.Controls.Add(Me.ACTIVECheckBox)
@ -1329,6 +1335,37 @@ Partial Class frmAdministration
resources.ApplyResources(Me.Panel1, "Panel1")
Me.Panel1.Name = "Panel1"
'
'Button3
'
Me.Button3.Image = Global.Global_Indexer.My.Resources.Resources.arrow_previous_16xLG
resources.ApplyResources(Me.Button3, "Button3")
Me.Button3.Name = "Button3"
Me.Button3.UseVisualStyleBackColor = True
'
'lbManIndexDefaultValueParameter
'
resources.ApplyResources(Me.lbManIndexDefaultValueParameter, "lbManIndexDefaultValueParameter")
Me.lbManIndexDefaultValueParameter.FormattingEnabled = True
Me.lbManIndexDefaultValueParameter.Items.AddRange(New Object() {resources.GetString("lbManIndexDefaultValueParameter.Items"), resources.GetString("lbManIndexDefaultValueParameter.Items1"), resources.GetString("lbManIndexDefaultValueParameter.Items2"), resources.GetString("lbManIndexDefaultValueParameter.Items3"), resources.GetString("lbManIndexDefaultValueParameter.Items4"), resources.GetString("lbManIndexDefaultValueParameter.Items5"), resources.GetString("lbManIndexDefaultValueParameter.Items6"), resources.GetString("lbManIndexDefaultValueParameter.Items7"), resources.GetString("lbManIndexDefaultValueParameter.Items8")})
Me.lbManIndexDefaultValueParameter.Name = "lbManIndexDefaultValueParameter"
'
'txtManIndexConnectionId
'
Me.txtManIndexConnectionId.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.TBDD_INDEX_MANBindingSource, "CONNECTION_ID", True))
resources.ApplyResources(Me.txtManIndexConnectionId, "txtManIndexConnectionId")
Me.txtManIndexConnectionId.Name = "txtManIndexConnectionId"
'
'TBDD_INDEX_MANBindingSource
'
Me.TBDD_INDEX_MANBindingSource.DataMember = "TBDD_INDEX_MAN"
Me.TBDD_INDEX_MANBindingSource.DataSource = Me.MyDataset
'
'txtManIndexSQL
'
Me.txtManIndexSQL.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.TBDD_INDEX_MANBindingSource, "SQL_RESULT", True))
resources.ApplyResources(Me.txtManIndexSQL, "txtManIndexSQL")
Me.txtManIndexSQL.Name = "txtManIndexSQL"
'
'ACTIVECheckBox
'
Me.ACTIVECheckBox.DataBindings.Add(New System.Windows.Forms.Binding("CheckState", Me.TBDD_INDEX_MANBindingSource, "ACTIVE", True))
@ -1336,11 +1373,6 @@ Partial Class frmAdministration
Me.ACTIVECheckBox.Name = "ACTIVECheckBox"
Me.ACTIVECheckBox.UseVisualStyleBackColor = True
'
'TBDD_INDEX_MANBindingSource
'
Me.TBDD_INDEX_MANBindingSource.DataMember = "TBDD_INDEX_MAN"
Me.TBDD_INDEX_MANBindingSource.DataSource = Me.MyDataset
'
'GUIDTextBox1
'
Me.GUIDTextBox1.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.TBDD_INDEX_MANBindingSource, "GUID", True))
@ -1768,6 +1800,8 @@ Partial Class frmAdministration
Me.XtraTabPageAutoIndex.Appearance.Header.GradientMode = CType(resources.GetObject("XtraTabPageAutoIndex.Appearance.Header.GradientMode"), System.Drawing.Drawing2D.LinearGradientMode)
Me.XtraTabPageAutoIndex.Appearance.HeaderActive.GradientMode = CType(resources.GetObject("XtraTabPageAutoIndex.Appearance.HeaderActive.GradientMode"), System.Drawing.Drawing2D.LinearGradientMode)
resources.ApplyResources(Me.XtraTabPageAutoIndex, "XtraTabPageAutoIndex")
Me.XtraTabPageAutoIndex.Controls.Add(Me.txtAutomIndexConnectionId)
Me.XtraTabPageAutoIndex.Controls.Add(Me.txtAutomIndexSQLResult)
Me.XtraTabPageAutoIndex.Controls.Add(Me.Label6)
Me.XtraTabPageAutoIndex.Controls.Add(Me.ListBoxControl4)
Me.XtraTabPageAutoIndex.Controls.Add(Me.btnAddWindowsVariable)
@ -2385,17 +2419,17 @@ Partial Class frmAdministration
Me.RibbonPage8.Name = "RibbonPage8"
resources.ApplyResources(Me.RibbonPage8, "RibbonPage8")
'
'txtManIndexSQL
'txtAutomIndexSQLResult
'
Me.txtManIndexSQL.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.TBDD_INDEX_MANBindingSource, "SQL_RESULT", True))
resources.ApplyResources(Me.txtManIndexSQL, "txtManIndexSQL")
Me.txtManIndexSQL.Name = "txtManIndexSQL"
Me.txtAutomIndexSQLResult.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.TBDD_INDEX_AUTOMBindingSource, "SQL_RESULT", True))
resources.ApplyResources(Me.txtAutomIndexSQLResult, "txtAutomIndexSQLResult")
Me.txtAutomIndexSQLResult.Name = "txtAutomIndexSQLResult"
'
'txtManIndexConnectionId
'txtAutomIndexConnectionId
'
Me.txtManIndexConnectionId.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.TBDD_INDEX_MANBindingSource, "CONNECTION_ID", True))
resources.ApplyResources(Me.txtManIndexConnectionId, "txtManIndexConnectionId")
Me.txtManIndexConnectionId.Name = "txtManIndexConnectionId"
Me.txtAutomIndexConnectionId.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.TBDD_INDEX_AUTOMBindingSource, "CONNECTION_ID", True))
resources.ApplyResources(Me.txtAutomIndexConnectionId, "txtAutomIndexConnectionId")
Me.txtAutomIndexConnectionId.Name = "txtAutomIndexConnectionId"
'
'frmAdministration
'
@ -2706,4 +2740,8 @@ Partial Class frmAdministration
Friend WithEvents SplitContainerControl4 As DevExpress.XtraEditors.SplitContainerControl
Friend WithEvents txtManIndexSQL As TextBox
Friend WithEvents txtManIndexConnectionId As TextBox
Friend WithEvents Button3 As Button
Friend WithEvents lbManIndexDefaultValueParameter As ListBox
Friend WithEvents txtAutomIndexConnectionId As TextBox
Friend WithEvents txtAutomIndexSQLResult As TextBox
End Class

File diff suppressed because it is too large Load Diff

View File

@ -578,39 +578,29 @@ Public Class frmAdministration
End Sub
Private Sub btnSQLViewAuto_Click(sender As Object, e As EventArgs) Handles btnSQLViewAuto.Click
Save_IndexAuto()
CURRENT_DOKART_ID = DOKART_GUIDTextBox.Text
CURRENT_INDEXAUTO = GUIDAUTO_INDEXTextbox.Text
CURRENT_SQL_CONFIG = "AUTO"
'SQLConfigAutoIndex.ShowDialog()
Dim oIndexGuid As Integer = GUIDAUTO_INDEXTextbox.Text
Dim oDocTypeGuid As Integer = DOKART_GUIDTextBox.Text
Dim oSQLCommand = ""
Try
Dim oSQL = $"SELECT SQL_RESULT, CONNECTION_ID FROM TBDD_INDEX_AUTOM WHERE GUID = {oIndexGuid}"
Dim oDatatable As DataTable = ClassDatabase.Return_Datatable(oSQL)
Dim oRow = oDatatable.Rows.Item(0)
Dim oConnection As Integer = 1
Dim oSQLCommand = ""
If Not IsDBNull(oRow.Item("CONNECTION_ID")) Then
oConnection = oRow.Item("CONNECTION_ID")
If txtAutomIndexConnectionId.Text <> String.Empty Then
oConnection = txtAutomIndexConnectionId.Text
End If
If txtAutomIndexSQLResult.Text <> String.Empty Then
oSQLCommand = txtAutomIndexSQLResult.Text
End If
Dim oForm As New frmSQL_DESIGNER(oIndexGuid, oDocTypeGuid) With {
.SQLCommand = oRow.Item("SQL_RESULT"),
.SQLCommand = oSQLCommand,
.ConnectionID = oConnection
}
If oForm.ShowDialog() = DialogResult.OK Then
oSQLCommand = oForm.SQLCommand.Replace("'", "''")
Dim oConnectionId = oForm.SQLConnectionId
oSQL = $"UPDATE TBDD_INDEX_AUTOM SET CONNECTION_ID = {oConnectionId},SQL_RESULT = '{oSQLCommand}',CHANGED_WHO = '{Environment.UserName}' WHERE GUID = {oIndexGuid}"
ClassDatabase.Execute_non_Query(oSQL, True)
txtAutomIndexSQLResult.Text = oForm.SQLCommand
txtAutomIndexConnectionId.Text = oForm.SQLConnectionId
End If
Catch ex As Exception
LOGGER.Error(ex)
@ -1310,4 +1300,24 @@ Public Class frmAdministration
Private Sub BarButtonItem29_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem29.ItemClick
frmEmailIndexing.ShowDialog()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
If lbManIndexDefaultValueParameter.SelectedIndex >= 0 Then
Dim oValue As String = String.Empty
Select Case lbManIndexDefaultValueParameter.SelectedIndex
Case 0 : oValue = "$filename_ext"
Case 1 : oValue = "$filename"
Case 2 : oValue = "$extension"
Case 3 : oValue = "$FileCreateDate"
Case 4 : oValue = "$FileCreatedWho"
Case 5 : oValue = "$DateDDMMYYY"
Case 6 : oValue = "$Username"
Case 7 : oValue = "$Usercode"
Case 8 : oValue = "NULL"
End Select
DEFAULT_VALUETextBox.Text = oValue
End If
End Sub
End Class

View File

@ -1652,7 +1652,7 @@ Public Class frmIndex
Dim DefaultValue = Check_HistoryValues(oControlName, oRow.Item("DOKUMENTART"))
If DefaultValue Is Nothing Then
DefaultValue = oRow.Item("DEFAULT_VALUE")
DefaultValue = GetPlaceholderValue(oRow.Item("DEFAULT_VALUE"), CURRENT_WORKFILE, USER_SHORTNAME)
End If
Select Case oDataType
Case "BOOLEAN"
@ -1751,9 +1751,9 @@ Public Class frmIndex
oResult = oOwner
Case "$DateDDMMYYY".ToUpper
oResult = System.DateTime.Now.ToShortDateString
Case "$Username"
Case "$Username".ToUpper
oResult = Environment.UserName
Case "$Usercode"
Case "$Usercode".ToUpper
oResult = UserShortName
End Select
Catch ex As Exception

View File

@ -122,6 +122,7 @@ Partial Class frmStart
Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.tslblFW})
resources.ApplyResources(Me.StatusStrip1, "StatusStrip1")
Me.StatusStrip1.Name = "StatusStrip1"
Me.StatusStrip1.SizingGrip = False
'
'tslblFW
'

View File

@ -125,7 +125,7 @@
<value>0, 0</value>
</data>
<data name="MenuStrip1.Size" type="System.Drawing.Size, System.Drawing">
<value>284, 24</value>
<value>294, 24</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="MenuStrip1.TabIndex" type="System.Int32, mscorlib">
@ -200,11 +200,20 @@
<metadata name="StatusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>515, 17</value>
</metadata>
<data name="tslblFW.Size" type="System.Drawing.Size, System.Drawing">
<value>133, 17</value>
</data>
<data name="tslblFW.Text" xml:space="preserve">
<value>FolderWatch ist aktiv</value>
</data>
<data name="tslblFW.Visible" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="StatusStrip1.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 129</value>
<value>0, 139</value>
</data>
<data name="StatusStrip1.Size" type="System.Drawing.Size, System.Drawing">
<value>284, 22</value>
<value>294, 22</value>
</data>
<data name="StatusStrip1.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
@ -224,15 +233,6 @@
<data name="&gt;&gt;StatusStrip1.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="tslblFW.Size" type="System.Drawing.Size, System.Drawing">
<value>133, 17</value>
</data>
<data name="tslblFW.Text" xml:space="preserve">
<value>FolderWatch ist aktiv</value>
</data>
<data name="tslblFW.Visible" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<metadata name="TimerFolderWatch.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>1072, 17</value>
</metadata>
@ -550,10 +550,10 @@
<value>0, 24</value>
</data>
<data name="LabelControl1.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>5, 5, 5, 5</value>
<value>15, 10, 15, 10</value>
</data>
<data name="LabelControl1.Size" type="System.Drawing.Size, System.Drawing">
<value>284, 52</value>
<value>294, 62</value>
</data>
<data name="LabelControl1.TabIndex" type="System.Int32, mscorlib">
<value>8</value>
@ -617,10 +617,10 @@ auf dieses Fenster oder...</value>
<value>NoControl</value>
</data>
<data name="btnChoosefiles.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 76</value>
<value>0, 86</value>
</data>
<data name="btnChoosefiles.Size" type="System.Drawing.Size, System.Drawing">
<value>284, 53</value>
<value>294, 53</value>
</data>
<data name="btnChoosefiles.TabIndex" type="System.Int32, mscorlib">
<value>9</value>
@ -647,16 +647,16 @@ auf dieses Fenster oder...</value>
<value>203</value>
</metadata>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>284, 151</value>
<value>294, 161</value>
</data>
<data name="$this.Font" type="System.Drawing.Font, System.Drawing">
<value>Segoe UI, 8.25pt</value>
</data>
<data name="$this.MaximumSize" type="System.Drawing.Size, System.Drawing">
<value>300, 190</value>
<value>310, 200</value>
</data>
<data name="$this.MinimumSize" type="System.Drawing.Size, System.Drawing">
<value>300, 190</value>
<value>310, 200</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>Global Indexer</value>

View File

@ -368,8 +368,7 @@ Public Class frmStart
Unregister_Hotkeys()
Load_Hotkeys()
Me.Opacity = 30
Me.TopMost = True
TopMost = True
Catch ex As Exception
MsgBox("Unexpected Error in Load-Form" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
@ -681,7 +680,7 @@ Public Class frmStart
TimerFolderWatch.Start()
End If
loaded = True
Opacity = 0.6
Opacity = 0.7
ClassHelper.Refresh_RegexTable()