From b2aba0764410b6a2c0ac7d0b45207a3adfe45382 Mon Sep 17 00:00:00 2001 From: OlgunR Date: Fri, 8 Aug 2025 12:44:12 +0200 Subject: [PATCH] Laden von Default Values in LookupControls - ClassPatterns, frmIndex --- Global_Indexer/App.config | 44 +- Global_Indexer/ClassPatterns.vb | 1 + Global_Indexer/Global_Indexer.vbproj | 22 +- Global_Indexer/frmIndex.vb | 930 +++++++++++++----- SetupFileFlow2.8.0.0/Product.wxs | 30 + .../SetupFileFlow2.8.0.0.wixproj | 37 + 6 files changed, 795 insertions(+), 269 deletions(-) create mode 100644 SetupFileFlow2.8.0.0/Product.wxs create mode 100644 SetupFileFlow2.8.0.0/SetupFileFlow2.8.0.0.wixproj diff --git a/Global_Indexer/App.config b/Global_Indexer/App.config index ee5e46f..8dda816 100644 --- a/Global_Indexer/App.config +++ b/Global_Indexer/App.config @@ -94,40 +94,68 @@ - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Global_Indexer/ClassPatterns.vb b/Global_Indexer/ClassPatterns.vb index e46a23a..522b170 100644 --- a/Global_Indexer/ClassPatterns.vb +++ b/Global_Indexer/ClassPatterns.vb @@ -5,6 +5,7 @@ Imports DigitalData.Modules.Base Imports DigitalData.GUIs.GlobalIndexer Imports WINDREAMLib Imports System.IO +Imports DevExpress.Data ''' ''' Defines common Functions for Checking for and replacing placeholders. diff --git a/Global_Indexer/Global_Indexer.vbproj b/Global_Indexer/Global_Indexer.vbproj index fa3f661..b7613fc 100644 --- a/Global_Indexer/Global_Indexer.vbproj +++ b/Global_Indexer/Global_Indexer.vbproj @@ -16,6 +16,8 @@ true false + + publish\ true Disk @@ -30,8 +32,6 @@ 1.0.0.%2a false true - - AnyCPU @@ -812,24 +812,6 @@ - - {2DF8D04C-5BFA-101B-BDE5-00AA0044DE52} - 2 - 7 - 0 - primary - False - True - - - {00062FFF-0000-0000-C000-000000000046} - 9 - 5 - 0 - primary - False - True - {00020430-0000-0000-C000-000000000046} 2 diff --git a/Global_Indexer/frmIndex.vb b/Global_Indexer/frmIndex.vb index 7c09477..d7ce590 100644 --- a/Global_Indexer/frmIndex.vb +++ b/Global_Indexer/frmIndex.vb @@ -376,185 +376,533 @@ Public Class frmIndex '#End Region '#Region "+++++ Funktionen bei OK - schliessen ++++++" - Function CheckWrite_IndexeMan(oDocumentTypeId As Integer) - '#### Zuerst manuelle Werte indexieren #### + 'Function CheckWrite_IndexeMan(oDocumentTypeId As Integer) + ' '#### Zuerst manuelle Werte indexieren #### + ' Try + ' _Logger.Info("In CheckWrite_IndexeMan") + + ' DxErrorProvider1.ClearErrors() + + ' Dim oResult As Boolean = False + ' For Each oControl As Control In Me.pnlIndex.Controls + ' ' MsgBox(ctrl.Name) + ' If oControl.Name.StartsWith("txt") Then + ' Dim box As DevExpress.XtraEditors.TextEdit = oControl + ' If box.Text = "" Then + ' Dim optional_index As Boolean = DATABASE_ECM.GetScalarValue("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & oDocumentTypeId & " AND NAME = '" & Replace(box.Name, "txt", "") & "'") + ' If optional_index = False Then + + ' If USER_LANGUAGE = LANG_DE Then + ' 'MsgBox(TEXT_MISSING_INPUT_DE, MsgBoxStyle.Exclamation, "Fehlende Eingabe:") + ' DxErrorProvider1.SetError(box, TEXT_MISSING_INPUT_DE) + ' Else + ' 'MsgBox(TEXT_MISSING_INPUT_EN, MsgBoxStyle.Exclamation, "Missing Input:") + ' DxErrorProvider1.SetError(box, TEXT_MISSING_INPUT_EN) + ' End If + + ' box.Focus() + ' Return False + ' Else + ' DxErrorProvider1.SetError(box, "") + ' Indexwert_Postprocessing(Replace(box.Name, "txt", ""), "") + ' oResult = True + ' End If + ' Else + ' If Indexwert_checkValueDB(Replace(box.Name, "txt", ""), box.Text) = False Then + ' Dim oMessage, oTitle As String + + ' If USER_LANGUAGE = LANG_DE Then + ' oTitle = "Fehlerhafte Indexierung:" + ' oMessage = "Der eingegebene Wert wurde nicht in der Datenbank gefunden!" + ' Else + ' oTitle = "Erroneous Indexing:" + ' oMessage = "The value was not found in the Database!" + ' End If + + ' _Logger.Info(oMessage) + ' DxErrorProvider1.SetError(box, oMessage) + ' box.Focus() + ' Return False + ' Else + ' DxErrorProvider1.SetError(box, "") + ' Indexwert_Postprocessing(Replace(box.Name, "txt", ""), box.Text) + ' oResult = True + ' End If + ' End If + ' End If + + ' If oControl.Name.StartsWith("cmbMulti") Then + ' Dim oLookup = DirectCast(oControl, DigitalData.Controls.LookupGrid.LookupControl3) + ' Dim oValues As List(Of String) = oLookup.Properties.SelectedValues + + ' If oValues.Count = 0 Then + ' Dim oIsOptionalIndex As Boolean = DATABASE_ECM.GetScalarValue("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & oDocumentTypeId & " AND NAME = '" & Replace(oLookup.Name, "cmbMulti", "") & "'") + + ' If oIsOptionalIndex = False Then + ' If USER_LANGUAGE = LANG_DE Then + ' 'MsgBox(TEXT_MISSING_INPUT_DE, MsgBoxStyle.Exclamation, Text) + ' DxErrorProvider1.SetError(oLookup, TEXT_MISSING_INPUT_DE) + ' Else + ' 'MsgBox(TEXT_MISSING_INPUT_EN, MsgBoxStyle.Exclamation, Text) + ' DxErrorProvider1.SetError(oLookup, TEXT_MISSING_INPUT_EN) + ' End If + + ' oLookup.Focus() + ' Return False + ' Else + ' DxErrorProvider1.SetError(oLookup, "") + ' Indexwert_Postprocessing(Replace(oLookup.Name, "cmbMulti", ""), "") + ' oResult = True + ' End If + ' Else + ' DxErrorProvider1.SetError(oLookup, "") + ' Dim vectorValue = String.Join(ClassConstants.VECTORSEPARATOR, oValues) + ' Indexwert_Postprocessing(Replace(oLookup.Name, "cmbMulti", ""), vectorValue) + ' oResult = True + ' End If + ' ElseIf oControl.Name.StartsWith("cmbSingle") Then + ' Dim cmbSingle As TextBox = oControl + + ' If cmbSingle.Text = "" Then + ' Dim optional_index As Boolean = DATABASE_ECM.GetScalarValue("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & oDocumentTypeId & " AND NAME = '" & Replace(cmbSingle.Name, "cmbSingle", "") & "'") + + ' If optional_index = False Then + ' If USER_LANGUAGE = LANG_DE Then + ' 'MsgBox(TEXT_MISSING_INPUT_DE, MsgBoxStyle.Exclamation, Text) + ' DxErrorProvider1.SetError(cmbSingle, TEXT_MISSING_INPUT_DE) + ' Else + ' 'MsgBox(TEXT_MISSING_INPUT_EN, MsgBoxStyle.Exclamation, Text) + ' DxErrorProvider1.SetError(cmbSingle, TEXT_MISSING_INPUT_EN) + ' End If + ' cmbSingle.Focus() + ' Return False + ' Else + ' DxErrorProvider1.SetError(cmbSingle, "") + ' Indexwert_Postprocessing(Replace(cmbSingle.Name, "cmbSingle", ""), "") + ' oResult = True + ' End If + ' Else + ' Indexwert_Postprocessing(Replace(cmbSingle.Name, "cmbSingle", ""), cmbSingle.Text) + ' oResult = True + ' End If + ' ElseIf oControl.Name.StartsWith("cmb") Then + ' Dim cmb As ComboBox = oControl + ' If cmb.Text = "" Then + ' Dim optional_index As Boolean = DATABASE_ECM.GetScalarValue("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & oDocumentTypeId & " AND NAME = '" & Replace(cmb.Name, "cmb", "") & "'") + ' If optional_index = False Then + ' If USER_LANGUAGE = LANG_DE Then + ' 'MsgBox(TEXT_MISSING_INPUT_DE, MsgBoxStyle.Exclamation, Text) + ' DxErrorProvider1.SetError(cmb, TEXT_MISSING_INPUT_DE) + ' Else + ' 'MsgBox(TEXT_MISSING_INPUT_EN, MsgBoxStyle.Exclamation, Text) + ' DxErrorProvider1.SetError(cmb, TEXT_MISSING_INPUT_EN) + ' End If + ' cmb.Focus() + ' Return False + ' Else + ' DxErrorProvider1.SetError(cmb, "") + ' Indexwert_Postprocessing(Replace(cmb.Name, "cmb", ""), "") + ' oResult = True + ' End If + ' Else + ' DxErrorProvider1.SetError(cmb, "") + ' Indexwert_Postprocessing(Replace(cmb.Name, "cmb", ""), cmb.Text) + ' oResult = True + ' End If + ' End If + ' If oControl.Name.StartsWith("dtp") Then + ' Dim dtp As DevExpress.XtraEditors.DateEdit = oControl + ' Dim oIndexName As String = Replace(dtp.Name, "dtp", "") + + ' If dtp.Text = String.Empty Then + ' Dim optional_index As Boolean = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {oDocumentTypeId} AND NAME = '{oIndexName}'") + + ' If optional_index = False Then + ' If USER_LANGUAGE = LANG_DE Then + ' 'MsgBox(TEXT_MISSING_INPUT_DE, MsgBoxStyle.Exclamation, Text) + ' DxErrorProvider1.SetError(dtp, TEXT_MISSING_INPUT_DE) + ' Else + ' 'MsgBox(TEXT_MISSING_INPUT_EN, MsgBoxStyle.Exclamation, Text) + ' DxErrorProvider1.SetError(dtp, TEXT_MISSING_INPUT_EN) + ' End If + ' dtp.Focus() + ' Return False + ' Else + ' DxErrorProvider1.SetError(dtp, "") + ' Indexwert_Postprocessing(oIndexName, "") + ' oResult = True + ' End If + ' Else + ' DxErrorProvider1.SetError(dtp, "") + ' Indexwert_Postprocessing(Replace(dtp.Name, "dtp", ""), dtp.Text) + ' oResult = True + ' End If + ' End If + ' If oControl.Name.StartsWith("chk") Then + ' Dim chk As CheckEdit = oControl + ' DxErrorProvider1.SetError(chk, "") + ' Indexwert_Postprocessing(Replace(chk.Name, "chk", ""), chk.Checked) + ' oResult = True + ' End If + ' If TypeOf (oControl) Is Button Then + ' Continue For + ' End If + ' If oControl.Name.StartsWith("lbl") = False And oResult = False Then + ' _Logger.Info(TEXT_CHECK_MANUAL_INDEXES_EN) + ' Return False + ' End If + ' Next + + ' Return True + ' Catch ex As Exception + ' ShowErrorMessage(ex, "CheckWrite_IndexeMan") + ' Return False + ' End Try + 'End Function + + 'Function CheckWrite_IndexeMan(oDocumentTypeId As Integer) As Boolean + ' _Logger.Info("In CheckWrite_IndexeMan") + + ' DxErrorProvider1.ClearErrors() + ' Dim oResult As Boolean = False + + ' For Each oControl As Control In Me.pnlIndex.Controls + ' ' Uninteressante Controls überspringen + ' If TypeOf oControl Is System.Windows.Forms.Label OrElse + ' TypeOf oControl Is Button OrElse + ' TypeOf oControl Is Panel Then + ' Continue For + ' End If + + ' ' Textfelder (TextEdit) + ' If oControl.Name.StartsWith("txt") Then + ' Dim txt = TryCast(oControl, DevExpress.XtraEditors.TextEdit) + ' If txt IsNot Nothing AndAlso DxErrorProvider1.GetError(txt) = "" Then + ' oResult = True + ' End If + + ' ' Kombinationsfelder (Multi oder Single Select) + ' ElseIf oControl.Name.StartsWith("cmbMulti") OrElse oControl.Name.StartsWith("cmbSingle") OrElse oControl.Name.StartsWith("cmb") Then + ' Dim cmb = TryCast(oControl, DevExpress.XtraEditors.LookUpEdit) + ' If cmb IsNot Nothing AndAlso DxErrorProvider1.GetError(cmb) = "" Then + ' oResult = True + ' End If + + ' ' Datumsauswahl + ' ElseIf oControl.Name.StartsWith("dtp") Then + ' Dim dtp = TryCast(oControl, DevExpress.XtraEditors.DateEdit) + ' If dtp IsNot Nothing AndAlso DxErrorProvider1.GetError(dtp) = "" Then + ' oResult = True + ' End If + + ' ' Checkboxen + ' ElseIf oControl.Name.StartsWith("chk") Then + ' Dim chk = TryCast(oControl, CheckBox) + ' If chk IsNot Nothing AndAlso DxErrorProvider1.GetError(chk) = "" Then + ' oResult = True + ' End If + + ' ' Sonstiges Control (Debug-Ausgabe) + ' Else + ' _Logger.Warn($"Unbekanntes oder nicht unterstütztes Steuerelement gefunden: {oControl.Name} ({oControl.GetType().Name})") + ' End If + ' Next + + ' If Not oResult Then + ' _Logger.Info(TEXT_CHECK_MANUAL_INDEXES_EN) + ' Return False + ' End If + + ' Return True + 'End Function + + 'Function CheckWrite_IndexeMan(oDocumentTypeId As Integer) As Boolean + ' Try + ' _Logger.Info("In CheckWrite_IndexeMan") + + ' DxErrorProvider1.ClearErrors() + + ' Dim oResult As Boolean = False + + ' For Each oControl As Control In Me.pnlIndex.Controls + + ' ' Labels ignorieren + ' If TypeOf oControl Is System.Windows.Forms.Label Then + ' Continue For + ' End If + + ' ' Textfelder (TextEdit) + ' If oControl.Name.StartsWith("txt") Then + ' Dim box As DevExpress.XtraEditors.TextEdit = DirectCast(oControl, DevExpress.XtraEditors.TextEdit) + ' Dim indexName As String = Replace(box.Name, "txt", "") + ' If box.Text = "" Then + ' Dim optional_index As Boolean = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {oDocumentTypeId} AND NAME = '{indexName}'") + ' If Not optional_index Then + ' DxErrorProvider1.SetError(box, If(USER_LANGUAGE = LANG_DE, TEXT_MISSING_INPUT_DE, TEXT_MISSING_INPUT_EN)) + ' box.Focus() + ' Return False + ' End If + ' Indexwert_Postprocessing(indexName, "") + ' Else + ' If Not Indexwert_checkValueDB(indexName, box.Text) Then + ' Dim msg As String = If(USER_LANGUAGE = LANG_DE, "Der eingegebene Wert wurde nicht in der Datenbank gefunden!", "The value was not found in the Database!") + ' _Logger.Info(msg) + ' DxErrorProvider1.SetError(box, msg) + ' box.Focus() + ' Return False + ' End If + ' Indexwert_Postprocessing(indexName, box.Text) + ' End If + ' oResult = True + ' Continue For + ' End If + + ' ' Multi-Combo (LookupControl3) + ' If oControl.Name.StartsWith("cmbMulti") Then + ' Dim oLookup = DirectCast(oControl, DigitalData.Controls.LookupGrid.LookupControl3) + ' Dim oValues As List(Of String) = oLookup.Properties.SelectedValues + ' Dim indexName As String = Replace(oLookup.Name, "cmbMulti", "") + + ' If oValues.Count = 0 Then + ' Dim optional_index As Boolean = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {oDocumentTypeId} AND NAME = '{indexName}'") + ' If Not optional_index Then + ' DxErrorProvider1.SetError(oLookup, If(USER_LANGUAGE = LANG_DE, TEXT_MISSING_INPUT_DE, TEXT_MISSING_INPUT_EN)) + ' oLookup.Focus() + ' Return False + ' End If + ' Indexwert_Postprocessing(indexName, "") + ' Else + ' Dim vectorValue As String = String.Join(ClassConstants.VECTORSEPARATOR, oValues) + ' Indexwert_Postprocessing(indexName, vectorValue) + ' End If + ' oResult = True + ' Continue For + ' End If + + ' ' Single-Combo (TextBox als Dropdown?) + ' If oControl.Name.StartsWith("cmbSingle") Then + ' Dim cmbSingle As System.Windows.Forms.TextBox = DirectCast(oControl, System.Windows.Forms.TextBox) + ' Dim indexName As String = Replace(cmbSingle.Name, "cmbSingle", "") + ' If cmbSingle.Text = "" Then + ' Dim optional_index As Boolean = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {oDocumentTypeId} AND NAME = '{indexName}'") + ' If Not optional_index Then + ' DxErrorProvider1.SetError(cmbSingle, If(USER_LANGUAGE = LANG_DE, TEXT_MISSING_INPUT_DE, TEXT_MISSING_INPUT_EN)) + ' cmbSingle.Focus() + ' Return False + ' End If + ' Indexwert_Postprocessing(indexName, "") + ' Else + ' Indexwert_Postprocessing(indexName, cmbSingle.Text) + ' End If + ' oResult = True + ' Continue For + ' End If + + ' ' Standard-ComboBox + ' If oControl.Name.StartsWith("cmb") Then + ' Dim cmb As System.Windows.Forms.ComboBox = DirectCast(oControl, System.Windows.Forms.ComboBox) + ' Dim indexName As String = Replace(cmb.Name, "cmb", "") + ' If cmb.Text = "" Then + ' Dim optional_index As Boolean = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {oDocumentTypeId} AND NAME = '{indexName}'") + ' If Not optional_index Then + ' DxErrorProvider1.SetError(cmb, If(USER_LANGUAGE = LANG_DE, TEXT_MISSING_INPUT_DE, TEXT_MISSING_INPUT_EN)) + ' cmb.Focus() + ' Return False + ' End If + ' Indexwert_Postprocessing(indexName, "") + ' Else + ' Indexwert_Postprocessing(indexName, cmb.Text) + ' End If + ' oResult = True + ' Continue For + ' End If + + ' ' DatePicker + ' If oControl.Name.StartsWith("dtp") Then + ' Dim dtp As DevExpress.XtraEditors.DateEdit = DirectCast(oControl, DevExpress.XtraEditors.DateEdit) + ' Dim indexName As String = Replace(dtp.Name, "dtp", "") + ' If dtp.Text = "" Then + ' Dim optional_index As Boolean = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {oDocumentTypeId} AND NAME = '{indexName}'") + ' If Not optional_index Then + ' DxErrorProvider1.SetError(dtp, If(USER_LANGUAGE = LANG_DE, TEXT_MISSING_INPUT_DE, TEXT_MISSING_INPUT_EN)) + ' dtp.Focus() + ' Return False + ' End If + ' Indexwert_Postprocessing(indexName, "") + ' Else + ' Indexwert_Postprocessing(indexName, dtp.Text) + ' End If + ' oResult = True + ' Continue For + ' End If + + ' ' Checkbox + ' If oControl.Name.StartsWith("chk") Then + ' Dim chk As DevExpress.XtraEditors.CheckEdit = DirectCast(oControl, DevExpress.XtraEditors.CheckEdit) + ' Dim indexName As String = Replace(chk.Name, "chk", "") + ' Indexwert_Postprocessing(indexName, chk.Checked) + ' oResult = True + ' Continue For + ' End If + + ' ' Buttons ignorieren + ' If TypeOf oControl Is System.Windows.Forms.Button Then + ' Continue For + ' End If + ' Next + + ' Return True + + ' Catch ex As Exception + ' ShowErrorMessage(ex, "CheckWrite_IndexeMan") + ' Return False + ' End Try + 'End Function + + Function CheckWrite_IndexeMan(oDocumentTypeId As Integer) As Boolean Try _Logger.Info("In CheckWrite_IndexeMan") DxErrorProvider1.ClearErrors() - Dim oResult As Boolean = False + For Each oControl As Control In Me.pnlIndex.Controls - ' MsgBox(ctrl.Name) - If oControl.Name.StartsWith("txt") Then - Dim box As DevExpress.XtraEditors.TextEdit = oControl - If box.Text = "" Then - Dim optional_index As Boolean = DATABASE_ECM.GetScalarValue("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & oDocumentTypeId & " AND NAME = '" & Replace(box.Name, "txt", "") & "'") - If optional_index = False Then + ' Labels überspringen + If TypeOf oControl Is System.Windows.Forms.Label Then + Continue For + End If - If USER_LANGUAGE = LANG_DE Then - 'MsgBox(TEXT_MISSING_INPUT_DE, MsgBoxStyle.Exclamation, "Fehlende Eingabe:") - DxErrorProvider1.SetError(box, TEXT_MISSING_INPUT_DE) - Else - 'MsgBox(TEXT_MISSING_INPUT_EN, MsgBoxStyle.Exclamation, "Missing Input:") - DxErrorProvider1.SetError(box, TEXT_MISSING_INPUT_EN) - End If + ' Textboxen (TextEdit) + If oControl.Name.StartsWith("txt") Then + Dim box As DevExpress.XtraEditors.TextEdit = DirectCast(oControl, DevExpress.XtraEditors.TextEdit) + Dim indexName = Replace(box.Name, "txt", "") + Dim optionalIndex As Boolean = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {oDocumentTypeId} AND NAME = '{indexName}'") + If String.IsNullOrWhiteSpace(box.Text) Then + If Not optionalIndex Then + DxErrorProvider1.SetError(box, If(USER_LANGUAGE = LANG_DE, TEXT_MISSING_INPUT_DE, TEXT_MISSING_INPUT_EN)) box.Focus() Return False - Else - DxErrorProvider1.SetError(box, "") - Indexwert_Postprocessing(Replace(box.Name, "txt", ""), "") - oResult = True End If + Indexwert_Postprocessing(indexName, "") Else - If Indexwert_checkValueDB(Replace(box.Name, "txt", ""), box.Text) = False Then - Dim oMessage, oTitle As String - - If USER_LANGUAGE = LANG_DE Then - oTitle = "Fehlerhafte Indexierung:" - oMessage = "Der eingegebene Wert wurde nicht in der Datenbank gefunden!" - Else - oTitle = "Erroneous Indexing:" - oMessage = "The value was not found in the Database!" - End If - - _Logger.Info(oMessage) - DxErrorProvider1.SetError(box, oMessage) + If Not Indexwert_checkValueDB(indexName, box.Text) Then + Dim msg = If(USER_LANGUAGE = LANG_DE, + "Der eingegebene Wert wurde nicht in der Datenbank gefunden!", + "The value was not found in the Database!") + DxErrorProvider1.SetError(box, msg) box.Focus() Return False - Else - DxErrorProvider1.SetError(box, "") - Indexwert_Postprocessing(Replace(box.Name, "txt", ""), box.Text) - oResult = True End If + Indexwert_Postprocessing(indexName, box.Text) End If + oResult = True + Continue For End If + ' Mehrfachauswahl (LookupControl3) If oControl.Name.StartsWith("cmbMulti") Then - Dim oLookup = DirectCast(oControl, DigitalData.Controls.LookupGrid.LookupControl3) - Dim oValues As List(Of String) = oLookup.Properties.SelectedValues - - If oValues.Count = 0 Then - Dim oIsOptionalIndex As Boolean = DATABASE_ECM.GetScalarValue("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & oDocumentTypeId & " AND NAME = '" & Replace(oLookup.Name, "cmbMulti", "") & "'") - - If oIsOptionalIndex = False Then - If USER_LANGUAGE = LANG_DE Then - 'MsgBox(TEXT_MISSING_INPUT_DE, MsgBoxStyle.Exclamation, Text) - DxErrorProvider1.SetError(oLookup, TEXT_MISSING_INPUT_DE) - Else - 'MsgBox(TEXT_MISSING_INPUT_EN, MsgBoxStyle.Exclamation, Text) - DxErrorProvider1.SetError(oLookup, TEXT_MISSING_INPUT_EN) - End If - - oLookup.Focus() + Dim lookup = DirectCast(oControl, DigitalData.Controls.LookupGrid.LookupControl3) + Dim values = lookup.Properties.SelectedValues + Dim indexName = Replace(lookup.Name, "cmbMulti", "") + Dim optionalIndex As Boolean = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {oDocumentTypeId} AND NAME = '{indexName}'") + + If values.Count = 0 Then + If Not optionalIndex Then + DxErrorProvider1.SetError(lookup, If(USER_LANGUAGE = LANG_DE, TEXT_MISSING_INPUT_DE, TEXT_MISSING_INPUT_EN)) + lookup.Focus() Return False - Else - DxErrorProvider1.SetError(oLookup, "") - Indexwert_Postprocessing(Replace(oLookup.Name, "cmbMulti", ""), "") - oResult = True End If + Indexwert_Postprocessing(indexName, "") Else - DxErrorProvider1.SetError(oLookup, "") - Dim vectorValue = String.Join(ClassConstants.VECTORSEPARATOR, oValues) - Indexwert_Postprocessing(Replace(oLookup.Name, "cmbMulti", ""), vectorValue) - oResult = True + Dim valueJoined = String.Join(ClassConstants.VECTORSEPARATOR, values) + Indexwert_Postprocessing(indexName, valueJoined) End If - ElseIf oControl.Name.StartsWith("cmbSingle") Then - Dim cmbSingle As TextBox = oControl + oResult = True + Continue For + End If - If cmbSingle.Text = "" Then - Dim optional_index As Boolean = DATABASE_ECM.GetScalarValue("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & oDocumentTypeId & " AND NAME = '" & Replace(cmbSingle.Name, "cmbSingle", "") & "'") + ' Einfachauswahl (TextBox) + If oControl.Name.StartsWith("cmbSingle") Then + Dim cmbSingle = DirectCast(oControl, TextBox) + Dim indexName = Replace(cmbSingle.Name, "cmbSingle", "") + Dim optionalIndex As Boolean = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {oDocumentTypeId} AND NAME = '{indexName}'") - If optional_index = False Then - If USER_LANGUAGE = LANG_DE Then - 'MsgBox(TEXT_MISSING_INPUT_DE, MsgBoxStyle.Exclamation, Text) - DxErrorProvider1.SetError(cmbSingle, TEXT_MISSING_INPUT_DE) - Else - 'MsgBox(TEXT_MISSING_INPUT_EN, MsgBoxStyle.Exclamation, Text) - DxErrorProvider1.SetError(cmbSingle, TEXT_MISSING_INPUT_EN) - End If + If String.IsNullOrWhiteSpace(cmbSingle.Text) Then + If Not optionalIndex Then + DxErrorProvider1.SetError(cmbSingle, If(USER_LANGUAGE = LANG_DE, TEXT_MISSING_INPUT_DE, TEXT_MISSING_INPUT_EN)) cmbSingle.Focus() Return False - Else - DxErrorProvider1.SetError(cmbSingle, "") - Indexwert_Postprocessing(Replace(cmbSingle.Name, "cmbSingle", ""), "") - oResult = True End If + Indexwert_Postprocessing(indexName, "") Else - Indexwert_Postprocessing(Replace(cmbSingle.Name, "cmbSingle", ""), cmbSingle.Text) - oResult = True + Indexwert_Postprocessing(indexName, cmbSingle.Text) End If - ElseIf oControl.Name.StartsWith("cmb") Then - Dim cmb As ComboBox = oControl - If cmb.Text = "" Then - Dim optional_index As Boolean = DATABASE_ECM.GetScalarValue("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & oDocumentTypeId & " AND NAME = '" & Replace(cmb.Name, "cmb", "") & "'") - If optional_index = False Then - If USER_LANGUAGE = LANG_DE Then - 'MsgBox(TEXT_MISSING_INPUT_DE, MsgBoxStyle.Exclamation, Text) - DxErrorProvider1.SetError(cmb, TEXT_MISSING_INPUT_DE) - Else - 'MsgBox(TEXT_MISSING_INPUT_EN, MsgBoxStyle.Exclamation, Text) - DxErrorProvider1.SetError(cmb, TEXT_MISSING_INPUT_EN) - End If + oResult = True + Continue For + End If + + ' ComboBox + If oControl.Name.StartsWith("cmb") Then + Dim cmb = DirectCast(oControl, ComboBox) + Dim indexName = Replace(cmb.Name, "cmb", "") + Dim optionalIndex As Boolean = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {oDocumentTypeId} AND NAME = '{indexName}'") + + If String.IsNullOrWhiteSpace(cmb.Text) Then + If Not optionalIndex Then + DxErrorProvider1.SetError(cmb, If(USER_LANGUAGE = LANG_DE, TEXT_MISSING_INPUT_DE, TEXT_MISSING_INPUT_EN)) cmb.Focus() Return False - Else - DxErrorProvider1.SetError(cmb, "") - Indexwert_Postprocessing(Replace(cmb.Name, "cmb", ""), "") - oResult = True End If + Indexwert_Postprocessing(indexName, "") Else - DxErrorProvider1.SetError(cmb, "") - Indexwert_Postprocessing(Replace(cmb.Name, "cmb", ""), cmb.Text) - oResult = True + Indexwert_Postprocessing(indexName, cmb.Text) End If + oResult = True + Continue For End If - If oControl.Name.StartsWith("dtp") Then - Dim dtp As DevExpress.XtraEditors.DateEdit = oControl - Dim oIndexName As String = Replace(dtp.Name, "dtp", "") - If dtp.Text = String.Empty Then - Dim optional_index As Boolean = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {oDocumentTypeId} AND NAME = '{oIndexName}'") + ' DateTimePicker + If oControl.Name.StartsWith("dtp") Then + Dim dtp = DirectCast(oControl, DevExpress.XtraEditors.DateEdit) + Dim indexName = Replace(dtp.Name, "dtp", "") + Dim optionalIndex As Boolean = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {oDocumentTypeId} AND NAME = '{indexName}'") - If optional_index = False Then - If USER_LANGUAGE = LANG_DE Then - 'MsgBox(TEXT_MISSING_INPUT_DE, MsgBoxStyle.Exclamation, Text) - DxErrorProvider1.SetError(dtp, TEXT_MISSING_INPUT_DE) - Else - 'MsgBox(TEXT_MISSING_INPUT_EN, MsgBoxStyle.Exclamation, Text) - DxErrorProvider1.SetError(dtp, TEXT_MISSING_INPUT_EN) - End If + If String.IsNullOrWhiteSpace(dtp.Text) Then + If Not optionalIndex Then + DxErrorProvider1.SetError(dtp, If(USER_LANGUAGE = LANG_DE, TEXT_MISSING_INPUT_DE, TEXT_MISSING_INPUT_EN)) dtp.Focus() Return False - Else - DxErrorProvider1.SetError(dtp, "") - Indexwert_Postprocessing(oIndexName, "") - oResult = True End If + Indexwert_Postprocessing(indexName, "") Else - DxErrorProvider1.SetError(dtp, "") - Indexwert_Postprocessing(Replace(dtp.Name, "dtp", ""), dtp.Text) - oResult = True + Indexwert_Postprocessing(indexName, dtp.Text) End If + oResult = True + Continue For End If + + ' Checkbox If oControl.Name.StartsWith("chk") Then - Dim chk As CheckEdit = oControl - DxErrorProvider1.SetError(chk, "") - Indexwert_Postprocessing(Replace(chk.Name, "chk", ""), chk.Checked) + Dim chk = DirectCast(oControl, DevExpress.XtraEditors.CheckEdit) + Dim indexName = Replace(chk.Name, "chk", "") + Indexwert_Postprocessing(indexName, chk.Checked) oResult = True - End If - If TypeOf (oControl) Is Button Then Continue For End If - If oControl.Name.StartsWith("lbl") = False And oResult = False Then - _Logger.Info(TEXT_CHECK_MANUAL_INDEXES_EN) - Return False + + ' Buttons ignorieren + If TypeOf oControl Is Button Then + Continue For End If Next - Return True + If Not oResult Then + _Logger.Info(TEXT_CHECK_MANUAL_INDEXES_EN) + End If + + Return oResult Catch ex As Exception ShowErrorMessage(ex, "CheckWrite_IndexeMan") Return False @@ -2210,6 +2558,16 @@ Public Class frmIndex ctrl.Top = oRowTop ctrl.Width = oControlWidth pnlIndex.Controls.Add(ctrl) + + If IsNotNullOrEmpty(DefaultValue) Then + + Me.BeginInvoke( + Sub() + _Logger.Debug("Triggering PrepareDependingControl for [{0}] via BeginInvoke", ctrl.Name) + PrepareDependingControl(ctrl) + End Sub) + + End If End If Dim zeilenhoeheAktuell As Integer @@ -2302,8 +2660,8 @@ Public Class frmIndex Private Sub SetDependingControlResult(IndexName As String, SqlCommand As String, SqlConnectionId As Integer) Try - If SqlCommand Is Nothing OrElse SqlCommand = String.Empty Then - LOGGER.Warn("New Value for Index [{0}] could not be set. Supplied SQL is empty.") + If String.IsNullOrWhiteSpace(SqlCommand) OrElse SqlCommand.Contains("''") OrElse SqlCommand.Contains("IN ()") Then + LOGGER.Warn("Skipped SQL execution for Index [{0}]: Invalid or empty SQL: [{1}]", IndexName, SqlCommand) Exit Sub End If @@ -2419,150 +2777,240 @@ Public Class frmIndex Return oResult End Function - Function FillIndexe_Autom(dokart_id As Integer) - Try - VWINDEX_AUTOMTableAdapter.Fill(MyDataset.VWDDINDEX_AUTOM, CURRENT_DOKART_ID) + 'Function FillIndexe_Autom(dokart_id As Integer) + ' Try + ' VWINDEX_AUTOMTableAdapter.Fill(MyDataset.VWDDINDEX_AUTOM, CURRENT_DOKART_ID) - Dim oDatatable = MyDataset.VWDDINDEX_AUTOM - Dim oRegex As New Regex("\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}") + ' Dim oDatatable = MyDataset.VWDDINDEX_AUTOM + ' Dim oRegex As New Regex("\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}") - If oDatatable.Rows.Count = 0 Then - Return True - End If - Dim oIndexName As String - ' 1. Schritt: Einfach-Indexe und Platzhalter ersetzen - For Each oRow As DataRow In oDatatable - oIndexName = oRow.Item("INDEXNAME") - _Logger.Info("Working on AutomaticIndex: " & oRow.Item("INDEXNAME") & "...") - Dim oSqlResult As String = oRow.ItemEx("SQL_RESULT", "") - Dim oSqlActive As Boolean = oRow.ItemEx("SQL_ACTIVE", False) - Dim oSqlConnectionId As Integer = oRow.ItemEx("CONNECTION_ID", -1) - Dim oSqlProvider As String = oRow.ItemEx("SQL_PROVIDER", "") - Dim oEndResult As New List(Of String) - - ' Wenn kein SQL Befehl vorhanden oder aktiv ist, - ' versuchen wir, die Spalte VALUE zu ersetzen - If oSqlResult = String.Empty Or oSqlActive = 0 Then - Dim oPlaceholderResult As String - Dim oValue As String = oRow.ItemEx("VALUE", "") - - oPlaceholderResult = GetPlaceholderValue(oValue, CURRENT_WORKFILE, USER_SHORTNAME) - - If Not IsNothing(oPlaceholderResult) Then - oValue = oPlaceholderResult - End If + ' If oDatatable.Rows.Count = 0 Then + ' Return True + ' End If + ' Dim oIndexName As String + ' ' 1. Schritt: Einfach-Indexe und Platzhalter ersetzen + ' For Each oRow As DataRow In oDatatable + ' oIndexName = oRow.Item("INDEXNAME") + ' _Logger.Info("Working on AutomaticIndex: " & oRow.Item("INDEXNAME") & "...") + ' Dim oSqlResult As String = oRow.ItemEx("SQL_RESULT", "") + ' Dim oSqlActive As Boolean = oRow.ItemEx("SQL_ACTIVE", False) + ' Dim oSqlConnectionId As Integer = oRow.ItemEx("CONNECTION_ID", -1) + ' Dim oSqlProvider As String = oRow.ItemEx("SQL_PROVIDER", "") + ' Dim oEndResult As New List(Of String) + + ' ' Wenn kein SQL Befehl vorhanden oder aktiv ist, + ' ' versuchen wir, die Spalte VALUE zu ersetzen + ' If oSqlResult = String.Empty Or oSqlActive = 0 Then + ' Dim oPlaceholderResult As String + ' Dim oValue As String = oRow.ItemEx("VALUE", "") + + ' oPlaceholderResult = GetPlaceholderValue(oValue, CURRENT_WORKFILE, USER_SHORTNAME) + + ' If Not IsNothing(oPlaceholderResult) Then + ' oValue = oPlaceholderResult + ' End If - oRow.Item("Indexiert") = True - oRow.Item("Indexwert") = oValue + ' oRow.Item("Indexiert") = True + ' oRow.Item("Indexwert") = oValue - Continue For - End If + ' Continue For + ' End If - ' Wenn ein SQL Befehl vorhanden und aktiv ist - ' Alle Platzhalter finden - Dim oMatches As MatchCollection = oRegex.Matches(oSqlResult) + ' ' Wenn ein SQL Befehl vorhanden und aktiv ist + ' ' Alle Platzhalter finden + ' Dim oMatches As MatchCollection = oRegex.Matches(oSqlResult) - For Each oMatch As Match In oMatches - Dim oIndexValue As String = StripPlaceholder(oMatch.Value) - Dim oOptionalIndex = False - Dim oPlaceholderResult As String = Nothing - Dim oManualIndexResult As String = Nothing + ' For Each oMatch As Match In oMatches + ' Dim oIndexValue As String = StripPlaceholder(oMatch.Value) + ' Dim oOptionalIndex = False + ' Dim oPlaceholderResult As String = Nothing + ' Dim oManualIndexResult As String = Nothing - ' Einfachen Platzhalter Wert erzeugen - oPlaceholderResult = GetPlaceholderValue(oIndexValue, CURRENT_WORKFILE, USER_SHORTNAME) + ' ' Einfachen Platzhalter Wert erzeugen + ' oPlaceholderResult = GetPlaceholderValue(oIndexValue, CURRENT_WORKFILE, USER_SHORTNAME) + + ' ' Einfachen Platzhalter ersetzen + ' If Not IsNothing(oPlaceholderResult) Then + ' oSqlResult = oSqlResult.Replace(oMatch.Value, oPlaceholderResult) + ' End If + + ' oOptionalIndex = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {CURRENT_DOKART_ID} AND UPPER(NAME) = UPPER('{oIndexValue}')") + ' oManualIndexResult = GetManIndex_Value(oIndexValue, "IDX_AUTO", oOptionalIndex) + + ' ' Wenn Ergebnis den VektorPlatzhalter enthält, soll nichts ersetzt werden. + ' ' Werden im nächsten Schritt ersetzt. + ' If oManualIndexResult.Contains(ClassConstants.VECTORSEPARATOR) Then + ' oManualIndexResult = Nothing + ' End If + + ' If Not IsNothing(oManualIndexResult) Then + ' oSqlResult = oSqlResult.Replace(oMatch.Value, oManualIndexResult) + ' End If + ' Next + + ' oSqlResult = ClassPatterns.ReplaceControlValues(oSqlResult, pnlIndex) + ' oSqlResult = ClassPatterns.ReplaceInternalValues(oSqlResult) + ' oSqlResult = ClassPatterns.ReplaceUserValues(oSqlResult, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_DOKART_ID) - ' Einfachen Platzhalter ersetzen - If Not IsNothing(oPlaceholderResult) Then - oSqlResult = oSqlResult.Replace(oMatch.Value, oPlaceholderResult) - End If - oOptionalIndex = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {CURRENT_DOKART_ID} AND UPPER(NAME) = UPPER('{oIndexValue}')") - oManualIndexResult = GetManIndex_Value(oIndexValue, "IDX_AUTO", oOptionalIndex) + ' If oSqlResult <> String.Empty Then + ' _Logger.Debug("oSqlResult after Replace [" & oSqlResult & "]") + ' End If + ' ' Ergebnis: Es wurden alle einfachen Platzhalter ersetz't, jetzt haben wir einen SQL Befehl, + ' ' der nur noch vektorfelder-platzhalter enthält + + ' ' 2. Schritt: Vektorfelder ersetzen + ' Dim oVectorMatches As MatchCollection = oRegex.Matches(oSqlResult) + ' If oVectorMatches.Count > 0 Or oIndexName.Contains("Vektor") Then + ' Dim oResult = GetAutomaticIndexSQLValue(oSqlResult, oSqlConnectionId, oSqlProvider) + ' Dim oConnectionString As String + ' oConnectionString = DATABASE_ECM.Get_ConnectionStringforID(oSqlConnectionId) + ' Try + ' Dim oResultDT As DataTable = DATABASE_ECM.GetDatatableWithConnection(oSqlResult, oConnectionString) + ' If Not IsNothing(oResultDT) Then + ' _Logger.Info("We got [" & oResultDT.Rows.Count & "] result(s) for the vector-field!") + ' For Each oResultRow As DataRow In oResultDT.Rows + ' oEndResult.Add(oResultRow.Item(0)) + ' Next + ' End If + ' If oEndResult.Count > 0 Then + ' oRow.Item("Indexiert") = True + ' oRow.Item("Indexwert") = String.Join(ClassConstants.VECTORSEPARATOR, oEndResult.ToArray) + ' End If + ' Catch ex As Exception + ' ShowErrorMessage(ex, $"FillIndexe_Autom - Vektorfield [{oIndexName}] ") + ' End Try + + ' 'Dim oIsFirstMatch = True + ' 'D + ' 'For Each oVectorMatch As Match In oVectorMatches + ' ' Dim oIndexValue As String = StripPlaceholder(oVectorMatch.Value) + ' ' Dim oOptionalIndex = False + ' ' Dim oManualIndexResult As String = Nothing + + ' ' oOptionalIndex = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {CURRENT_DOKART_ID} AND UPPER(NAME) = UPPER('{oIndexValue}')") + ' ' oManualIndexResult = GetManIndex_Value(oIndexValue, "IDX_AUTO", oOptionalIndex) + + ' ' Dim oVectorIndexValues = oManualIndexResult.Split(ClassConstants.VECTORSEPARATOR).ToList() + + ' ' For Each oVectorIndexValue In oVectorIndexValues + ' ' Dim oTempSql = oSqlResult.Replace(oVectorMatch.Value, oVectorIndexValue) + ' ' Dim oResult = GetAutomaticIndexSQLValue(oTempSql, oSqlConnectionId, oSqlProvider) + ' ' oEndResult.Add(oResult) + ' ' Next + + ' ' ' Verhindert, dass die Schleife mehrmals durchlaufen wird + ' ' If oIsFirstMatch Then + ' ' Exit For + ' ' End If + ' ' oRow.Item("Indexiert") = True + ' ' oRow.Item("Indexwert") = String.Join(ClassConstants.VECTORSEPARATOR, oEndResult.ToArray) + ' 'Next + ' Else + ' Dim oResult = GetAutomaticIndexSQLValue(oSqlResult, oSqlConnectionId, oSqlProvider) + ' _Logger.Info("Got a simple SQLResult: " & oResult.ToString) + ' oRow.Item("Indexiert") = True + ' oRow.Item("Indexwert") = oResult + + ' End If + ' Next + + ' Return True + ' Catch ex As Exception + ' ShowErrorMessage(ex, "FillIndexe_Autom") + ' Return False + ' End Try + 'End Function + + Function FillIndexe_Autom(dokart_id As Integer) As Boolean + Try + VWINDEX_AUTOMTableAdapter.Fill(MyDataset.VWDDINDEX_AUTOM, dokart_id) + Dim oDatatable = MyDataset.VWDDINDEX_AUTOM + Dim placeholderRegex As New Regex("\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}") + + If oDatatable.Rows.Count = 0 Then Return True - ' Wenn Ergebnis den VektorPlatzhalter enthält, soll nichts ersetzt werden. - ' Werden im nächsten Schritt ersetzt. - If oManualIndexResult.Contains(ClassConstants.VECTORSEPARATOR) Then - oManualIndexResult = Nothing + For Each oRow As DataRow In oDatatable + Dim indexName = oRow.Item("INDEXNAME").ToString + _Logger.Info($"Working on AutomaticIndex: {indexName}...") + + Dim sql = oRow.ItemEx("SQL_RESULT", "") + Dim sqlActive = oRow.ItemEx("SQL_ACTIVE", False) + Dim connId = oRow.ItemEx("CONNECTION_ID", -1) + Dim provider = oRow.ItemEx("SQL_PROVIDER", "") + Dim value = oRow.ItemEx("VALUE", "") + Dim endResult As New List(Of String) + + ' #### Fall: Kein SQL oder SQL ist nicht aktiv + If String.IsNullOrWhiteSpace(sql) OrElse Not sqlActive Then + Dim resolved = GetPlaceholderValue(value, CURRENT_WORKFILE, USER_SHORTNAME) + oRow("Indexiert") = True + oRow("Indexwert") = If(resolved, value) + Continue For + End If + + ' #### Fall: SQL aktiv – einfache Platzhalter ersetzen + Dim matches = placeholderRegex.Matches(sql) + + For Each match As Match In matches + Dim ph = StripPlaceholder(match.Value) + Dim resolvedPH = GetPlaceholderValue(ph, CURRENT_WORKFILE, USER_SHORTNAME) + If Not String.IsNullOrWhiteSpace(resolvedPH) Then + sql = sql.Replace(match.Value, resolvedPH) + Continue For End If - If Not IsNothing(oManualIndexResult) Then - oSqlResult = oSqlResult.Replace(oMatch.Value, oManualIndexResult) + Dim isOptional = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {dokart_id} AND UPPER(NAME) = UPPER('{ph}')") + Dim manIndex = GetManIndex_Value(ph, "IDX_AUTO", isOptional) + + If Not String.IsNullOrWhiteSpace(manIndex) AndAlso Not manIndex.Contains(ClassConstants.VECTORSEPARATOR) Then + sql = sql.Replace(match.Value, manIndex) End If Next - oSqlResult = ClassPatterns.ReplaceControlValues(oSqlResult, pnlIndex) - oSqlResult = ClassPatterns.ReplaceInternalValues(oSqlResult) - oSqlResult = ClassPatterns.ReplaceUserValues(oSqlResult, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_DOKART_ID) + ' #### Platzhalter durch Umgebungsvariablen ersetzen + sql = ClassPatterns.ReplaceControlValues(sql, pnlIndex) + sql = ClassPatterns.ReplaceInternalValues(sql) + sql = ClassPatterns.ReplaceUserValues(sql, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, dokart_id) + If Not String.IsNullOrWhiteSpace(sql) Then _Logger.Debug("SQL after Replace: " & sql) - If oSqlResult <> String.Empty Then - _Logger.Debug("oSqlResult after Replace [" & oSqlResult & "]") - End If - ' Ergebnis: Es wurden alle einfachen Platzhalter ersetz't, jetzt haben wir einen SQL Befehl, - ' der nur noch vektorfelder-platzhalter enthält - - ' 2. Schritt: Vektorfelder ersetzen - Dim oVectorMatches As MatchCollection = oRegex.Matches(oSqlResult) - If oVectorMatches.Count > 0 Or oIndexName.Contains("Vektor") Then - Dim oResult = GetAutomaticIndexSQLValue(oSqlResult, oSqlConnectionId, oSqlProvider) - Dim oConnectionString As String - oConnectionString = DATABASE_ECM.Get_ConnectionStringforID(oSqlConnectionId) + ' #### Fall: Vektor-Platzhalter oder Vektor-Index + If placeholderRegex.Matches(sql).Count > 0 OrElse indexName.Contains("Vektor") Then Try - Dim oResultDT As DataTable = DATABASE_ECM.GetDatatableWithConnection(oSqlResult, oConnectionString) - If Not IsNothing(oResultDT) Then - _Logger.Info("We got [" & oResultDT.Rows.Count & "] result(s) for the vector-field!") - For Each oResultRow As DataRow In oResultDT.Rows - oEndResult.Add(oResultRow.Item(0)) + Dim connString = DATABASE_ECM.Get_ConnectionStringforID(connId) + Dim resultDT = DATABASE_ECM.GetDatatableWithConnection(sql, connString) + + If resultDT IsNot Nothing Then + For Each resultRow As DataRow In resultDT.Rows + endResult.Add(resultRow.Item(0).ToString()) Next - End If - If oEndResult.Count > 0 Then - oRow.Item("Indexiert") = True - oRow.Item("Indexwert") = String.Join(ClassConstants.VECTORSEPARATOR, oEndResult.ToArray) + + If endResult.Count > 0 Then + oRow("Indexiert") = True + oRow("Indexwert") = String.Join(ClassConstants.VECTORSEPARATOR, endResult) + End If End If Catch ex As Exception - ShowErrorMessage(ex, $"FillIndexe_Autom - Vektorfield [{oIndexName}] ") + ShowErrorMessage(ex, $"FillIndexe_Autom - Vektorfield [{indexName}]") End Try - - 'Dim oIsFirstMatch = True - 'D - 'For Each oVectorMatch As Match In oVectorMatches - ' Dim oIndexValue As String = StripPlaceholder(oVectorMatch.Value) - ' Dim oOptionalIndex = False - ' Dim oManualIndexResult As String = Nothing - - ' oOptionalIndex = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {CURRENT_DOKART_ID} AND UPPER(NAME) = UPPER('{oIndexValue}')") - ' oManualIndexResult = GetManIndex_Value(oIndexValue, "IDX_AUTO", oOptionalIndex) - - ' Dim oVectorIndexValues = oManualIndexResult.Split(ClassConstants.VECTORSEPARATOR).ToList() - - ' For Each oVectorIndexValue In oVectorIndexValues - ' Dim oTempSql = oSqlResult.Replace(oVectorMatch.Value, oVectorIndexValue) - ' Dim oResult = GetAutomaticIndexSQLValue(oTempSql, oSqlConnectionId, oSqlProvider) - ' oEndResult.Add(oResult) - ' Next - - ' ' Verhindert, dass die Schleife mehrmals durchlaufen wird - ' If oIsFirstMatch Then - ' Exit For - ' End If - ' oRow.Item("Indexiert") = True - ' oRow.Item("Indexwert") = String.Join(ClassConstants.VECTORSEPARATOR, oEndResult.ToArray) - 'Next Else - Dim oResult = GetAutomaticIndexSQLValue(oSqlResult, oSqlConnectionId, oSqlProvider) - _Logger.Info("Got a simple SQLResult: " & oResult.ToString) - oRow.Item("Indexiert") = True - oRow.Item("Indexwert") = oResult - + ' #### Fall: Nur einfacher SQL ohne Vektor + Dim result = GetAutomaticIndexSQLValue(sql, connId, provider) + _Logger.Info($"Got simple SQLResult: {result}") + oRow("Indexiert") = True + oRow("Indexwert") = result End If Next Return True + Catch ex As Exception ShowErrorMessage(ex, "FillIndexe_Autom") Return False End Try End Function + Private Sub btnVorschau_Click(sender As System.Object, e As System.EventArgs) PreviewFile() End Sub diff --git a/SetupFileFlow2.8.0.0/Product.wxs b/SetupFileFlow2.8.0.0/Product.wxs new file mode 100644 index 0000000..cb0cea9 --- /dev/null +++ b/SetupFileFlow2.8.0.0/Product.wxs @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SetupFileFlow2.8.0.0/SetupFileFlow2.8.0.0.wixproj b/SetupFileFlow2.8.0.0/SetupFileFlow2.8.0.0.wixproj new file mode 100644 index 0000000..9038073 --- /dev/null +++ b/SetupFileFlow2.8.0.0/SetupFileFlow2.8.0.0.wixproj @@ -0,0 +1,37 @@ + + + + Debug + x86 + 3.10 + 47c56ef4-099e-45d1-a01f-715599429a34 + 2.0 + SetupFileFlow2.8.0.0 + Package + + + bin\$(Configuration)\ + obj\$(Configuration)\ + Debug + + + bin\$(Configuration)\ + obj\$(Configuration)\ + + + + + + + + + + + \ No newline at end of file