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

@@ -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