From a7ec95cb1925fcb2d95307f261660e3dd1979219 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Mon, 13 Dec 2021 16:07:41 +0100 Subject: [PATCH] Zooflow: MASSIVE Clean up in Globix Module --- GUIs.ZooFlow/App.config | 2 +- GUIs.ZooFlow/ApplicationEvents.vb | 32 +- GUIs.ZooFlow/ClassWindowLayout.vb | 22 +- GUIs.ZooFlow/DBCW_Stammdaten.Designer.vb | 6 +- GUIs.ZooFlow/DBCW_Stammdaten.xsd | 8 +- GUIs.ZooFlow/DSDD_Stammdaten.Designer.vb | 2 +- GUIs.ZooFlow/DSDD_Stammdaten.xsd | 4 +- GUIs.ZooFlow/DSIDB_Stammdaten.Designer.vb | 2 +- GUIs.ZooFlow/DSIDB_Stammdaten.xsd | 4 +- GUIs.ZooFlow/Globix/ClassFileDrop.vb | 12 +- GUIs.ZooFlow/Globix/ClassValidator.vb | 17 +- GUIs.ZooFlow/Globix/GlobixControls.vb | 21 +- GUIs.ZooFlow/Globix/GlobixDataset.Designer.vb | 8 +- GUIs.ZooFlow/Globix/GlobixDataset.xsd | 12 +- GUIs.ZooFlow/Globix/GlobixPatterns.vb | 453 ---- GUIs.ZooFlow/Globix/GlobixPostprocessing.vb | 95 - GUIs.ZooFlow/Globix/Models/DocumentType.vb | 11 + GUIs.ZooFlow/Globix/Models/ManualIndex.vb | 25 + GUIs.ZooFlow/Globix/State.vb | 7 +- .../Globix/frmGlobix_Index.Designer.vb | 55 +- GUIs.ZooFlow/Globix/frmGlobix_Index.vb | 2409 +++-------------- GUIs.ZooFlow/ModuleHelpers.vb | 14 +- GUIs.ZooFlow/My Project/Resources.Designer.vb | 10 + GUIs.ZooFlow/My Project/Resources.resx | 139 +- GUIs.ZooFlow/My Project/Settings.Designer.vb | 22 +- GUIs.ZooFlow/My Project/Settings.settings | 14 +- GUIs.ZooFlow/MyDataset.Designer.vb | 4 +- GUIs.ZooFlow/MyDataset.xsd | 6 +- GUIs.ZooFlow/Resources/actions_send.svg | 15 + GUIs.ZooFlow/ZooFlow.vbproj | 7 +- GUIs.ZooFlow/frmFlowForm.Designer.vb | 90 +- GUIs.ZooFlow/frmFlowForm.resx | 12 +- GUIs.ZooFlow/frmFlowForm.vb | 176 +- GUIs.ZooFlow/frmtest.Designer.vb | 1 - GUIs.ZooFlow/modCurrent.vb | 2 - Modules.Database/Adapters/MSSQLServer.vb | 6 +- .../ImportFile/ImportFileMethod.vb | 2 + 37 files changed, 732 insertions(+), 2995 deletions(-) delete mode 100644 GUIs.ZooFlow/Globix/GlobixPatterns.vb delete mode 100644 GUIs.ZooFlow/Globix/GlobixPostprocessing.vb create mode 100644 GUIs.ZooFlow/Globix/Models/DocumentType.vb create mode 100644 GUIs.ZooFlow/Globix/Models/ManualIndex.vb create mode 100644 GUIs.ZooFlow/Resources/actions_send.svg diff --git a/GUIs.ZooFlow/App.config b/GUIs.ZooFlow/App.config index d79df093..ab7dd1c5 100644 --- a/GUIs.ZooFlow/App.config +++ b/GUIs.ZooFlow/App.config @@ -14,7 +14,7 @@ connectionString="Data Source=SDD-VMP04-SQL17\DD_DEVELOP01;Initial Catalog=IDB;Persist Security Info=True;User ID=sa;Password=dd" providerName="System.Data.SqlClient" /> + connectionString="Data Source=SDD-VMP04-SQL17\DD_DEVELOP01;Initial Catalog=DD_ECM;User ID=sa;Password=dd" /> diff --git a/GUIs.ZooFlow/ApplicationEvents.vb b/GUIs.ZooFlow/ApplicationEvents.vb index 96a72a5c..fc281a7a 100644 --- a/GUIs.ZooFlow/ApplicationEvents.vb +++ b/GUIs.ZooFlow/ApplicationEvents.vb @@ -13,36 +13,22 @@ Namespace My Partial Friend Class MyApplication Private _Logger As Logger - Private oUserAppDataPath As String = Windows.Forms.Application.UserAppDataPath - Private _BaseLocalUserConfigPath As String = Windows.Forms.Application.LocalUserAppDataPath - Private oCommonAppDataPath As String = Windows.Forms.Application.CommonAppDataPath - Private oStartupPath As String = Windows.Forms.Application.StartupPath + Private UserAppDataPath As String = Windows.Forms.Application.UserAppDataPath + Private BaseLocalUserConfigPath As String = Windows.Forms.Application.LocalUserAppDataPath + Private CommonAppDataPath As String = Windows.Forms.Application.CommonAppDataPath + Private StartupPath As String = Windows.Forms.Application.StartupPath Public Sub App_Startup() Handles Me.Startup - Dim oLogConfig As New LogConfig(LogPath:=PathType.AppData, CompanyName:="Digital Data", ProductName:="ZooFlow") With {.Debug = True} - If My.Settings.UseAppConfigConString = True Then - ' UserAppDataPath = StartupPath - oCommonAppDataPath = oStartupPath - End If + Dim oLogConfig As New LogConfig(LogPath:=PathType.AppData, CompanyName:="Digital Data", ProductName:="ZooFlow", FileKeepRangeInDays:=30) With {.Debug = True} + ' System Config files like Service Url will be saved in %LocalAppdata% so they will remain on the machine - Dim oConfigManager As New ConfigManager(Of ClassConfig)(oLogConfig, - oUserAppDataPath, - oCommonAppDataPath, - oStartupPath) + Dim oConfigManager As New ConfigManager(Of ClassConfig)(oLogConfig, UserAppDataPath, CommonAppDataPath, StartupPath) ' Layout files will be saved in %Appdata% (Roaming) so they will be syncronized with the user profile - Dim oUIConfigPath = IO.Path.Combine(oUserAppDataPath, ClassConstants.FOLDER_NAME_LAYOUT) - Dim oUIConfigAlternatePath = IO.Path.Combine(oUserAppDataPath, ClassConstants.FOLDER_NAME_LAYOUT) + Dim oUIConfigPath = IO.Path.Combine(UserAppDataPath, ClassConstants.FOLDER_NAME_LAYOUT) + Dim oUIConfigAlternatePath = IO.Path.Combine(UserAppDataPath, ClassConstants.FOLDER_NAME_LAYOUT) Dim oUIConfigManager As New ConfigManager(Of ClassUIConfig)(oLogConfig, oUIConfigPath, oUIConfigPath, oUIConfigAlternatePath) - 'If oConfigManager.Config.ConnectionStringAppServer <> String.Empty Then - ' MyConStringAppserv = DecryptConnectionString(oConfigManager.Config.ConnectionStringAppServer) - ' If InitAppDatabase() Then - ' Logger.Debug("ConnectionStringAppServer will be used") - ' End If - 'End If - - LogConfig = oLogConfig LogConfig.Debug = True diff --git a/GUIs.ZooFlow/ClassWindowLayout.vb b/GUIs.ZooFlow/ClassWindowLayout.vb index 17f68662..1f2eb07b 100644 --- a/GUIs.ZooFlow/ClassWindowLayout.vb +++ b/GUIs.ZooFlow/ClassWindowLayout.vb @@ -38,7 +38,7 @@ Public Class ClassWindowLayout End If _FileName = oPath - Dim settings As System.Collections.Generic.List(Of ClassSetting) + Dim settings As List(Of ClassSetting) settings = Load() If settings.Count = 0 Then @@ -112,8 +112,7 @@ Public Class ClassWindowLayout Dim _path As String _path = Path.Combine(Application.UserAppDataPath(), form.Name & "-Layout.xml") - Dim layout As ClassLayout = New ClassLayout(_path) - Dim settings As System.Collections.Generic.List(Of ClassSetting) = New System.Collections.Generic.List(Of ClassSetting) + Dim settings As List(Of ClassSetting) = New List(Of ClassSetting) Dim width As Integer Dim height As Integer Dim x As Integer @@ -204,19 +203,4 @@ Public Class ClassWindowLayout _value = value End Sub End Class -End Class - - -'------------------------------------------------------------------- - - - -Public Class ClassLayout - - - Public Sub New(filename As String) - - End Sub - - -End Class +End Class \ No newline at end of file diff --git a/GUIs.ZooFlow/DBCW_Stammdaten.Designer.vb b/GUIs.ZooFlow/DBCW_Stammdaten.Designer.vb index 7d5ad4d0..42de044e 100644 --- a/GUIs.ZooFlow/DBCW_Stammdaten.Designer.vb +++ b/GUIs.ZooFlow/DBCW_Stammdaten.Designer.vb @@ -3401,7 +3401,7 @@ Namespace DBCW_StammdatenTableAdapters Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")> _ Private Sub InitConnection() Me._connection = New Global.System.Data.SqlClient.SqlConnection() - Me._connection.ConnectionString = Global.DigitalData.GUIs.ZooFlow.Settings.Default.DD_ECMConnectionString + Me._connection.ConnectionString = Global.DigitalData.GUIs.ZooFlow.Settings.Default.ECMConnectionStringDEFAULT End Sub _ Private Sub InitConnection() Me._connection = New Global.System.Data.SqlClient.SqlConnection() - Me._connection.ConnectionString = Global.DigitalData.GUIs.ZooFlow.Settings.Default.DD_ECMConnectionString + Me._connection.ConnectionString = Global.DigitalData.GUIs.ZooFlow.Settings.Default.ECMConnectionStringDEFAULT End Sub _ Private Sub InitConnection() Me._connection = New Global.System.Data.SqlClient.SqlConnection() - Me._connection.ConnectionString = Global.DigitalData.GUIs.ZooFlow.Settings.Default.DD_ECMConnectionString + Me._connection.ConnectionString = Global.DigitalData.GUIs.ZooFlow.Settings.Default.ECMConnectionStringDEFAULT End Sub - + - + DELETE FROM [dbo].[TBCW_PROFILES] WHERE (([GUID] = @Original_GUID) AND ([NAME] = @Original_NAME) AND ((@IsNull_COMMENT = 1 AND [COMMENT] IS NULL) OR ([COMMENT] = @Original_COMMENT)) AND ([REGEX_EXPRESSION] = @Original_REGEX_EXPRESSION) AND ([ADDED_WHO] = @Original_ADDED_WHO) AND ((@IsNull_ADDED_WHEN = 1 AND [ADDED_WHEN] IS NULL) OR ([ADDED_WHEN] = @Original_ADDED_WHEN)) AND ((@IsNull_CHANGED_WHO = 1 AND [CHANGED_WHO] IS NULL) OR ([CHANGED_WHO] = @Original_CHANGED_WHO)) AND ((@IsNull_CHANGED_WHEN = 1 AND [CHANGED_WHEN] IS NULL) OR ([CHANGED_WHEN] = @Original_CHANGED_WHEN)) AND ([ACTIVE] = @Original_ACTIVE) AND ([PROFILE_TYPE] = @Original_PROFILE_TYPE)) @@ -106,7 +106,7 @@ SELECT GUID, NAME, COMMENT, REGEX_EXPRESSION, ADDED_WHO, ADDED_WHEN, CHANGED_WHO - + DELETE FROM [TBCW_PROF_DOC_SEARCH] WHERE (([GUID] = @Original_GUID) AND ([PROFILE_ID] = @Original_PROFILE_ID) AND ([CONN_ID] = @Original_CONN_ID) AND ([TAB_INDEX] = @Original_TAB_INDEX) AND ([ACTIVE] = @Original_ACTIVE) AND ([TAB_TITLE] = @Original_TAB_TITLE) AND ([ADDED_WHO] = @Original_ADDED_WHO) AND ((@IsNull_ADDED_WHEN = 1 AND [ADDED_WHEN] IS NULL) OR ([ADDED_WHEN] = @Original_ADDED_WHEN)) AND ((@IsNull_CHANGED_WHO = 1 AND [CHANGED_WHO] IS NULL) OR ([CHANGED_WHO] = @Original_CHANGED_WHO)) AND ((@IsNull_CHANGED_WHEN = 1 AND [CHANGED_WHEN] IS NULL) OR ([CHANGED_WHEN] = @Original_CHANGED_WHEN))) @@ -208,7 +208,7 @@ SELECT GUID, PROFILE_ID, CONN_ID, SQL_COMMAND, TAB_INDEX, ACTIVE, TAB_TITLE, ADD - + DELETE FROM [TBCW_PROF_DATA_SEARCH] WHERE (([GUID] = @Original_GUID) AND ([PROFILE_ID] = @Original_PROFILE_ID) AND ([CONN_ID] = @Original_CONN_ID) AND ([TAB_INDEX] = @Original_TAB_INDEX) AND ([ACTIVE] = @Original_ACTIVE) AND ([TAB_TITLE] = @Original_TAB_TITLE) AND ([ADDED_WHO] = @Original_ADDED_WHO) AND ((@IsNull_ADDED_WHEN = 1 AND [ADDED_WHEN] IS NULL) OR ([ADDED_WHEN] = @Original_ADDED_WHEN)) AND ((@IsNull_CHANGED_WHO = 1 AND [CHANGED_WHO] IS NULL) OR ([CHANGED_WHO] = @Original_CHANGED_WHO)) AND ((@IsNull_CHANGED_WHEN = 1 AND [CHANGED_WHEN] IS NULL) OR ([CHANGED_WHEN] = @Original_CHANGED_WHEN))) diff --git a/GUIs.ZooFlow/DSDD_Stammdaten.Designer.vb b/GUIs.ZooFlow/DSDD_Stammdaten.Designer.vb index de110aad..81aacbbd 100644 --- a/GUIs.ZooFlow/DSDD_Stammdaten.Designer.vb +++ b/GUIs.ZooFlow/DSDD_Stammdaten.Designer.vb @@ -1331,7 +1331,7 @@ Namespace DSDD_StammdatenTableAdapters Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")> _ Private Sub InitConnection() Me._connection = New Global.System.Data.SqlClient.SqlConnection() - Me._connection.ConnectionString = Global.DigitalData.GUIs.ZooFlow.Settings.Default.DD_ECMConnectionString + Me._connection.ConnectionString = Global.DigitalData.GUIs.ZooFlow.Settings.Default.ECMConnectionStringDEFAULT End Sub - + - + DELETE FROM [TBDD_CONNECTION] WHERE (([GUID] = @Original_GUID) AND ((@IsNull_BEZEICHNUNG = 1 AND [BEZEICHNUNG] IS NULL) OR ([BEZEICHNUNG] = @Original_BEZEICHNUNG)) AND ((@IsNull_SQL_PROVIDER = 1 AND [SQL_PROVIDER] IS NULL) OR ([SQL_PROVIDER] = @Original_SQL_PROVIDER)) AND ((@IsNull_SERVER = 1 AND [SERVER] IS NULL) OR ([SERVER] = @Original_SERVER)) AND ((@IsNull_DATENBANK = 1 AND [DATENBANK] IS NULL) OR ([DATENBANK] = @Original_DATENBANK)) AND ((@IsNull_USERNAME = 1 AND [USERNAME] IS NULL) OR ([USERNAME] = @Original_USERNAME)) AND ((@IsNull_PASSWORD = 1 AND [PASSWORD] IS NULL) OR ([PASSWORD] = @Original_PASSWORD)) AND ((@IsNull_BEMERKUNG = 1 AND [BEMERKUNG] IS NULL) OR ([BEMERKUNG] = @Original_BEMERKUNG)) AND ([AKTIV] = @Original_AKTIV) AND ([ERSTELLTWER] = @Original_ERSTELLTWER) AND ((@IsNull_ERSTELLTWANN = 1 AND [ERSTELLTWANN] IS NULL) OR ([ERSTELLTWANN] = @Original_ERSTELLTWANN)) AND ((@IsNull_GEANDERTWER = 1 AND [GEANDERTWER] IS NULL) OR ([GEANDERTWER] = @Original_GEANDERTWER)) AND ((@IsNull_GEAENDERTWANN = 1 AND [GEAENDERTWANN] IS NULL) OR ([GEAENDERTWANN] = @Original_GEAENDERTWANN)) AND ([SYS_CONNECTION] = @Original_SYS_CONNECTION)) diff --git a/GUIs.ZooFlow/DSIDB_Stammdaten.Designer.vb b/GUIs.ZooFlow/DSIDB_Stammdaten.Designer.vb index 3b7f841b..efaf6e3f 100644 --- a/GUIs.ZooFlow/DSIDB_Stammdaten.Designer.vb +++ b/GUIs.ZooFlow/DSIDB_Stammdaten.Designer.vb @@ -7744,7 +7744,7 @@ Namespace DSIDB_StammdatenTableAdapters Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")> _ Private Sub InitConnection() Me._connection = New Global.System.Data.SqlClient.SqlConnection() - Me._connection.ConnectionString = Global.DigitalData.GUIs.ZooFlow.Settings.Default.DD_ECMConnectionString + Me._connection.ConnectionString = Global.DigitalData.GUIs.ZooFlow.Settings.Default.ECMConnectionStringDEFAULT End Sub - + @@ -319,7 +319,7 @@ FROM VWIDB_BE_ATTRIBUTE WHERE ATTR_ID = @ATTRIBUTE_ID AND LANG_ID = @ - + DELETE FROM TBZF_ADMIN_SOURCE_SQL diff --git a/GUIs.ZooFlow/Globix/ClassFileDrop.vb b/GUIs.ZooFlow/Globix/ClassFileDrop.vb index 1e10c4b2..ff2f4cc0 100644 --- a/GUIs.ZooFlow/Globix/ClassFileDrop.vb +++ b/GUIs.ZooFlow/Globix/ClassFileDrop.vb @@ -5,9 +5,19 @@ Imports DigitalData.Modules.Logging Imports Microsoft.Office.Interop Public Class ClassFileDrop - Public Shared files_dropped As String() + Public files_dropped As String() Private _LOGGER As Logger Private clsFilehandle As ClassFilehandle + + Public Class DroppedFile + Public FilePath As String + Public Enum DropType + Filesystem + OutlookAttachment + OutlookMessage + End Enum + End Class + Public Sub New(LogConfig As LogConfig) _LOGGER = LogConfig.GetLogger() clsFilehandle = New ClassFilehandle() diff --git a/GUIs.ZooFlow/Globix/ClassValidator.vb b/GUIs.ZooFlow/Globix/ClassValidator.vb index 6668ad0b..f4c897c0 100644 --- a/GUIs.ZooFlow/Globix/ClassValidator.vb +++ b/GUIs.ZooFlow/Globix/ClassValidator.vb @@ -1,5 +1,6 @@ Imports DigitalData.Controls.LookupGrid Imports DigitalData.GUIs.ZooFlow.Base +Imports DigitalData.GUIs.ZooFlow.Globix.Models Imports DigitalData.GUIs.ZooFlow.frmGlobix_Index Imports DigitalData.Modules.EDMI.API Imports DigitalData.Modules.EDMI.API.EDMIServiceReference @@ -9,10 +10,12 @@ Public Class ClassValidator Inherits BaseClass Private ReadOnly Client As Client + Private ReadOnly ManualIndexes As List(Of ManualIndex) - Public Sub New(pLogConfig As LogConfig, pClient As Client) + Public Sub New(pLogConfig As LogConfig, pClient As Client, pManualIndexes As List(Of ManualIndex)) MyBase.New(pLogConfig) Client = pClient + ManualIndexes = pManualIndexes End Sub Function ValidateControls(pPanel As Panel, pDocType As DocType) As Boolean @@ -22,6 +25,10 @@ Public Class ClassValidator For Each oControl As Control In pPanel.Controls + If oControl.Name.StartsWith("lbl") Then + Continue For + End If + ' ========================= TEXT BOX ========================= If oControl.Name.StartsWith("txt") Then Dim oTextBox As DevExpress.XtraEditors.TextEdit = oControl @@ -52,6 +59,7 @@ Public Class ClassValidator Return False End If End If + ElseIf oControl.Name.StartsWith("cmbSingle") Then Dim cmbSingle As TextBox = oControl @@ -228,9 +236,10 @@ Public Class ClassValidator End Function Private Function TestIsIndexOptional(pDocType As DocType, pIndexName As String) As Boolean - Dim oIsOptional As Boolean = My.Helpers.GetValueFromDatatable( - My.Application.Globix.CURR_DT_MAN_INDEXE, - $"DOK_ID = {pDocType.Guid} AND INDEXNAME = '{pIndexName}'", "OPTIONAL", "") + Dim oIsOptional As Boolean = ManualIndexes. + Where(Function(index) index.DocTypeId = pDocType.Guid And index.Name = pIndexName). + Select(Function(index) index.IsOptional). + FirstOrDefault() Return oIsOptional End Function diff --git a/GUIs.ZooFlow/Globix/GlobixControls.vb b/GUIs.ZooFlow/Globix/GlobixControls.vb index 26ab7b23..c9cd46d9 100644 --- a/GUIs.ZooFlow/Globix/GlobixControls.vb +++ b/GUIs.ZooFlow/Globix/GlobixControls.vb @@ -3,11 +3,14 @@ Imports DigitalData.Modules.Logging Imports Oracle.ManagedDataAccess.Client Imports DigitalData.Controls.LookupGrid Imports DigitalData.Modules.Language.Utils +Imports DigitalData.Modules.Patterns +Imports DigitalData.GUIs.ZooFlow.Globix.Models Public Class GlobixControls Private Property Form As frmGlobix_Index Private Property Panel As Panel - Private Patterns As GlobixPatterns + Private ReadOnly DocType As DocType + Private Property Patterns2 As Patterns2 Public Class ControlMeta Public Property IndexName As String @@ -15,11 +18,12 @@ Public Class GlobixControls Public Property MultipleValues As Boolean = False End Class Private _Logger As Logger - Public Sub New(LogConfig As LogConfig, Panel As Panel, Form As frmGlobix_Index) + Public Sub New(LogConfig As LogConfig, Panel As Panel, Form As frmGlobix_Index, pDocType As DocType) _Logger = LogConfig.GetLogger Me.Form = Form Me.Panel = Panel - Patterns = New GlobixPatterns(LogConfig) + DocType = pDocType + Patterns2 = New Patterns2(LogConfig) End Sub Public Function AddCheckBox(indexname As String, y As Integer, vorbelegung As String, caption As String) @@ -106,7 +110,7 @@ Public Class GlobixControls If oConnectionString IsNot Nothing And oSql.Length > 0 And SQLSuggestion = True Then _Logger.Debug("Connection String (redacted): [{0}]", oConnectionString.Substring(0, 30)) - If Patterns.HasComplexPatterns(oSql) Then + If Patterns2.HasComplexPatterns(oSql) Then _Logger.Debug("sql enthält Platzhalter und wird erst während der Laufzeit gefüllt!", False) Else Dim oDatatable = My.DatabaseECM.GetDatatableWithConnection(oSql, oConnectionString) @@ -189,7 +193,7 @@ Public Class GlobixControls Private Sub Get_NextComboBoxResults(cmb As ComboBox) Try Dim indexname = cmb.Name.Replace("cmb", "") - Dim sql = "SELECT GUID,NAME,SQL_RESULT FROM TBDD_INDEX_MAN where SUGGESTION = 1 AND SQL_RESULT like '%@" & indexname & "%' and DOK_ID = " & My.Application.Globix.CURRENT_DOCTYPE_ID & " ORDER BY SEQUENCE" + Dim sql = "SELECT GUID,NAME,SQL_RESULT FROM TBDD_INDEX_MAN where SUGGESTION = 1 AND SQL_RESULT like '%@" & indexname & "%' and DOK_ID = " & DocType.Guid & " ORDER BY SEQUENCE" Dim DT As DataTable = My.DatabaseECM.GetDatatable(sql) If Not IsNothing(DT) Then If DT.Rows.Count > 0 Then @@ -417,10 +421,9 @@ Public Class GlobixControls Continue For End If - oControlSql = Patterns.ReplaceUserValues(oControlSql, My.Application.Globix.CURRENT_DOCTYPE_ID) - oControlSql = Patterns.ReplaceInternalValues(oControlSql) - oControlSql = Patterns.ReplaceControlValues(oControlSql, Panel) - + oControlSql = Patterns2.ReplaceInternalValues(oControlSql) + oControlSql = Patterns2.ReplaceUserValues(oControlSql, My.Application.User) + oControlSql = Patterns2.ReplaceControlValues(oControlSql, Panel) _Logger.Debug("SQL After Preparing: [{0}]", oControlSql) _Logger.Debug("Setting new value for [{0}]", oControlName) diff --git a/GUIs.ZooFlow/Globix/GlobixDataset.Designer.vb b/GUIs.ZooFlow/Globix/GlobixDataset.Designer.vb index 28536368..e13bd947 100644 --- a/GUIs.ZooFlow/Globix/GlobixDataset.Designer.vb +++ b/GUIs.ZooFlow/Globix/GlobixDataset.Designer.vb @@ -4321,7 +4321,7 @@ Namespace GlobixDatasetTableAdapters Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")> _ Private Sub InitConnection() Me._connection = New Global.System.Data.SqlClient.SqlConnection() - Me._connection.ConnectionString = Global.DigitalData.GUIs.ZooFlow.Settings.Default.DD_ECMConnectionString + Me._connection.ConnectionString = Global.DigitalData.GUIs.ZooFlow.Settings.Default.ECMConnectionStringDEFAULT End Sub _ Private Sub InitConnection() Me._connection = New Global.System.Data.SqlClient.SqlConnection() - Me._connection.ConnectionString = Global.DigitalData.GUIs.ZooFlow.Settings.Default.DD_ECMConnectionString + Me._connection.ConnectionString = Global.DigitalData.GUIs.ZooFlow.Settings.Default.ECMConnectionStringDEFAULT End Sub _ Private Sub InitConnection() Me._connection = New Global.System.Data.SqlClient.SqlConnection() - Me._connection.ConnectionString = Global.DigitalData.GUIs.ZooFlow.Settings.Default.DD_ECMConnectionString + Me._connection.ConnectionString = Global.DigitalData.GUIs.ZooFlow.Settings.Default.ECMConnectionStringDEFAULT End Sub _ Private Sub InitConnection() Me._connection = New Global.System.Data.SqlClient.SqlConnection() - Me._connection.ConnectionString = Global.DigitalData.GUIs.ZooFlow.Settings.Default.DD_ECMConnectionString + Me._connection.ConnectionString = Global.DigitalData.GUIs.ZooFlow.Settings.Default.ECMConnectionStringDEFAULT End Sub - + - + DELETE FROM TBDD_DOKUMENTART @@ -104,7 +104,7 @@ SELECT GUID, BEZEICHNUNG, OBJEKTTYP, EINGANGSART_ID, KURZNAME, ZIEL_PFAD, BESCHR - + SELECT TBDD_DOKUMENTART.GUID, TBDD_DOKUMENTART.BEZEICHNUNG, TBDD_DOKUMENTART.OBJEKTTYP, TBDD_DOKUMENTART.EINGANGSART_ID, TBDD_DOKUMENTART.KURZNAME, TBDD_DOKUMENTART.ZIEL_PFAD, @@ -124,7 +124,7 @@ ORDER BY TBDD_DOKUMENTART.BEZEICHNUNG - + DELETE FROM TBDD_INDEX_MAN @@ -236,7 +236,7 @@ SELECT GUID, DOK_ID, NAME, WD_INDEX, COMMENT, DATATYPE, SUGGESTION, DEFAULT_VALU - + DELETE FROM TBDD_INDEX_AUTOM @@ -325,7 +325,7 @@ SELECT GUID, DOCTYPE_ID, ENTITY_ID, INDEXNAME, VALUE, CONNECTION_ID, SQL_RESULT, - + DELETE FROM TBGI_REGEX_DOCTYPE diff --git a/GUIs.ZooFlow/Globix/GlobixPatterns.vb b/GUIs.ZooFlow/Globix/GlobixPatterns.vb deleted file mode 100644 index 98eb93dc..00000000 --- a/GUIs.ZooFlow/Globix/GlobixPatterns.vb +++ /dev/null @@ -1,453 +0,0 @@ -Imports System.Text.RegularExpressions -Imports DevExpress.XtraEditors -Imports DigitalData.Controls.LookupGrid -Imports DigitalData.Modules.Logging -Imports DigitalData.Modules.Language.Utils - -Public Class GlobixPatterns - Private _Logger As Logger - Private _idbdata As ClassIDBData - Public Sub New(LogConfig As LogConfig) - _Logger = LogConfig.GetLogger - _idbdata = New ClassIDBData(LogConfig) - End Sub - ' Complex patterns that rely on a datasource like a Database or Windream - Public Const PATTERN_WMI = "WMI" - Public Const PATTERN_IDBA = "IDBA" - Public Const PATTERN_CTRL = "CTRL" - ' Simple patterns that only rely on .NET functions - Public Const PATTERN_INT = "INT" - ' Simple patterns that rely on Data from the TBDD_USER table - Public Const PATTERN_USER = "USER" - - Public Const USER_VALUE_PRENAME = "PRENAME" - Public Const USER_VALUE_SURNAME = "SURNAME" - Public Const USER_VALUE_EMAIL = "EMAIL" - Public Const USER_VALUE_SHORTNAME = "SHORTNAME" - Public Const USER_VALUE_LANGUAGE = "LANGUAGE" - 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 MAX_TRY_COUNT = 500 - - Private myregex As Regex = New Regex("{#(\w+)#([\.\w\d\s_-]+)}+") - Private allPatterns As New List(Of String) From {PATTERN_WMI, PATTERN_CTRL, PATTERN_IDBA, PATTERN_USER, PATTERN_INT} - Private complexPatterns As New List(Of String) From {PATTERN_WMI, PATTERN_CTRL, PATTERN_IDBA} - Private simplePatterns As New List(Of String) From {PATTERN_USER, PATTERN_INT} - - ''' - ''' Wraps a pattern-type and -value in the common format: {#type#value} - ''' - Public Function WrapPatternValue(type As String, value As String) As String - Return New Pattern(type, value).ToString - End Function - - - Public Function ReplaceAllValues(input As String, panel As Panel, prename As Object, surname As Object, shortname As Object, language As Object, email As Object, userId As Object, profileId As Object, pissql As Boolean) As String - Try - Dim result = input - _Logger.Debug($"inputString BEFORE replacing: [{result}]") - result = ReplaceInternalValues(result) - result = ReplaceControlValues(result, panel) - result = ReplaceIDBAttributes(My.Application.Globix.CURRENT_IDB_OBJ_ID, result, pissql) - result = ReplaceUserValues(result, profileId) - _Logger.Debug($"inputString AFTER replacing: [{result}]") - Return result - Catch ex As Exception - _Logger.Error(ex) - _Logger.Info("Error in ReplaceAllValues:" & ex.Message) - End Try - End Function - - Public Function ReplaceInternalValues(input As String) As String - Try - Dim result = input - - ' Replace Username(s) - While ContainsPatternAndValue(result, PATTERN_INT, INT_VALUE_USERNAME) - result = ReplacePattern(result, PATTERN_INT, Environment.UserName) - End While - - ' Replace Machinename(s) - While ContainsPatternAndValue(result, PATTERN_INT, INT_VALUE_MACHINE) - result = ReplacePattern(result, PATTERN_INT, Environment.MachineName) - End While - - ' Replace Domainname(s) - While ContainsPatternAndValue(result, PATTERN_INT, INT_VALUE_DOMAIN) - result = ReplacePattern(result, PATTERN_INT, Environment.UserDomainName) - End While - - ' Replace CurrentDate(s) - While ContainsPatternAndValue(result, PATTERN_INT, INT_VALUE_DATE) - result = ReplacePattern(result, PATTERN_INT, Now.ToShortDateString) - End While - _Logger.Debug("sql after ReplaceInternalValues: " & input) - Return result - Catch ex As Exception - _Logger.Error(ex) - _Logger.Info("Error in ReplaceInternalValues:" & ex.Message) - End Try - End Function - - Public Function ReplaceUserValues(input As String, profileId As Object) As String - Try - Dim result = input - While ContainsPatternAndValue(result, PATTERN_USER, USER_VALUE_PRENAME) - result = ReplacePattern(result, PATTERN_USER, My.Application.User.GivenName) - End While - - While ContainsPatternAndValue(result, PATTERN_USER, USER_VALUE_USER_ID) - result = ReplacePattern(result, PATTERN_USER, My.Application.User.UserId) - End While - - While ContainsPatternAndValue(result, PATTERN_USER, USER_VALUE_SURNAME) - result = ReplacePattern(result, PATTERN_USER, My.Application.User.Surname) - End While - If IsDBNull(My.Application.User.ShortName) Then - My.Application.User.ShortName = "" - End If - While ContainsPatternAndValue(result, PATTERN_USER, USER_VALUE_SHORTNAME) - result = ReplacePattern(result, PATTERN_USER, My.Application.User.ShortName) - End While - - While ContainsPatternAndValue(result, PATTERN_USER, USER_VALUE_LANGUAGE) - result = ReplacePattern(result, PATTERN_USER, My.Application.User.Language) - End While - - While ContainsPatternAndValue(result, PATTERN_USER, USER_VALUE_EMAIL) - result = ReplacePattern(result, PATTERN_USER, My.Application.User.Email) - End While - - While ContainsPatternAndValue(result, PATTERN_USER, USER_VALUE_PROFILE_ID) - result = ReplacePattern(result, PATTERN_USER, profileId) - End While - _Logger.Debug("sql after ReplaceUserValues: " & input) - Return result - Catch ex As Exception - _Logger.Error(ex) - _Logger.Info("Error in ReplaceUserValues:" & ex.Message) - End Try - End Function - - Public Function ReplaceControlValues(input As String, panel As Panel) As String - Try - Dim result = input - Dim oTryCounter = 0 - - _Logger.Debug("Input String: [{0}]", input) - - While ContainsPattern(result, PATTERN_CTRL) - _Logger.Debug("ReplaceControlValues Try no. [{0}]", oTryCounter) - - If oTryCounter > MAX_TRY_COUNT Then - Throw New Exception($"Max tries in ReplaceControlValues exceeded - Result so far [{result}].") - End If - - _Logger.Debug("Getting next pattern..") - - Dim oNextPattern = GetNextPattern(result, PATTERN_CTRL) - - If oNextPattern Is Nothing Then - _Logger.Debug("No Next Pattern found. Exiting!") - Exit While - End If - - _Logger.Debug("Next Pattern Value: [{0}]", oNextPattern.Value) - _Logger.Debug("Next Pattern Type: [{0}]", oNextPattern.Type) - - Dim controlName As String = oNextPattern.Value - Dim oFoundControl As Control = Nothing - Dim oFoundType As String = Nothing - - For Each oControl As Control In panel.Controls - If TypeOf oControl Is Label Then - Continue For - End If - - _Logger.Debug("Getting control metadata from Control: [{0}]", oControl.Name) - - If oControl.Tag Is Nothing Then - _Logger.Warn("No Metadata object found for control [{0}]. Skipping.", oControl.Name) - Continue For - End If - - Dim oMeta = TryCast(oControl.Tag, GlobixControls.ControlMeta) - - _Logger.Debug("Metadata IndexName: [{0}]", oMeta.IndexName) - _Logger.Debug("Metadata IndexType: [{0}]", oMeta.IndexType) - _Logger.Debug("Checking Control Name matches..") - - If oMeta Is Nothing Then - _Logger.Warn("No Metadata found for control [{0}]. Skipping.", oControl.Name) - Continue For - End If - - If oMeta.IndexName = controlName Then - _Logger.Debug("Control Name matches! Matching Control: [{0}]", controlName) - - oFoundControl = oControl - oFoundType = oMeta.IndexType - Exit For - End If - Next - - If oFoundControl IsNot Nothing Then - Dim oValue As String = String.Empty - - _Logger.Debug("Found Control [{0}], continuing with setting value..", oFoundControl.Name) - - If TypeOf oFoundControl Is TextEdit Then - Try - oValue = DirectCast(oFoundControl, TextEdit).Text - Catch ex As Exception - _Logger.Error(ex) - _Logger.Warn("Control Value for TextBox [{0}] could not be retrieved!", oFoundControl.Name) - End Try - ElseIf TypeOf oFoundControl Is CheckBox Then - Try - oValue = IIf(DirectCast(oFoundControl, CheckBox).Checked, 1, 0) - Catch ex As Exception - _Logger.Error(ex) - _Logger.Warn("Control Value for CheckBox [{0}] could not be retrieved!", oFoundControl.Name) - End Try - ElseIf TypeOf oFoundControl Is LookupControl3 Then - Try - Dim oLookupControl = DirectCast(oFoundControl, LookupControl3) - - If oLookupControl.Properties.MultiSelect Then - Select Case oFoundType - Case "INTEGER" - oValue = String.Join(",", oLookupControl.Properties.SelectedValues) - Case "VARCHAR" - Dim oWrapped = oLookupControl.Properties.SelectedValues - oValue = String.Join(",", oWrapped) - Case Else - _Logger.Warn("Lookup Control with [{0}] is not supported!", oFoundType) - End Select - Else - oValue = NotNull(oLookupControl.Properties.SelectedValues.Item(0), "") - End If - Catch ex As Exception - _Logger.Error(ex) - _Logger.Warn("Control Value for LookupControl2 [{0}] could not be retrieved!", oFoundControl.Name) - End Try - Else - _Logger.Debug("Unknown Control type for type [{0}], setting value to empty string.", oFoundControl.Name) - oValue = "" - End If - - _Logger.Debug("Retrieved Value from Control [{0}] is: [{1}]", controlName, oValue) - - result = ReplacePattern(result, PATTERN_CTRL, oValue) - Else - _Logger.Warn("Control [{0}] not found!", controlName) - End If - - oTryCounter += 1 - End While - _Logger.Debug("input after ReplaceControlValues [{input}]") - Return result - Catch ex As Exception - _Logger.Error(ex) - _Logger.Info("Error in ReplaceControlValues:" & ex.Message) - Return input - End Try - End Function - Public Function ReplaceIDBAttributes(IDB_OBJ_ID As Long, pInput As String, IS_SQL As Boolean) As String - Try - Dim oResult = pInput - Dim oTryCounter As Integer = 0 - While ContainsPattern(oResult, PATTERN_IDBA) - - Dim indexName As String = GetNextPattern(oResult, PATTERN_IDBA).Value - Dim oIDBValue As Object - If indexName = "ObjectID" Then - oIDBValue = IDB_OBJ_ID - ElseIf indexName = "OBJID" Then - oIDBValue = IDB_OBJ_ID - ElseIf indexName = "DocID" Then - oIDBValue = IDB_OBJ_ID - Else - oIDBValue = _idbdata.GetVariableValue(indexName) - End If - - If IsNothing(oIDBValue) And oTryCounter = MAX_TRY_COUNT Then - _Logger.Warn($"Max tries for [{indexName}] in ReplaceIDBAttributes exceeded - Replacing with [0]!") - Dim oReplaceValue = "{" + $"#{PATTERN_IDBA}#{indexName}" + "}" - oResult = oResult.Replace(oReplaceValue, 0) - Throw New Exception("Max tries in ReplaceIDBAttributes exceeded.") - - End If - If oIDBValue IsNot Nothing Or Not IsDBNull(oIDBValue) Then - Dim oReplaceValue = "{" + $"#{PATTERN_IDBA}#{indexName}" + "}" - If IS_SQL = True Then - _Logger.Debug($"IS_SQL = True - oReplaceValue = [{oReplaceValue}]") - If indexName <> "ObjectID" And indexName <> "OBJID" And indexName <> "DocID" Then - Try - oIDBValue = oIDBValue.Replace("'", "''") - Catch ex As Exception - _Logger.Warn($"Invalid IDBValue for [{indexName}] in ReplaceIDBAttributes [{ex.Message}] - Replacing with [0]!") - oIDBValue = 0 - End Try - - End If - _Logger.Debug($"oIDBValue = {oIDBValue}") - End If - oResult = oResult.Replace(oReplaceValue, oIDBValue) - Else - _Logger.Warn($"IDBValue for [{indexName}] in ReplaceIDBAttributes is nothing or dbnull - Replacing with [0]!") - Dim oReplaceValue = "{" + $"#{PATTERN_IDBA}#{indexName}" + "}" - oResult = oResult.Replace(oReplaceValue, 0) - End If - oTryCounter += 100 - End While - _Logger.Debug("sql after ReplaceIDBAttributes: " & pInput) - Return oResult - Catch ex As Exception - _Logger.Error(ex) - _Logger.Info("Error in ReplaceIDBAttributes:" & ex.Message) - Return pInput - End Try - End Function - - Private Function ContainsPattern(input As String, type As String) As Boolean - Dim elements As MatchCollection = myregex.Matches(input) - - For Each element As Match In elements - Dim t As String = element.Groups(1).Value - - If t = type Then - Return True - End If - Next - - Return False - End Function - - Public Function GetNextPattern(input As String, type As String) As Pattern - Dim elements As MatchCollection = myregex.Matches(input) - - For Each element As Match In elements - ' Pattern in input - Dim t As String = element.Groups(1).Value - Dim v As String = element.Groups(2).Value - - If t = type Then - Return New Pattern(t, v) - End If - Next - - Return Nothing - End Function - - Public Function GetAllPatterns(input As String) As List(Of Pattern) - Dim elements As MatchCollection = myregex.Matches(input) - Dim results As New List(Of Pattern) - - For Each element As Match In elements - ' Pattern in input - Dim t As String = element.Groups(1).Value - Dim v As String = element.Groups(2).Value - - results.Add(New Pattern(t, v)) - Next - - Return results - End Function - - Public Function ReplacePattern(input As String, type As String, replacement As String) As String - Dim elements As MatchCollection = myregex.Matches(input) - - If IsNothing(replacement) Then - Return input - End If - - For Each element As Match In elements - ' if group 1 contains the 'pattern' the replace whole group with 'replacement' - ' and return it - If element.Groups(1).Value = type Then - Return Regex.Replace(input, element.Groups(0).Value, replacement) - End If - Next - - ' no replacement made - Return input - End Function - - Private Function ContainsPatternAndValue(input As String, type As String, value As String) As Boolean - Dim elements As MatchCollection = myregex.Matches(input) - - For Each element As Match In elements - ' Pattern in input - Dim t As String = element.Groups(1).Value - Dim v As String = element.Groups(2).Value - - If t = type And v = value Then - Return True - End If - Next - - Return False - End Function - - Public Function HasAnyPatterns(pInput As String) As Boolean - Return allPatterns.Any(Function(p) - Return HasPattern(pInput, p) - End Function) - End Function - - Public Function HasOnlySimplePatterns(input As String) As Boolean - Return Not HasComplexPatterns(input) - End Function - - Public Function HasComplexPatterns(input As String) As Boolean - Return complexPatterns.Any(Function(p) - Return HasPattern(input, p) - End Function) - End Function - - Public Function HasPattern(input As String, type As String) As Boolean - Dim matches = myregex.Matches(input) - - For Each match As Match In matches - For Each group As Group In match.Groups - If group.Value = type Then - Return True - End If - Next - Next - - Return False - End Function - - Public Class Pattern - Public ReadOnly Property Type As String - Public ReadOnly Property Value As String - - Public Sub New(type As String, value As String) - Me.Type = type - Me.Value = value - End Sub - - 'Public Sub New(stringRepresentation As String) - ' Dim elements As MatchCollection = myregex.Matches(stringRepresentation) - ' Dim first As Match = elements.Item(0) - - ' Dim t As String = first.Groups(1).Value - ' Dim v As String = first.Groups(2).Value - - ' Type = t - ' Value = v - 'End Sub - - Public Overrides Function ToString() As String - Return $"{{#{Type}#{Value}}}" - End Function - End Class -End Class diff --git a/GUIs.ZooFlow/Globix/GlobixPostprocessing.vb b/GUIs.ZooFlow/Globix/GlobixPostprocessing.vb deleted file mode 100644 index 6d93709c..00000000 --- a/GUIs.ZooFlow/Globix/GlobixPostprocessing.vb +++ /dev/null @@ -1,95 +0,0 @@ -Imports System.Text.RegularExpressions -Imports DigitalData.Modules.Logging - -Public Class GlobixPostprocessing - Private _Logger As Logger - - Public Sub New(LogConfig As LogConfig) - _Logger = LogConfig.GetLogger - End Sub - Private Const VBSPLIT = "VBSPLIT" - Private Const VBREPLACE = "VBREPLACE" - Private Const REGEXPRESSION = "REG. EXPRESSION" - - Public Function Get_Nachbearbeitung_Wert(idxvalue As String, Datatable As DataTable) As String - Dim oIndexValues As List(Of String) = idxvalue.Split("~").ToList() - - Try - For Each oDataRow As DataRow In Datatable.Rows - Dim oResult As New List(Of String) - Dim oType As String = oDataRow.Item("TYPE").ToString.ToUpper - - Select Case oType - Case VBSPLIT - _Logger.Info(" ...Nachbearbeitung mit VBSPLIT") - - Dim oSeparator As String = oDataRow.Item("TEXT1") - Dim oSplitIndex As Integer = 0 - Integer.TryParse(oDataRow.Item("TEXT2"), oSplitIndex) - - For Each oIndexValue In oIndexValues - Dim oSplitted As List(Of String) = oIndexValue.Split(oSeparator).ToList() - oResult.Add(oSplitted.Item(oSplitIndex)) - Next - - Case VBREPLACE - Dim oFindString = oDataRow.Item("TEXT1") - Dim oReplaceString = oDataRow.Item("TEXT2") - - _Logger.Info(" ...Nachbearbeitung mit VBREPLACE") - _Logger.Info(" ...Ersetze '" & oFindString & "' mit '" & oReplaceString & "'") - - For Each oIndexValue In oIndexValues - Dim oReplaceResult = oIndexValue.Replace(oFindString, oReplaceString) - oResult.Add(oReplaceResult) - Next - Case REGEXPRESSION - _Logger.Info(" ...Nachbearbeitung mit RegEx") - - Dim oRegexList As New List(Of Regex) - Dim oRegex As New Regex(oDataRow.Item("TEXT1"), RegexOptions.IgnoreCase) - - oRegexList.Add(oRegex) - - For Each oIndexValue In oIndexValues - Dim oProcessedString = extractFromStringviaRE(oIndexValue, oRegexList) - oResult.Add(oProcessedString) - - _Logger.Info(" ...Ergebnis des RegEx: " & oProcessedString) - Next - End Select - - oIndexValues = oResult - Next - Catch ex As Exception - MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in Get_Nachbearbeitung_Wert:") - _Logger.Info(" - Unvorhergesehener Unexpected error in Get_Nachbearbeitung_Wert - result: " & idxvalue & " - Fehler: " & vbNewLine & ex.Message) - End Try - - Return String.Join("~", oIndexValues.ToArray) - End Function - - ''' - ''' Extrahiert aus dem String anhand einer Liste von Regular Expressions ein Ergebnis. - ''' - ''' Der zu untersuchende String erzeugt wurden. - ''' Eine Liste von Regular Expressions - ''' Die Ergebnisgruppe, die die Adresse enthält - ''' Eine Emailadresse oder Nothing, wenn keine der Regular Expressions ein Ergebnis lieferte. - Public Function extractFromStringviaRE(SearchString As String, RegexList As List(Of Regex), Optional RegexGroup As Integer = 1) - If IsNothing(SearchString) Then - Return Nothing - End If - - For Each rx In RegexList - Dim match As Match = rx.Match(SearchString) - Dim result As String = match.Groups(RegexGroup).Value - If Not String.IsNullOrWhiteSpace(result) Then - 'Nur den ersten Wert zurückgeben - Return result - End If - Next - - Return Nothing - End Function -End Class diff --git a/GUIs.ZooFlow/Globix/Models/DocumentType.vb b/GUIs.ZooFlow/Globix/Models/DocumentType.vb new file mode 100644 index 00000000..d0bfcc79 --- /dev/null +++ b/GUIs.ZooFlow/Globix/Models/DocumentType.vb @@ -0,0 +1,11 @@ +Namespace Globix.Models + Public Class DocType + Public Property Guid + Public Property Name + Public Property ObjectStore + + Public Overrides Function ToString() As String + Return Name + End Function + End Class +End Namespace \ No newline at end of file diff --git a/GUIs.ZooFlow/Globix/Models/ManualIndex.vb b/GUIs.ZooFlow/Globix/Models/ManualIndex.vb new file mode 100644 index 00000000..908f0f46 --- /dev/null +++ b/GUIs.ZooFlow/Globix/Models/ManualIndex.vb @@ -0,0 +1,25 @@ +Namespace Globix.Models + Public Class ManualIndex + Public Property Id As Integer + + Public Property DocTypeName As String + Public Property DocTypeId As Integer + Public Property Name As String + Public Property Comment As String + Public Property DataType As String + Public Property Sequence As Integer + + Public Property SQLSuggestion As String + Public Property SQLCommand As String + Public Property SQLConnection As Integer + + Public Property DefaultValue As String + + Public Property IsOptional As Boolean + Public Property IsActive As Boolean + Public Property IsMultiselect As Boolean + Public Property AllowAddingItems As Boolean + Public Property PreventMultleValue As Boolean + End Class + +End Namespace \ No newline at end of file diff --git a/GUIs.ZooFlow/Globix/State.vb b/GUIs.ZooFlow/Globix/State.vb index 0e6db769..8cd2810a 100644 --- a/GUIs.ZooFlow/Globix/State.vb +++ b/GUIs.ZooFlow/Globix/State.vb @@ -23,15 +23,12 @@ Namespace Globix Public Property INDEXING_ACTIVE As Boolean = False Public Property ABORT_INDEXING As Boolean = False Public Property CURRENT_ISATTACHMENT As Boolean = False - Public Property CURR_DELETE_ORIGIN As Boolean = False - Public Property CURRENT_DROPTYPE As String + Public Property DeleteOriginalFile As Boolean = False Public Property CURRENT_LASTDOCTYPE As String Public Property CURRENT_DOCTYPE_ID As Int16 Public Property CURRENT_DOCTYPE_DuplicateHandling As String Public Property MULTIINDEXING_ACTIVE As Boolean = False - Public Property ECMDirect As Boolean = True Public Property CURRENT_PROFILE_LOG_INDEX As String - Public Property ShowIndexResult As Boolean = True Public Property CURR_DT_MAN_INDEXE As DataTable Public Property CURR_DT_AUTO_INDEXE As DataTable Public Property CURR_DT_DOCTYPE As DataTable @@ -39,9 +36,7 @@ Namespace Globix Public Property FILE_DELIMITER As String Public Property VERSION_DELIMITER As String Public Property CURRENT_MESSAGEID As String - Public Property CURRENT_BusinessEntity As String Public Property Folderwatchstarted As Boolean = False - Public Property DTEXCLUDE_FILES As DataTable Public Property PATH_FileExclusions As String = Path.Combine(Application.UserAppDataPath(), "FileExclusions.xml") diff --git a/GUIs.ZooFlow/Globix/frmGlobix_Index.Designer.vb b/GUIs.ZooFlow/Globix/frmGlobix_Index.Designer.vb index 81ea97de..afda87ff 100644 --- a/GUIs.ZooFlow/Globix/frmGlobix_Index.Designer.vb +++ b/GUIs.ZooFlow/Globix/frmGlobix_Index.Designer.vb @@ -1,4 +1,6 @@ - +Imports DevExpress.XtraEditors + + Partial Class frmGlobix_Index Inherits DevExpress.XtraBars.Ribbon.RibbonForm @@ -52,8 +54,7 @@ Partial Class frmGlobix_Index Me.SplitContainerControl1 = New DevExpress.XtraEditors.SplitContainerControl() Me.pnlIndex = New System.Windows.Forms.Panel() Me.Panel3 = New System.Windows.Forms.Panel() - Me.Button1 = New System.Windows.Forms.Button() - Me.btnAblageFlow = New System.Windows.Forms.Button() + Me.SimpleButton1 = New DevExpress.XtraEditors.SimpleButton() Me.Panel1 = New System.Windows.Forms.Panel() Me.cmbDocType = New DevExpress.XtraEditors.ComboBoxEdit() Me.DocumentViewer1 = New DigitalData.Controls.DocumentViewer.DocumentViewer() @@ -149,6 +150,7 @@ Partial Class frmGlobix_Index ' 'labelError ' + Me.labelError.Alignment = DevExpress.XtraBars.BarItemLinkAlignment.Right Me.labelError.Caption = "labelError" Me.labelError.Id = 11 Me.labelError.ImageOptions.SvgImage = CType(resources.GetObject("labelError.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) @@ -158,6 +160,7 @@ Partial Class frmGlobix_Index ' 'labelNotice ' + Me.labelNotice.Alignment = DevExpress.XtraBars.BarItemLinkAlignment.Right Me.labelNotice.Caption = "labelNotice" Me.labelNotice.Id = 12 Me.labelNotice.ImageOptions.SvgImage = CType(resources.GetObject("labelNotice.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) @@ -264,38 +267,25 @@ Partial Class frmGlobix_Index ' 'Panel3 ' - Me.Panel3.Controls.Add(Me.Button1) - Me.Panel3.Controls.Add(Me.btnAblageFlow) + Me.Panel3.Controls.Add(Me.SimpleButton1) Me.Panel3.Dock = System.Windows.Forms.DockStyle.Bottom Me.Panel3.Location = New System.Drawing.Point(0, 433) Me.Panel3.Name = "Panel3" Me.Panel3.Size = New System.Drawing.Size(522, 75) Me.Panel3.TabIndex = 2 ' - 'Button1 - ' - Me.Button1.Font = New System.Drawing.Font("Tahoma", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Button1.ImageAlign = System.Drawing.ContentAlignment.MiddleRight - Me.Button1.Location = New System.Drawing.Point(317, 15) - Me.Button1.Name = "Button1" - Me.Button1.Size = New System.Drawing.Size(186, 44) - Me.Button1.TabIndex = 1 - Me.Button1.Text = "Starte Ablage (Neu)" - Me.Button1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft - Me.Button1.UseVisualStyleBackColor = True - ' - 'btnAblageFlow - ' - Me.btnAblageFlow.Font = New System.Drawing.Font("Tahoma", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.btnAblageFlow.Image = Global.DigitalData.GUIs.ZooFlow.My.Resources.Resources.ZooFlow_g_64___Kopie - Me.btnAblageFlow.ImageAlign = System.Drawing.ContentAlignment.MiddleRight - Me.btnAblageFlow.Location = New System.Drawing.Point(12, 6) - Me.btnAblageFlow.Name = "btnAblageFlow" - Me.btnAblageFlow.Size = New System.Drawing.Size(185, 63) - Me.btnAblageFlow.TabIndex = 1 - Me.btnAblageFlow.Text = "Starte Ablage (Alt)" - Me.btnAblageFlow.TextAlign = System.Drawing.ContentAlignment.MiddleLeft - Me.btnAblageFlow.UseVisualStyleBackColor = True + 'SimpleButton1 + ' + Me.SimpleButton1.Appearance.Font = New System.Drawing.Font("Segoe UI", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.SimpleButton1.Appearance.Options.UseFont = True + Me.SimpleButton1.Dock = System.Windows.Forms.DockStyle.Fill + Me.SimpleButton1.ImageOptions.Location = DevExpress.XtraEditors.ImageLocation.MiddleRight + Me.SimpleButton1.ImageOptions.SvgImage = Global.DigitalData.GUIs.ZooFlow.My.Resources.Resources.actions_send + Me.SimpleButton1.Location = New System.Drawing.Point(0, 0) + Me.SimpleButton1.Name = "SimpleButton1" + Me.SimpleButton1.Size = New System.Drawing.Size(522, 75) + Me.SimpleButton1.TabIndex = 2 + Me.SimpleButton1.Text = "Ablage starten" ' 'Panel1 ' @@ -307,12 +297,12 @@ Partial Class frmGlobix_Index Me.Panel1.Size = New System.Drawing.Size(522, 33) Me.Panel1.TabIndex = 0 ' - 'ComboBoxEdit1 + 'cmbDocType ' Me.cmbDocType.Dock = System.Windows.Forms.DockStyle.Top Me.cmbDocType.Location = New System.Drawing.Point(0, 0) Me.cmbDocType.MenuManager = Me.RibbonControl1 - Me.cmbDocType.Name = "ComboBoxEdit1" + Me.cmbDocType.Name = "cmbDocType" SerializableAppearanceObject1.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(214, Byte), Integer), CType(CType(49, Byte), Integer)) SerializableAppearanceObject1.Options.UseBackColor = True Me.cmbDocType.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo, "", 20, True, True, False, EditorButtonImageOptions1, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject1, SerializableAppearanceObject2, SerializableAppearanceObject3, SerializableAppearanceObject4, "", Nothing, Nothing, DevExpress.Utils.ToolTipAnchor.[Default])}) @@ -390,6 +380,5 @@ Partial Class frmGlobix_Index Friend WithEvents Panel3 As Panel Friend WithEvents GlobixDataset As GlobixDataset Friend WithEvents cmbDocType As DevExpress.XtraEditors.ComboBoxEdit - Friend WithEvents btnAblageFlow As Button - Friend WithEvents Button1 As Button + Friend WithEvents SimpleButton1 As SimpleButton End Class diff --git a/GUIs.ZooFlow/Globix/frmGlobix_Index.vb b/GUIs.ZooFlow/Globix/frmGlobix_Index.vb index ed25ebd5..0dc358fb 100644 --- a/GUIs.ZooFlow/Globix/frmGlobix_Index.vb +++ b/GUIs.ZooFlow/Globix/frmGlobix_Index.vb @@ -1,58 +1,46 @@ Option Explicit On -Imports System.DirectoryServices Imports System.IO -Imports System.Security.AccessControl -Imports System.Security.Principal Imports System.Text.RegularExpressions -Imports DigitalData.GUIs.GlobalIndexer -Imports DigitalData.Modules.Logging -Imports DigitalData.Modules.Language.Utils -Imports DigitalData.Controls.LookupGrid -Imports Independentsoft Imports DevExpress.XtraEditors.Controls -Imports DigitalData.Modules.EDMI.API.EDMIServiceReference +Imports DigitalData.Controls.LookupGrid +Imports DigitalData.GUIs.GlobalIndexer +Imports DigitalData.GUIs.ZooFlow.Globix.Models Imports DigitalData.Modules.Database +Imports DigitalData.Modules.EDMI.API +Imports DigitalData.Modules.EDMI.API.EDMIServiceReference +Imports DigitalData.Modules.EDMI.API.Constants.DatabaseType +Imports DigitalData.Modules.Language +Imports DigitalData.Modules.Language.Utils +Imports DigitalData.Modules.Logging +Imports DigitalData.Modules.Patterns Public Class frmGlobix_Index #Region "+++++ Variablen ++++++" - Public vPathFile As String - Private MULTIFILES As Integer - Private akttxtbox As TextBox - Dim DT_VWGI_DOCTYPE As DataTable - Public FormLoaded As Boolean = False - Dim DropType As String - Private DT_INDEXEMAN As DataTable - Dim sql_history_INSERT_INTO As String - Dim sql_history_Index_Values As String - - Private NewFileString As String - Private CancelAttempts As Integer = 0 - Private Const MaxCancelAttempts = 2 - - Private Property ViewerString As String + Private ReadOnly LogConfig As LogConfig + Private ReadOnly Logger As Logger + Private Property CancelAttempts As Integer = 0 + + Private Const MAX_CANCEL_ATTEMPTS = 2 Private Const TEXT_MISSING_INPUT = "Bitte vervollständigen Sie die Eingaben!" - Private _LogConfig As LogConfig - Private _Logger As Logger - - Private clswindowLocation As ClassWindowLayout - Private clsPatterns As GlobixPatterns - Private clsPostProcessing As GlobixPostprocessing - Private _DataASorDB As ClassDataASorDB - Private _idbdata As ClassIDBData - Private _Patterns As GlobixPatterns - Private _Controls As DigitalData.GUIs.GlobalIndexer.ControlCreator - Private _FileEx As DigitalData.Modules.Filesystem.File - - Public Class DocType - Public Property Guid - Public Property Name - - Public Overrides Function ToString() As String - Return Name - End Function - End Class + + Private Property MultifileCount As Integer + Public Property DT_VWGI_DOCTYPE As DataTable + Public Property FormLoaded As Boolean = False + Public Property DropType As String + + + Public Property ManualIndexes As List(Of ManualIndex) + Public Property DocTypes As List(Of DocType) + Public Property SelectedDocType As DocType + + Private Property WindowLocation As ClassWindowLayout + Private Property _DataASorDB As ClassDataASorDB + Private Property Database As DatabaseWithFallback + Private Property Patterns2 As Patterns2 + + Public Class ControlMeta Public Property IndexName As String @@ -61,27 +49,25 @@ Public Class frmGlobix_Index End Class #End Region - Public Sub New(LogConfig As LogConfig) - + Public Sub New(pLogConfig As LogConfig) ' Dieser Aufruf ist für den Designer erforderlich. InitializeComponent() ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu. - _Logger = LogConfig.GetLogger() - _LogConfig = LogConfig - _DataASorDB = New ClassDataASorDB(LogConfig) - clswindowLocation = New ClassWindowLayout(LogConfig) - clsPatterns = New GlobixPatterns(LogConfig) - clsPostProcessing = New GlobixPostprocessing(LogConfig) - _idbdata = New ClassIDBData(LogConfig) - _Patterns = New GlobixPatterns(LogConfig) - _FileEx = New Modules.Filesystem.File(LogConfig) + Logger = pLogConfig.GetLogger() + LogConfig = pLogConfig + + _DataASorDB = New ClassDataASorDB(pLogConfig) + + Database = New DatabaseWithFallback(pLogConfig, My.Application.Service.Client, My.DatabaseECM, My.DatabaseIDB) + WindowLocation = New ClassWindowLayout(pLogConfig) + Patterns2 = New Patterns2(pLogConfig) Localizer.Active = New LookupGridLocalizer() End Sub Private Sub frmGlobix_Index_Load(sender As Object, e As EventArgs) Handles MyBase.Load - Me.ColorizeInactiveIcon = False + ColorizeInactiveIcon = False ' Abbruchzähler zurücksetzen CancelAttempts = 0 @@ -92,118 +78,180 @@ Public Class frmGlobix_Index My.Application.Globix.CURRENT_ISATTACHMENT = False DropType = My.DatabaseECM.GetScalarValue("SELECT HANDLE_TYPE FROM TBGI_FILES_USER WHERE GUID = " & My.Application.Globix.CURRENT_WORKFILE_GUID).ToString - My.Application.Globix.CURR_DELETE_ORIGIN = My.UIConfig.Globix.DeleteOriginalFile + My.Application.Globix.DeleteOriginalFile = My.UIConfig.Globix.DeleteOriginalFile + SplitContainerControl1.SplitterPosition = My.UIConfig.Globix.SplitterDistanceViewer SourceDeleteItem.Enabled = True SourceDeleteItem.Checked = My.UIConfig.Globix.DeleteOriginalFile - - - DocumentViewer1.Init(_LogConfig, My.Application.Settings.GdPictureKey) + DocumentViewer1.Init(LogConfig, My.Application.Settings.GdPictureKey) If DropType Is Nothing Then - _Logger.Debug("File with Id [{0}] was not found in TBGI_FILES_USER. Exiting.", My.Application.Globix.CURRENT_WORKFILE_GUID) - CancelAttempts = MaxCancelAttempts + Logger.Debug("File with Id [{0}] was not found in TBGI_FILES_USER. Exiting.", My.Application.Globix.CURRENT_WORKFILE_GUID) + CancelAttempts = MAX_CANCEL_ATTEMPTS Close() - Else - My.Application.Globix.CURRENT_DROPTYPE = DropType.Replace("|", "") - - If DropType.StartsWith("|FW") Then - ' Eine Datei aus FolderWatch wird IMMER gelöscht, egal wie die Einstellung in der Config lautet - My.Application.Globix.CURR_DELETE_ORIGIN = True - SourceDeleteItem.Visibility = DevExpress.XtraBars.BarItemVisibility.Never - ElseIf DropType.Contains("|OUTLOOK_MESSAGE|") Then - ' Eine (DragDrop)-Outlook Nachricht wird NIE gelöscht, egal wie die Einstellung in der Config lautet - My.Application.Globix.CURR_DELETE_ORIGIN = False - SourceDeleteItem.Visibility = DevExpress.XtraBars.BarItemVisibility.Never + Exit Sub + End If + + SetDropType(DropType) + + + labelFilePath.Caption = My.Application.Globix.CURRENT_WORKFILE + WindowLocation.LoadFormLocationSize(Me) + + + SetFilePreview(My.UIConfig.Globix.FilePreview) + + + MultifileCount = My.DatabaseECM.GetScalarValue("SELECT COUNT(*) FROM TBGI_FILES_USER WHERE WORKED = 0 AND GUID <> " & My.Application.Globix.CURRENT_WORKFILE_GUID & " AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')") + My.Application.Globix.MULTIINDEXING_ACTIVE = False + + If MultifileCount > 0 Then + If My.Application.User.Language = "de-DE" Then + chkMultiindexing.Caption = $"Alle nachfolgenden Dateien (#{MultifileCount}) identisch indexieren" Else - SourceDeleteItem.Visibility = DevExpress.XtraBars.BarItemVisibility.Always + chkMultiindexing.Caption = "All following files (#{MultifileCount}) will be indexed identically" End If - If DropType = "|DROPFROMFSYSTEM|" Then - If My.Application.User.Language <> "de-DE" Then - Me.Text = "Storage-Flow of dropped file" - Else - Me.Text = "Ablage-Flow - Dropped File" - End If - ElseIf DropType = "|OUTLOOK_MESSAGE|" Or DropType = "|FW_MSGONLY|" Then - Select Case DropType - Case "|FW_MSGONLY|" - _Logger.Info(".msg-file from folderwatch") - If My.Application.User.Language <> "de-DE" Then - Me.Text = "Storage-Flow - msg-File (without Attachments) - from Folderwatch" - Else - Me.Text = "Ablage-Flow - msg-Datei (ohne Anhang) - aus Folderwatch" - End If - Case "|OUTLOOK_MESSAGE|" - _Logger.Info(".msg-file through dragdrop") - If My.Application.User.Language <> "de-DE" Then - Me.Text = "Storage-Flow - msg-File (without Attachments)" - Else - Me.Text = "Ablage-Flow - msg-Datei (ohne Anhang)" - End If - End Select + chkMultiindexing.Checked = False + chkMultiindexing.Visibility = DevExpress.XtraBars.BarItemVisibility.Always - ElseIf DropType = "|MSGONLY|" Then - If My.Application.User.Language = "de-DE" Then - Me.Text = "Ablage-Flow der msg-Datei (ohne Anhang)" - Else - Me.Text = "Storage-Flow of msg-File (without Attachments)" - End If - ElseIf DropType = "|ATTMNTEXTRACTED|" Or DropType = "|OUTLOOK_ATTACHMENT|" Then - My.Application.Globix.CURRENT_ISATTACHMENT = True + Else + chkMultiindexing.Visibility = DevExpress.XtraBars.BarItemVisibility.Never - If My.Application.User.Language = "de-DE" Then - Me.Text = "Ablage-Flow eines Email-Attachments" - Else - Me.Text = "Storage-Flow of email-Attachment" - End If - ElseIf DropType = "|FW_SIMPLEINDEXER|" Then + End If - If My.Application.User.Language = "de-DE" Then - Me.Text = "Ablage-Flow einer Folderwatch-Datei" - Else - Me.Text = "Storage-Flow of Folderwatch-File" - End If - End If + Catch ex As Exception + Logger.Warn(" - Unexpected error in Öffnen des Formulares - Fehler: " & vbNewLine & ex.Message) + Logger.Error(ex.Message) + MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in Öffnen des Formulares:") + End Try + End Sub + + Private Sub frmGlobix_Index_Shown(sender As Object, e As EventArgs) Handles Me.Shown + BringToFront() + Focus() + Cursor = Cursors.Default + Refresh_Dokart() + pnlIndex.Controls.Clear() - labelFilePath.Caption = My.Application.Globix.CURRENT_WORKFILE + checkItemTopMost.Checked = My.UIConfig.Globix.TopMost + TopMost = My.UIConfig.Globix.TopMost + BringToFront() - clswindowLocation.LoadFormLocationSize(Me) + FormLoaded = True - SetFilePreview(My.UIConfig.Globix.FilePreview) + Try + ' Letzte Auswahl merken überschreibt die automatische selektion + If My.UIConfig.Globix.ProfilePreselection Then + checkItemPreselection.Checked = True - SplitContainerControl1.SplitterPosition = My.UIConfig.Globix.SplitterDistanceViewer + If My.Application.Globix.CURRENT_LASTDOCTYPE <> "" Then + Dim oFoundDocType = cmbDocType.Properties.Items. + Cast(Of DocType)(). + Where(Function(dt) dt.Name = My.Application.Globix.CURRENT_LASTDOCTYPE). + FirstOrDefault() + If oFoundDocType IsNot Nothing Then + cmbDocType.SelectedItem = oFoundDocType + End If + End If + Else Dim oSQL As String = "SELECT DISTINCT T1.DOCTYPE as DocType, T.* FROM TBGI_REGEX_DOCTYPE T, VWGI_DOCTYPE T1 WHERE T.DOCTYPE_ID = T1.DOCTYPE_ID" - My.Application.Globix.DTTBGI_REGEX_DOCTYPE = _DataASorDB.GetDatatable("DD_ECM", oSQL, "DTTBGI_REGEX_DOCTYPE", "", "") - oSQL = "SELECT * FROM TBDD_INDEX_MAN_POSTPROCESSING" - My.Application.Globix.CURR_INDEX_MAN_POSTPROCESSING = _DataASorDB.GetDatatable("DD_ECM", oSQL, "TBDD_INDEX_MAN_POSTPROCESSING", "", "") - MULTIFILES = My.DatabaseECM.GetScalarValue("SELECT COUNT(*) FROM TBGI_FILES_USER WHERE WORKED = 0 AND GUID <> " & My.Application.Globix.CURRENT_WORKFILE_GUID & " AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')") - My.Application.Globix.MULTIINDEXING_ACTIVE = False - If MULTIFILES > 0 Then - If My.Application.User.Language = "de-DE" Then - chkMultiindexing.Caption = "Alle nachfolgenden Dateien (" & MULTIFILES & ") identisch indexieren" - Else - chkMultiindexing.Caption = "All following files (" & MULTIFILES & ") will be indexed identically" + My.Application.Globix.DTTBGI_REGEX_DOCTYPE = Database.GetDatatable("DTTBGI_REGEX_DOCTYPE", oSQL, ECM) + + For Each oRoW As DataRow In My.Application.Globix.DTTBGI_REGEX_DOCTYPE.Rows + Dim oOnlyFilename = Path.GetFileName(My.Application.Globix.CURRENT_WORKFILE) + If Regex.IsMatch(oOnlyFilename, oRoW.Item("Regex")) Then + + Logger.Debug("There is a match on REGEX_DOCTYPE: [{0}]", oRoW.Item("DOCTYPE")) + Logger.Debug("Regex: [{0}], FileName: [{1}]", oRoW.Item("Regex"), oOnlyFilename) + Dim oFoundDocType = cmbDocType.Properties.Items. + Cast(Of DocType)(). + Where(Function(dt) dt.Name = My.Application.Globix.CURRENT_LASTDOCTYPE). + FirstOrDefault() + + If oFoundDocType IsNot Nothing Then + cmbDocType.SelectedItem = oFoundDocType + End If + Exit For End If + Next + End If + Catch ex As Exception + Logger.Warn("Unexpected error DTTBGI_REGEX_DOCTYPE - ErrorMessage: " & vbNewLine & ex.Message) + + End Try + End Sub - chkMultiindexing.Checked = False - chkMultiindexing.Visibility = DevExpress.XtraBars.BarItemVisibility.Always + Public Sub SetDropType(pDropType As String) + If pDropType Is Nothing Then + Logger.Debug("File with Id [{0}] was not found in TBGI_FILES_USER. Exiting.", My.Application.Globix.CURRENT_WORKFILE_GUID) + CancelAttempts = MAX_CANCEL_ATTEMPTS + Close() + Else + If pDropType.StartsWith("|FW") Then + ' Eine Datei aus FolderWatch wird IMMER gelöscht, egal wie die Einstellung in der Config lautet + My.Application.Globix.DeleteOriginalFile = True + SourceDeleteItem.Visibility = DevExpress.XtraBars.BarItemVisibility.Never + ElseIf pDropType.Contains("|OUTLOOK_MESSAGE|") Then + ' Eine (DragDrop)-Outlook Nachricht wird NIE gelöscht, egal wie die Einstellung in der Config lautet + My.Application.Globix.DeleteOriginalFile = False + SourceDeleteItem.Visibility = DevExpress.XtraBars.BarItemVisibility.Never + Else + SourceDeleteItem.Visibility = DevExpress.XtraBars.BarItemVisibility.Always + End If + + If pDropType = "|DROPFROMFSYSTEM|" Then + If My.Application.User.Language <> "de-DE" Then + Me.Text = "Storage-Flow of dropped file" Else - chkMultiindexing.Visibility = DevExpress.XtraBars.BarItemVisibility.Never + Me.Text = "Ablage-Flow - Dropped File" + End If + ElseIf pDropType = "|OUTLOOK_MESSAGE|" Or pDropType = "|FW_MSGONLY|" Then + Select Case pDropType + Case "|FW_MSGONLY|" + Logger.Info(".msg-file from folderwatch") + If My.Application.User.Language <> "de-DE" Then + Me.Text = "Storage-Flow - msg-File (without Attachments) - from Folderwatch" + Else + Me.Text = "Ablage-Flow - msg-Datei (ohne Anhang) - aus Folderwatch" + End If + Case "|OUTLOOK_MESSAGE|" + Logger.Info(".msg-file through dragdrop") + If My.Application.User.Language <> "de-DE" Then + Me.Text = "Storage-Flow - msg-File (without Attachments)" + Else + Me.Text = "Ablage-Flow - msg-Datei (ohne Anhang)" + End If + End Select + ElseIf pDropType = "|MSGONLY|" Then + If My.Application.User.Language = "de-DE" Then + Me.Text = "Ablage-Flow der msg-Datei (ohne Anhang)" + Else + Me.Text = "Storage-Flow of msg-File (without Attachments)" End If - End If + ElseIf pDropType = "|ATTMNTEXTRACTED|" Or pDropType = "|OUTLOOK_ATTACHMENT|" Then + My.Application.Globix.CURRENT_ISATTACHMENT = True + If My.Application.User.Language = "de-DE" Then + Me.Text = "Ablage-Flow eines Email-Attachments" + Else + Me.Text = "Storage-Flow of email-Attachment" + End If + ElseIf pDropType = "|FW_SIMPLEINDEXER|" Then - Catch ex As Exception - _Logger.Warn(" - Unexpected error in Öffnen des Formulares - Fehler: " & vbNewLine & ex.Message) - _Logger.Error(ex.Message) - MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in Öffnen des Formulares:") - End Try + If My.Application.User.Language = "de-DE" Then + Me.Text = "Ablage-Flow einer Folderwatch-Datei" + Else + Me.Text = "Storage-Flow of Folderwatch-File" + End If + End If + End If End Sub + Private Sub SetFilePreview(ShowPreview As Boolean) If ShowPreview Then SplitContainerControl1.Collapsed = False @@ -218,14 +266,14 @@ Public Class frmGlobix_Index Try DocumentViewer1.LoadFile(My.Application.Globix.CURRENT_WORKFILE) Catch ex As Exception - _Logger.Error(ex) + Logger.Error(ex) MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler in PreviewFile:") End Try End Sub Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles SourceDeleteItem.ItemClick If SourceDeleteItem.Visibility <> DevExpress.XtraBars.BarItemVisibility.Never Then - My.Application.Globix.CURR_DELETE_ORIGIN = SourceDeleteItem.Checked + My.Application.Globix.DeleteOriginalFile = SourceDeleteItem.Checked My.UIConfig.Globix.DeleteOriginalFile = SourceDeleteItem.Checked My.SystemConfigManager.Save() End If @@ -233,7 +281,7 @@ Public Class frmGlobix_Index Private Sub SkipItem_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles SkipItem.ItemClick My.DatabaseECM.ExecuteNonQuery($"DELETE FROM TBGI_FILES_USER WHERE GUID = {My.Application.Globix.CURRENT_WORKFILE_GUID}") - CancelAttempts = 2 + CancelAttempts = MAX_CANCEL_ATTEMPTS Close() End Sub @@ -245,79 +293,30 @@ Public Class frmGlobix_Index End If End Sub - Private Sub frmGlobix_Index_Shown(sender As Object, e As EventArgs) Handles Me.Shown - BringToFront() - Focus() - Cursor = Cursors.Default - Refresh_Dokart() - pnlIndex.Controls.Clear() - - checkItemTopMost.Checked = My.UIConfig.Globix.TopMost - TopMost = My.UIConfig.Globix.TopMost - BringToFront() - - FormLoaded = True - - Try - ' Letzte Auswahl merken überschreibt die automatische selektion - If My.UIConfig.Globix.ProfilePreselection Then - checkItemPreselection.Checked = True - - If My.Application.Globix.CURRENT_LASTDOCTYPE <> "" Then - Dim oFoundDocType = cmbDocType.Properties.Items. - Cast(Of DocType)(). - Where(Function(dt) dt.Name = My.Application.Globix.CURRENT_LASTDOCTYPE). - FirstOrDefault() - If oFoundDocType IsNot Nothing Then - cmbDocType.SelectedItem = oFoundDocType - End If - - End If - Else - If My.Application.Globix.DTTBGI_REGEX_DOCTYPE.Rows.Count > 0 Then - For Each oRoW As DataRow In My.Application.Globix.DTTBGI_REGEX_DOCTYPE.Rows - Dim oOnlyFilename = Path.GetFileName(My.Application.Globix.CURRENT_WORKFILE) - If Regex.IsMatch(oOnlyFilename, oRoW.Item("Regex")) Then - - _Logger.Debug("There is a match on REGEX_DOCTYPE: [{0}]", oRoW.Item("DOCTYPE")) - _Logger.Debug("Regex: [{0}], FileName: [{1}]", oRoW.Item("Regex"), oOnlyFilename) - Dim oFoundDocType = cmbDocType.Properties.Items. - Cast(Of DocType)(). - Where(Function(dt) dt.Name = My.Application.Globix.CURRENT_LASTDOCTYPE). - FirstOrDefault() - - If oFoundDocType IsNot Nothing Then - cmbDocType.SelectedItem = oFoundDocType - End If - Exit For - End If - Next - End If - End If - Catch ex As Exception - _Logger.Warn("Unexpected error DTTBGI_REGEX_DOCTYPE - ErrorMessage: " & vbNewLine & ex.Message) - - End Try - End Sub Private Sub checkItemPreselection_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles checkItemPreselection.CheckedChanged My.UIConfig.Globix.ProfilePreselection = checkItemPreselection.Checked My.SystemConfigManager.Save() End Sub Sub Refresh_Dokart() Try - Dim oSql = String.Format("select * from VWGI_DOCTYPE_IDB where UPPER(USERNAME) = UPPER('{0}') ORDER BY SEQUENCE", My.Application.User.UserName) - 'Dim oFilter = $"USERNAME = '{My.Application.User.UserName}'" - DT_VWGI_DOCTYPE = _DataASorDB.GetDatatable("DD_ECM", oSql, "VWGI_DOCTYPE_IDB", "", "SEQUENCE") + Dim oSql = String.Format("SELECT * FROM VWGI_DOCTYPE_IDB where UPPER(USERNAME) = UPPER('{0}') ORDER BY SEQUENCE", My.Application.User.UserName) + DT_VWGI_DOCTYPE = Database.GetDatatable("VWGI_DOCTYPE_IDB", oSql, ECM, pSortByColumn:="SEQUENCE") + + Dim oDocTypes As New List(Of DocType) For Each oRow As DataRow In DT_VWGI_DOCTYPE.Rows - cmbDocType.Properties.Items.Add(New DocType With { - .Guid = oRow.Item("DOCTYPE_ID"), - .Name = oRow.Item("DOCTYPE") - }) + Dim oDocType = New DocType With { + .Guid = oRow.Item("DOCTYPE_ID"), + .Name = oRow.Item("DOCTYPE"), + .ObjectStore = oRow.Item("OBJECT_STORE") + } + + oDocTypes.Add(oDocType) + cmbDocType.Properties.Items.Add(oDocType) Next Catch ex As Exception - _Logger.Warn("Unexpected error in Refresh_Dokart: " & vbNewLine & ex.Message) + Logger.Warn("Unexpected error in Refresh_Dokart: " & vbNewLine & ex.Message) MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in Laden der Dokumentarten:") End Try End Sub @@ -327,41 +326,64 @@ Public Class frmGlobix_Index If cmbDocType.SelectedIndex <> -1 And FormLoaded = True Then Dim oSelectedItem As DocType = cmbDocType.SelectedItem - My.Application.Globix.CURRENT_DOCTYPE_ID = oSelectedItem.Guid - - 'lblhinweis.Visible = False ClearNotice() - - 'lblerror.Visible = False ClearError() pnlIndex.Controls.Clear() - Dim oSql As String = "Select * from TBDD_DOKUMENTART WHERE GUID = " & oSelectedItem.Guid - Dim oFilter = "GUID = " & oSelectedItem.Guid - My.Application.Globix.CURR_DT_DOCTYPE = _DataASorDB.GetDatatable("DD_ECM", oSql, "TBDD_DOKUMENTART", oFilter, "") - - My.Application.Globix.CURRENT_DOCTYPE_DuplicateHandling = My.Application.Globix.CURR_DT_DOCTYPE.Rows(0).Item("DUPLICATE_HANDLING").ToString - Refresh_IndexeMan(My.Application.Globix.CURRENT_DOCTYPE_ID) + SelectedDocType = oSelectedItem + 'My.Application.Globix.CURRENT_DOCTYPE_DuplicateHandling = My.Application.Globix.CURR_DT_DOCTYPE.Rows(0).Item("DUPLICATE_HANDLING").ToString + ManualIndexes = Refresh_IndexeMan(oSelectedItem.Guid) + LoadIndexe_Man() End If End Sub - Private Sub Refresh_IndexeMan(dokartid As Integer) + Private Function Refresh_IndexeMan(dokartid As Integer) As List(Of ManualIndex) Dim oSql Try - oSql = "select T1.BEZEICHNUNG AS DOKUMENTART,T.* from TBDD_INDEX_MAN T, TBDD_DOKUMENTART T1 where T.ACTIVE = 1 AND T.DOK_ID = T1.GUID AND T.DOK_ID = " & dokartid & " ORDER BY T.SEQUENCE" + oSql = $"SELECT + T1.BEZEICHNUNG AS DOKUMENTART, T.* + FROM TBDD_INDEX_MAN T, + TBDD_DOKUMENTART T1 + WHERE T.ACTIVE = 1 AND + T.DOK_ID = T1.GUID AND + T.DOK_ID = {dokartid} + ORDER BY T.SEQUENCE" Dim oFilter = "DOK_ID = " & dokartid - DT_INDEXEMAN = _DataASorDB.GetDatatable("DD_ECM", oSql, "DT_INDEXE_MAN", oFilter, "SEQUENCE") - pnlIndex.Visible = True - LoadIndexe_Man() - Catch ex As System.Exception - _Logger.Error(ex) - _Logger.Warn("Fehler Refresh_IndexeMan: DOKART-ID: " & dokartid & " - Fehler: " & vbNewLine & ex.Message & vbNewLine & oSql) + Dim oTable = _DataASorDB.GetDatatable("DD_ECM", oSql, "DT_INDEXE_MAN", oFilter, "SEQUENCE") + Dim oManualIndexes As New List(Of ManualIndex) + + For Each oRow As DataRow In oTable.Rows + Dim oIndex As New ManualIndex With { + .Id = oRow.ItemEx(Of Integer)("GUID"), + .DocTypeId = oRow.ItemEx(Of Integer)("DOK_ID"), + .DocTypeName = oRow.ItemEx(Of String)("DOKUMENTART"), + .Name = oRow.ItemEx(Of String)("NAME"), + .Comment = oRow.ItemEx(Of String)("COMMENT"), + .DataType = oRow.ItemEx(Of String)("DATATYPE"), + .Sequence = oRow.ItemEx("SEQUENCE", 0), + .SQLCommand = oRow.ItemEx("SQL_RESULT", String.Empty), + .SQLConnection = oRow.ItemEx("CONNECTION_ID", 0), + .SQLSuggestion = oRow.ItemEx("SUGGESTION", String.Empty), + .DefaultValue = oRow.ItemEx("DEFAULT_VALUE", String.Empty), + .IsOptional = oRow.ItemEx(Of Integer)("OPTIONAL", False), + .IsActive = oRow.ItemEx("ACTIVE", False), + .IsMultiselect = oRow.ItemEx("MULTISELECT", False) + } + + oManualIndexes.Add(oIndex) + Next + + Return oManualIndexes + Catch ex As Exception + Logger.Error(ex) MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in Refresh_IndexeMan:") + Return Nothing + End Try - End Sub + End Function Sub addLabel(pIndexName As String, hinweis As String, ylbl As Integer, anz As String) Dim lbl As New Label With { .Name = "lbl" & pIndexName, @@ -379,6 +401,7 @@ Public Class frmGlobix_Index labelError.Visibility = DevExpress.XtraBars.BarItemVisibility.Always labelError.Caption = text End Sub + Private Sub LoadIndexe_Man() Try Dim oScreen As New DigitalData.Modules.Windows.Screen() @@ -388,79 +411,64 @@ Public Class frmGlobix_Index Dim oLabelPosition As Integer = 11 * oDpiScale Dim oControlPosition As Integer = 33 * oDpiScale - Dim oControls As New DigitalData.GUIs.GlobalIndexer.ControlCreator(_LogConfig, pnlIndex, Me) With { + Dim oControls As New ControlCreator(LogConfig, pnlIndex, Me) With { .OnControlChanged = AddressOf PrepareDependingControl, .OnLookupData = AddressOf GetLookupData } - _Logger.Info("Loading Indicies for Screen Scaling Factor [{0}]", oDpiScale) + pnlIndex.Visible = True + + Logger.Info("Loading Indicies for Screen Scaling Factor [{0}]", oDpiScale) - _Controls = oControls - If DT_INDEXEMAN.Rows.Count = 0 Then + If ManualIndexes Is Nothing OrElse ManualIndexes.Count = 0 Then ShowError("Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & cmbDocType.Text & " definiert") - _Logger.Info(" - Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & cmbDocType.Text & " definiert") + Logger.Info(" - Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & cmbDocType.Text & " definiert") End If - For Each oRow As DataRow In DT_INDEXEMAN.Rows - Dim oDataType = oRow.Item("DATATYPE") - Dim MultiSelect As Boolean = oRow.Item("MULTISELECT") - Dim AddNewItems As Boolean = oRow.Item("VKT_ADD_ITEM") - Dim PreventDuplicates As Boolean = oRow.Item("VKT_PREVENT_MULTIPLE_VALUES") - Dim oControlName As String = oRow.Item("NAME") - Dim oConnectionId = NotNull(oRow.Item("CONNECTION_ID"), 0) - Dim oSQLSuggestion = oRow.Item("SUGGESTION") + For Each oIndex As ManualIndex In ManualIndexes + Dim MultiSelect As Boolean = oIndex.IsMultiselect + Dim AddNewItems As Boolean = oIndex.AllowAddingItems + Dim PreventDuplicates As Boolean = oIndex.PreventMultleValue + Dim oControlName As String = oIndex.Name + Dim oConnectionId = oIndex.SQLConnection + Dim oSQLSuggestion = oIndex.SQLSuggestion + Dim oDataType = oIndex.DataType If oDataType <> "BOOLEAN" Then - addLabel(oControlName, oRow.Item("COMMENT").ToString, oLabelPosition, oControlCount) + addLabel(oControlName, oIndex.Comment, oLabelPosition, oControlCount) End If - Dim oDefaultValue = Check_HistoryValues(oControlName, oRow.Item("DOKUMENTART")) - If oDefaultValue Is Nothing Then - oDefaultValue = GetPlaceholderValue(oRow.Item("DEFAULT_VALUE"), My.Application.Globix.CURRENT_WORKFILE, My.Application.User.ShortName) - End If - Select Case oDataType + 'Dim oDefaultValue = Check_HistoryValues(oControlName, oIndex.DocTypeName) + 'If oDefaultValue Is Nothing Then + ' 'oDefaultValue = GetPlaceholderValue(oIndex.DefaultValue, My.Application.Globix.CURRENT_WORKFILE) + 'End If + Dim oDefaultValue = GetPlaceholderValue(oIndex.DefaultValue, My.Application.Globix.CURRENT_WORKFILE) + + Dim oControl As Control = Nothing + Dim oHasSqlCommand = (oSQLSuggestion = True And oIndex.SQLCommand.Length > 0) + Dim oNeedsLookup As Boolean = oHasSqlCommand Or MultiSelect = True + + Select Case oIndex.DataType Case "BOOLEAN" - Dim chk As CheckBox = oControls.AddCheckBox(oControlName, oControlPosition, oDefaultValue, oRow.Item("COMMENT").ToString) - If Not IsNothing(chk) Then - pnlIndex.Controls.Add(chk) - End If - Case "INTEGER" - If (oSQLSuggestion = True And oRow.Item("SQL_RESULT").ToString.Length > 0) Or MultiSelect = True Then + Dim oCheckbox As CheckBox = oControls.AddCheckBox(oControlName, oControlPosition, oDefaultValue, oIndex.Comment) + oControl = oCheckbox - Dim oControl = oControls.AddLookupControl(oControlName, oControlPosition, MultiSelect, oDataType, oRow.Item("SQL_RESULT"), oConnectionId, oDefaultValue, AddNewItems, PreventDuplicates) - If Not IsNothing(oControl) Then - pnlIndex.Controls.Add(oControl) - End If + Case "INTEGER" + If oNeedsLookup Then + oControl = oControls.AddLookupControl(oControlName, oControlPosition, MultiSelect, oDataType, oIndex.SQLCommand, oConnectionId, oDefaultValue, AddNewItems, PreventDuplicates) Else - 'nur eine Textbox - Dim oControl = oControls.AddTextBox(oControlName, oControlPosition, oDefaultValue, oDataType) - If Not IsNothing(oControl) Then - pnlIndex.Controls.Add(oControl) - End If + oControl = oControls.AddTextBox(oControlName, oControlPosition, oDefaultValue, oDataType) End If + Case "VARCHAR" - If (oSQLSuggestion = True And oRow.Item("SQL_RESULT").ToString.Length > 0) Or MultiSelect = True Then - Dim oControl = oControls.AddLookupControl(oControlName, oControlPosition, MultiSelect, oDataType, oRow.Item("SQL_RESULT"), oConnectionId, oDefaultValue, AddNewItems, PreventDuplicates) - If Not IsNothing(oControl) Then - pnlIndex.Controls.Add(oControl) - End If + If oNeedsLookup Then + oControl = oControls.AddLookupControl(oControlName, oControlPosition, MultiSelect, oDataType, oIndex.SQLCommand, oConnectionId, oDefaultValue, AddNewItems, PreventDuplicates) Else - If oControlName.ToString.ToLower = "dateiname" Then - Dim oControl = oControls.AddTextBox(oControlName, oControlPosition, System.IO.Path.GetFileNameWithoutExtension(My.Application.Globix.CURRENT_WORKFILE), oDataType) - If Not IsNothing(oControl) Then - pnlIndex.Controls.Add(oControl) - End If - Else - Dim VORBELGUNG As String = oDefaultValue - Dim oControl = oControls.AddTextBox(oControlName, oControlPosition, VORBELGUNG, oDataType) - If Not IsNothing(oControl) Then - pnlIndex.Controls.Add(oControl) - End If - End If + oControl = oControls.AddTextBox(oControlName, oControlPosition, oDefaultValue, oDataType) End If + Case "DATE" - Dim oPicker = oControls.AddDateTimePicker(oControlName, oControlPosition, oDataType) - pnlIndex.Controls.Add(oPicker) + oControl = oControls.AddDateTimePicker(oControlName, oControlPosition, oDataType) Case Else If My.Application.User.Language = "de-DE" Then @@ -469,9 +477,13 @@ Public Class frmGlobix_Index MsgBox("Please check Datatype of Indexvalue!", MsgBoxStyle.Critical, "Warning:") End If - _Logger.Warn(" - Datentyp nicht hinterlegt - LoadIndexe_Man") + Logger.Warn(" - Datentyp nicht hinterlegt - LoadIndexe_Man") End Select + If Not IsNothing(oControl) Then + pnlIndex.Controls.Add(oControl) + End If + oControlCount += 1 oLabelPosition += 50 * oDpiScale oControlPosition += 50 * oDpiScale @@ -480,15 +492,15 @@ Public Class frmGlobix_Index Dim oPanelHeight = oControlPosition - 30 If pnlIndex.Height < oPanelHeight Then - If (Me.Height - 315) < oPanelHeight Then - Me.Height = (Me.Height - 315) + oPanelHeight + If (Height - 315) < oPanelHeight Then + Height = (Height - 315) + oPanelHeight End If pnlIndex.Height = oPanelHeight End If SendKeys.Send("{TAB}") Catch ex As Exception - _Logger.Error(ex) + Logger.Error(ex) MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in LoadIndexe_Man:") End Try End Sub @@ -500,11 +512,11 @@ Public Class frmGlobix_Index Try Dim oMeta = DirectCast(pControl.Tag, ControlMeta) Dim oIndexName As String = oMeta.IndexName - Dim oSQL = $"SELECT * FROM TBDD_INDEX_MAN WHERE SQL_RESULT LIKE '%{oIndexName}%' AND DOK_ID = {My.Application.Globix.CURRENT_DOCTYPE_ID}" + Dim oSQL = $"SELECT * FROM TBDD_INDEX_MAN WHERE SQL_RESULT LIKE '%{oIndexName}%' AND DOK_ID = {SelectedDocType.Guid}" Dim oDatatable As DataTable = My.DatabaseECM.GetDatatable(oSQL) If Not IsNothing(oDatatable) Then - _Logger.Debug("Found [{0}] depending controls for [{1}]", oDatatable.Rows.Count, pControl.Name) + Logger.Debug("Found [{0}] depending controls for [{1}]", oDatatable.Rows.Count, pControl.Name) For Each oRow As DataRow In oDatatable.Rows Dim oControlName As String = NotNull(oRow.Item("NAME"), "") @@ -512,25 +524,26 @@ Public Class frmGlobix_Index Dim oControlSql As String = NotNull(oRow.Item("SQL_RESULT"), "") If oConnectionId = -1 Or oControlSql = String.Empty Then - _Logger.Warn("Missing SQL Query or ConnectionId for Control [{0}]! Continuing.", oControlName) + Logger.Warn("Missing SQL Query or ConnectionId for Control [{0}]! Continuing.", oControlName) Continue For End If - oControlSql = _Patterns.ReplaceUserValues(oControlSql, My.Application.Globix.CURRENT_DOCTYPE_ID) - oControlSql = _Patterns.ReplaceInternalValues(oControlSql) - oControlSql = _Patterns.ReplaceControlValues(oControlSql, pnlIndex) - _Logger.Debug("Setting new value for [{0}]", oControlName) + oControlSql = Patterns2.ReplaceInternalValues(oControlSql) + oControlSql = Patterns2.ReplaceUserValues(oControlSql, My.Application.User) + oControlSql = Patterns2.ReplaceControlValues(oControlSql, pnlIndex) + + Logger.Debug("Setting new value for [{0}]", oControlName) SetDependingControlResult(oControlName, oControlSql, oConnectionId) Next End If Catch ex As Exception - _Logger.Error(ex) + Logger.Error(ex) End Try End Sub Private Sub SetDependingControlResult(IndexName As String, pSqlCommand As String, SqlConnectionId As Integer) Try If pSqlCommand Is Nothing OrElse pSqlCommand = String.Empty Then - _Logger.Warn("New Value for Index [{0}] could not be set. Supplied SQL is empty.") + Logger.Warn("New Value for Index [{0}] could not be set. Supplied SQL is empty.") Exit Sub End If @@ -555,11 +568,11 @@ Public Class frmGlobix_Index Next If oFoundControl Is Nothing Then - _Logger.Warn("Depending Control for Index [{0}] not found!", IndexName) + Logger.Warn("Depending Control for Index [{0}] not found!", IndexName) End If If oDatatable Is Nothing Then - _Logger.Warn("Error in SQL Command: {0}", pSqlCommand) + Logger.Warn("Error in SQL Command: {0}", pSqlCommand) End If Select Case oFoundControl.GetType.Name @@ -570,21 +583,21 @@ Public Class frmGlobix_Index If oFirstRow.ItemArray.Length > 0 Then Dim oValue = oFirstRow.Item(0).ToString() - _Logger.Debug("Setting Value for TextEdit [{0}]: [{1}]", oFoundControl.Name, oValue) + Logger.Debug("Setting Value for TextEdit [{0}]: [{1}]", oFoundControl.Name, oValue) DirectCast(oFoundControl, DevExpress.XtraEditors.TextEdit).Text = oValue End If End If Case GetType(LookupControl3).Name - _Logger.Debug("Setting Value for LookupControl [{0}]: [{1}]", oFoundControl.Name, "DATATABLE") + Logger.Debug("Setting Value for LookupControl [{0}]: [{1}]", oFoundControl.Name, "DATATABLE") DirectCast(oFoundControl, LookupControl3).Properties.DataSource = oDatatable - Case GetType(ComboBox).Name - _Logger.Debug("Setting Value for Combobox [{0}]: [{1}]", oFoundControl.Name, "DATATABLE") - DirectCast(oFoundControl, ComboBox).DataSource = oDatatable + Case GetType(Windows.Forms.ComboBox).Name + Logger.Debug("Setting Value for Combobox [{0}]: [{1}]", oFoundControl.Name, "DATATABLE") + DirectCast(oFoundControl, Windows.Forms.ComboBox).DataSource = oDatatable Case Else - _Logger.Debug("Could not set depending control result for [{0}]", oFoundControl.GetType.Name) + Logger.Debug("Could not set depending control result for [{0}]", oFoundControl.GetType.Name) End Select Catch ex As Exception - _Logger.Error(ex) + Logger.Error(ex) End Try End Sub Private Function GetLookupData(pLookup As LookupControl3, pSQLCommand As String, pConnectionId As Integer) @@ -592,89 +605,42 @@ Public Class frmGlobix_Index oConnectionString = MSSQLServer.DecryptConnectionString(oConnectionString) If oConnectionString IsNot Nothing And pSQLCommand.Length > 0 Then - _Logger.Debug("Connection String (redacted): [{0}]", oConnectionString.Substring(0, 30)) + Logger.Debug("Connection String (redacted): [{0}]", oConnectionString.Substring(0, 30)) - If _Patterns.HasComplexPatterns(pSQLCommand) Then - _Logger.Debug(" >>sql enthält Platzhalter und wird erst während der Laufzeit gefüllt!", False) + If Patterns2.HasComplexPatterns(pSQLCommand) Then + Logger.Debug(" >>sql enthält Platzhalter und wird erst während der Laufzeit gefüllt!", False) Return Nothing Else - pSQLCommand = _Patterns.ReplaceInternalValues(pSQLCommand) - pSQLCommand = _Patterns.ReplaceUserValues(pSQLCommand, My.Application.Globix.CURRENT_DOCTYPE_ID) + pSQLCommand = Patterns2.ReplaceInternalValues(pSQLCommand) + pSQLCommand = Patterns2.ReplaceUserValues(pSQLCommand, My.Application.User) Dim oDatatable = My.DatabaseECM.GetDatatableWithConnection(pSQLCommand, oConnectionString) Return oDatatable End If Else - _Logger.Warn("Connection String for control [{0}] is empty!", pLookup.Name) + Logger.Warn("Connection String for control [{0}] is empty!", pLookup.Name) Return Nothing End If End Function - Function GetPlaceholderValue(InputValue As String, FileName As String, UserShortName As String) As String - Dim oResult As String + Function GetPlaceholderValue(InputValue As String, FileName As String) As String + Dim oResult As String = InputValue + Dim oPatterns As New Modules.Patterns.Patterns2(My.LogConfig) + Dim oFileInfo As New FileInfo(FileName) - Try - Select Case InputValue.ToString.ToUpper - Case "$filename_ext".ToUpper - oResult = Path.GetFileName(FileName) - Case "$filename".ToUpper - oResult = Path.GetFileNameWithoutExtension(FileName) - Case "$extension".ToUpper - oResult = Path.GetExtension(FileName).Replace(".", "") - Case "$FileCreateDate".ToUpper - Dim oFileInfo As New FileInfo(FileName) - Dim oCreationDate As Date = oFileInfo.CreationTime - oResult = oCreationDate.ToShortDateString - Case "$FileCreatedWho".ToUpper - Dim oFileSecurity As FileSecurity = File.GetAccessControl(FileName) - Dim oSecurityId As IdentityReference = oFileSecurity.GetOwner(GetType(SecurityIdentifier)) - Dim oNTAccount As IdentityReference = oSecurityId.Translate(GetType(NTAccount)) - Dim oOwner As String = oNTAccount.ToString() - oResult = oOwner - Case "$DateDDMMYYY".ToUpper - oResult = System.DateTime.Now.ToShortDateString - Case "$Username".ToUpper - oResult = Environment.UserName - Case "$Usercode".ToUpper - oResult = UserShortName - Case Else - oResult = InputValue - End Select - Catch ex As Exception - _Logger.Warn("Error in ReplacePlaceholders: " & ex.Message) - _Logger.Error(ex.Message) - oResult = Nothing - End Try + oResult = oPatterns.ReplaceInternalValues(oResult) + oResult = oPatterns.ReplaceFileValues(oResult, oFileInfo) + oResult = oPatterns.ReplaceUserValues(oResult, My.Application.User) Return oResult End Function - Function Check_HistoryValues(Indexname As String, Dokart As String) As String - Try - Dim result = Nothing - Dim DT As DataTable = GlobixDataset.TBTEMP_INDEXRESULTS - If DT.Rows.Count > 0 Then - For Each row As DataRow In DT.Rows - If row.Item("Indexname") = Indexname And row.Item("Dokumentart") = Dokart Then - result = row.Item("Value") - Return result - End If - Next - Else - Return Nothing - End If - Catch ex As Exception - _Logger.Error(ex) - MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in Check_HistoryValues:") - Return Nothing - End Try - End Function + + Sub ClearError() labelError.Visibility = DevExpress.XtraBars.BarItemVisibility.Never labelError.Caption = String.Empty End Sub Sub ShowNotice(text As String) - 'lblhinweis.Visible = True - 'lblhinweis.Text = text labelNotice.Visibility = DevExpress.XtraBars.BarItemVisibility.Always labelNotice.Caption = text End Sub @@ -740,7 +706,7 @@ Public Class frmGlobix_Index Catch ex As Exception - _Logger.Error(ex) + Logger.Error(ex) MsgBox("Unexpected Error in Abort Indexing: " & vbNewLine & ex.Message, MsgBoxStyle.Critical) End Try @@ -749,11 +715,11 @@ Public Class frmGlobix_Index DocumentViewer1.CloseDocument() DocumentViewer1.Done() - clswindowLocation.SaveFormLocationSize(Me) + WindowLocation.SaveFormLocationSize(Me) My.Settings.Save() Catch ex As Exception - _Logger.Info(" - Unexpected error in Schliessen des Formulares - Fehler: " & vbNewLine & ex.Message) - _Logger.Error(ex.Message) + Logger.Info(" - Unexpected error in Schliessen des Formulares - Fehler: " & vbNewLine & ex.Message) + Logger.Error(ex.Message) MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in Schliessen des Formulares:") End Try @@ -767,11 +733,11 @@ Public Class frmGlobix_Index DocumentViewer1.CloseDocument() DocumentViewer1.Done() - clswindowLocation.SaveFormLocationSize(Me) + WindowLocation.SaveFormLocationSize(Me) My.Settings.Save() Catch ex As Exception - _Logger.Warn(" - Unexpected error in Schliessen des Formulares - Fehler: " & vbNewLine & ex.Message) - _Logger.Error(ex) + Logger.Warn(" - Unexpected error in Schliessen des Formulares - Fehler: " & vbNewLine & ex.Message) + Logger.Error(ex) MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in Schliessen des Formulares:") End Try End Select @@ -780,1686 +746,63 @@ Public Class frmGlobix_Index End If End Sub - Private Sub GlobixFlow() - ClearError() - ClearNotice() - Cursor = Cursors.WaitCursor - Refresh_RegexTable() + Private Async Function GlobixFlowNew(pDocType As DocType) As Threading.Tasks.Task(Of Boolean) + Try + ClearError() + ClearNotice() + Cursor = Cursors.WaitCursor - For Each rowregex As DataRow In My.Application.Globix.DT_FUNCTION_REGEX.Rows - If rowregex.Item("FUNCTION_NAME") = "CLEAN_FILENAME" Then - My.Application.Globix.REGEX_CLEAN_FILENAME = rowregex.Item("REGEX") + Dim oValidator As New ClassValidator(My.LogConfig, My.Application.Service.Client, ManualIndexes) + If oValidator.ValidateControls(pnlIndex, pDocType) = False Then + Return False End If - Next - - If chkMultiindexing.Visibility = DevExpress.XtraBars.BarItemVisibility.Always And chkMultiindexing.Checked = True Then - 'Die erste Datei indexieren - If WORK_FILE() = True Then - 'Und nun die folgenden - Dim DTFiles2Work As DataTable = My.DatabaseECM.GetDatatable("SELECT * FROM TBGI_FILES_USER WHERE WORKED = 0 AND GUID <> " & My.Application.Globix.CURRENT_WORKFILE_GUID & " AND UPPER(USER@WORK) = UPPER('" & My.Application.User.UserName & "')") - If Not DTFiles2Work Is Nothing Then - Dim err = False - For Each filerow As DataRow In DTFiles2Work.Rows - My.Application.Globix.CURRENT_WORKFILE_GUID = filerow.Item("GUID") - My.Application.Globix.CURRENT_WORKFILE = filerow.Item("FILENAME2WORK") - DropType = filerow.Item("HANDLE_TYPE") - - If WORK_FILE() = False Then - err = True - Exit For - End If - Next - Me.Cursor = Cursors.Default - If err = False Then - If My.Application.User.Language = "de-DE" Then - MsgBox("Alle Dateien wurden mit Multiindexing erfolgreich verarbeitet!", MsgBoxStyle.Information, "Erfolgsmeldung:") - Else - MsgBox("All files were successfully processed through Multiindexing", MsgBoxStyle.Information, "Success") - End If - 'DTACTUAL_FILES.Clear() + Dim oValues = oValidator.GetControlValues(pnlIndex) - DocumentViewer1.CloseDocument() - DocumentViewer1.Done() - CancelAttempts = 2 - Me.Close() - End If - End If - End If - Else - If WORK_FILE() = True Then - Me.Cursor = Cursors.Default - If My.UIConfig.Globix.ShowIndexResult = True Then + Dim oFileName As String = My.Application.Globix.CURRENT_WORKFILE + Dim oObjectStore As String = "WORK" + Dim oObjectKind As String = "DOC" + Dim oBusinessEntity As String = "DEFAULT" + Dim oProfileId As Integer = My.Application.Globix.CURRENT_DOCTYPE_ID + Dim oAttributes As List(Of UserAttributeValue) = oValues + Dim oOptions As New Modules.EDMI.API.Options.ImportFileOptions - NI_TYPE = "INFO" - If My.Application.User.Language = "de-DE" Then - NI_TITLE = "Globix Flow erfolgreich" - NI_MESSAGE = "Die Datei wurde erfolgreich verarbeitet" - Else - NI_TITLE = "Success Globix Flow" - NI_MESSAGE = "File successfully processed" - End If - End If + Await My.Application.Service.Client.ImportFileAsync( + oFileName, oProfileId, oAttributes, oObjectStore, oObjectKind, oBusinessEntity, oOptions) - DocumentViewer1.CloseDocument() - DocumentViewer1.Done() + MsgBox("Die Datei wurde erfolgreich verarbeitet!", MsgBoxStyle.Information, Text) - CancelAttempts = 2 - Me.Close() - End If - End If - Me.Cursor = Cursors.Default - End Sub + Return True + Catch ex As Exception + Logger.Error(ex) + MsgBox("Indexierung fehlgeschlagen!", MsgBoxStyle.Critical, Text) + Return False - Private Function WORK_FILE() - Try - Dim oSQL = $"SELECT * ,CONVERT(VARCHAR(512),'') As IndexValueGUI,CONVERT(VARCHAR(512),'') As IndexValue_File,CONVERT(Bit,0) as Indexed FROM VWDDINDEX_MAN WHERE DOK_ID = {My.Application.Globix.CURRENT_DOCTYPE_ID}" - Dim oFilter = "DOK_ID = " & My.Application.Globix.CURRENT_DOCTYPE_ID - My.Application.Globix.CURR_DT_MAN_INDEXE = _DataASorDB.GetDatatable("DD_ECM", oSQL, "VWDDINDEX_MAN", oFilter, "") + Finally + Cursor = Cursors.Default - _Logger.Debug("Manuelle Indexe geladen") + End Try + End Function - If My.Application.Globix.CURR_DT_MAN_INDEXE.Rows.Count > 0 Then - Dim oDokart As DocType = cmbDocType.SelectedItem - My.Application.Globix.CURRENT_DOCTYPE_ID = oDokart.Guid + Private Async Sub SimpleButton1_Click(sender As Object, e As EventArgs) Handles SimpleButton1.Click + Dim oDokart As DocType = cmbDocType.SelectedItem - If CheckWrite_IndexeMan(oDokart.Guid) = True Then - '##### Manuelle Indexe indexiert ##### - _Logger.Info("Datei [" & My.Application.Globix.CURRENT_WORKFILE & "] wird nun indexiert...") - If FillIndexe_Autom(oDokart.Guid) = True Then - _Logger.Debug(" ...FillIndexe_Autom durchlaufen") + If oDokart Is Nothing Then + Exit Sub + End If - 'Den Zielnamen zusammenbauen - If Name_Generieren() = True Then - 'Dokumentenviewer ausblenden um keinen Zugriffsfehler zu produzieren - DocumentViewer1.Done() - DocumentViewer1.CloseDocument() + Dim oResult = Await GlobixFlowNew(oDokart) + If oResult = True Then + DocumentViewer1.CloseDocument() + DocumentViewer1.Done() - _Logger.Debug(" ...Viewer geschlossen") - 'Die Datei verschieben - If Move_File2_Target() = True Then - _Logger.Debug(" ...Move_File2_Target durchlaufen") - My.Application.Globix.CURRENT_LASTDOCTYPE = oDokart.Name - _Logger.Info("Datei '" & My.Application.Globix.CURRENT_NEWFILENAME & "' erfolgreich erzeugt.") - Dim oDEL As String = "DELETE FROM TBGI_FILES_USER WHERE GUID = " & My.Application.Globix.CURRENT_WORKFILE_GUID - My.DatabaseECM.ExecuteNonQuery(oDEL) - - If My.Application.Globix.CURR_DELETE_ORIGIN = True Then - _Logger.Info("Datei [" & My.Application.Globix.CURRENT_WORKFILE & "] wird gelöscht.") - Try - System.IO.File.Delete(My.Application.Globix.CURRENT_WORKFILE) - Catch ex As Exception - _Logger.Error(ex) - End Try - _Logger.Info("Datei [" & My.Application.Globix.CURRENT_WORKFILE & "] wurde gelöscht.") - End If - - Return True - End If - - Else - If My.Application.User.Language = "de-DE" Then - MsgBox("Unerwarteter Fehler in Name_Generieren - Bitte überprüfen sie die Logdatei", MsgBoxStyle.Critical) - Else - MsgBox("Unexpected error in Name_Generieren - Please check the Logfile", MsgBoxStyle.Critical) - End If - Return False - End If - Else - If My.Application.User.Language = "de-DE" Then - MsgBox("Unerwarteter Fehler in FillIndexe_Autom - Bitte überprüfen sie die Logdatei", MsgBoxStyle.Critical) - Else - MsgBox("Unexpected error in FillIndexe_Autom - Please check the Logfile", MsgBoxStyle.Critical) - End If - Return False - End If - '#### Automatische Werte indexieren #### - End If - Else - If My.Application.User.Language = "de-DE" Then - MsgBox("Bitte überprüfen Sie die Konfiguration dieser Dokumentart." & vbNewLine & "Es sind KEINE manuellen Indizes konfiguriert oder aktiv geschaltet!", MsgBoxStyle.Exclamation) - Else - MsgBox("Please check the configuration for this document-type." & vbNewLine & "There are NO manual indicies that are either configured or set to active!", MsgBoxStyle.Exclamation) - End If - Return False - End If - Catch ex As Exception - _Logger.Error(ex) - MsgBox("Unexpected Error in WORK_FILE:" & vbNewLine & ex.Message, MsgBoxStyle.Critical) - Return False - End Try - End Function - - Function Name_Generieren() - Try - _Logger.Debug("#### Name_Generieren ####") - My.Application.Globix.FILE_DELIMITER = "~" - My.Application.Globix.VERSION_DELIMITER = "~" - Dim oFilesystem As New DigitalData.Modules.Filesystem.File(_LogConfig) - - - Dim err As Boolean = False - Dim folder_Created As Boolean = False - Dim oRAWZielordner As String - Dim extension As String = System.IO.Path.GetExtension(My.Application.Globix.CURRENT_WORKFILE) - - sql_history_INSERT_INTO = "INSERT INTO TBGI_HISTORY (FILENAME_ORIGINAL,FILENAME_NEW" - sql_history_Index_Values = "" - Dim AnzahlIndexe As Integer = 1 - 'CURR_DOKART_OBJECTTYPE = DT.Rows(0).Item("OBJEKTTYP") - My.Application.Globix.CURRENT_WORKFILE_EXTENSION = extension - - oRAWZielordner = My.Application.Globix.CURR_DT_DOCTYPE.Rows(0).Item("ZIEL_PFAD") - - - '#### - ' Regulären Ausdruck zum Auslesen der Indexe definieren - Dim preg As String = "\[%{1}[a-zA-Z0-9ß\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}" - 'schonmal den gesamten Pfad laden - Dim oNamenkonvention As String = My.Helpers.GetValueFromDatatable(My.Application.Globix.CURR_DT_DOCTYPE, $"", "NAMENKONVENTION", "").ToString & My.Application.Globix.CURRENT_WORKFILE_EXTENSION - NewFileString = oNamenkonvention - ' einen Regulären Ausdruck laden - Dim regulärerAusdruck As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex(preg) - ' die Vorkommen im SQL-String auslesen - Dim oMatchelements As System.Text.RegularExpressions.MatchCollection = regulärerAusdruck.Matches(oNamenkonvention) - '#### - If oMatchelements.Count = 0 Then - _Logger.Debug("No RegularExpression Fileds on Nameconvention!") - End If - ' alle Vorkommen innerhalbd er Namenkonvention durchlaufen - For Each oElement As System.Text.RegularExpressions.Match In oMatchelements - Select Case oElement.Value.Substring(2, 1).ToUpper - 'Manueller Indexwert - Case "M" - _Logger.Debug("NameGenerieren: Manueller Index wird geprüft...") - Dim Indexname = oElement.Value.Substring(3, oElement.Value.Length - 4) - - Dim optional_index As Boolean = My.Helpers.GetValueFromDatatable(My.Application.Globix.CURR_DT_MAN_INDEXE, $"DOK_ID = {My.Application.Globix.CURRENT_DOCTYPE_ID} AND INDEXNAME = '{Indexname}'", "OPTIONAL", "") - - Dim oManValue As String = GetManIndex_Value(Indexname, "FILE", optional_index) - If oManValue <> String.Empty Then - Dim firstVectorValue = oManValue.Split(ClassConstants.VECTORSEPARATOR).First() - - oNamenkonvention = oNamenkonvention.Replace(oElement.Value, firstVectorValue) - NewFileString = oNamenkonvention - sql_history_INSERT_INTO = sql_history_INSERT_INTO & ", INDEX" & AnzahlIndexe.ToString - AnzahlIndexe += 1 - sql_history_Index_Values = sql_history_Index_Values & ", '" & oManValue.Replace("'", "''") & "'" - Else - - If optional_index = True Then - oNamenkonvention = oNamenkonvention.Replace("-" & oElement.Value & "-", "-") - oNamenkonvention = oNamenkonvention.Replace("_" & oElement.Value & "_", "_") - oNamenkonvention = oNamenkonvention.Replace("_" & oElement.Value & "-", "_") - oNamenkonvention = oNamenkonvention.Replace("-" & oElement.Value & "_", "-") - - oNamenkonvention = oNamenkonvention.Replace("-" & oElement.Value, "-") - oNamenkonvention = oNamenkonvention.Replace("_" & oElement.Value, "_") - oNamenkonvention = oNamenkonvention.Replace(oElement.Value & "-", "-") - oNamenkonvention = oNamenkonvention.Replace(oElement.Value & "_", "_") - - oNamenkonvention = oNamenkonvention.Replace(oElement.Value, oManValue) - - Dim oFilenameWithoutExtension = Path.GetFileNameWithoutExtension(oNamenkonvention) - Dim oExtension = Path.GetExtension(oNamenkonvention) - - If oFilenameWithoutExtension.EndsWith("-") Or oFilenameWithoutExtension.EndsWith("_") Then - oFilenameWithoutExtension = oFilenameWithoutExtension.Substring(0, oFilenameWithoutExtension.Count - 1) - End If - - NewFileString = oFilenameWithoutExtension & oExtension - sql_history_INSERT_INTO = sql_history_INSERT_INTO & ", INDEX" & AnzahlIndexe.ToString - AnzahlIndexe += 1 - sql_history_Index_Values = sql_history_Index_Values & ", '" & oManValue.Replace("'", "''") & "'" - Else - _Logger.Debug("Der Indexvalue für Index '" & Indexname & "' ist String.Empty") - err = True - End If - - End If - Case "A" - Dim value As String = GetAutoIndex_Value(oElement.Value.Substring(3, oElement.Value.Length - 4)) - If value <> String.Empty Then - If value = "EMPTY_OI" Then - oNamenkonvention = oNamenkonvention.Replace(oElement.Value, "") - NewFileString = oNamenkonvention - Else - oNamenkonvention = oNamenkonvention.Replace(oElement.Value, value) - NewFileString = oNamenkonvention - sql_history_INSERT_INTO = sql_history_INSERT_INTO & ", INDEX" & AnzahlIndexe.ToString - AnzahlIndexe += 1 - sql_history_Index_Values = sql_history_Index_Values & ", '" & value.Replace("'", "''") & "'" - End If - Else - err = True - End If - Case "V" - Dim datetemp As String - Dim _Month As String = My.Computer.Clock.LocalTime.Month - If _Month.Length = 1 Then - _Month = "0" & _Month - End If - Dim _day As String = My.Computer.Clock.LocalTime.Day - If _day.Length = 1 Then - _day = "0" & _day - End If - Dim type = oElement.Value '.ToUpper.Replace("[v%", "") - type = type.Replace("[%v_", "") - type = type.Replace("[%v", "") - type = type.Replace("]", "") - Select Case type - Case "YY_MM_DD" - datetemp = My.Computer.Clock.LocalTime.Year.ToString.Substring(2) & "_" & _Month & "_" & _day - Case "YYYY_MM_DD" - datetemp = My.Computer.Clock.LocalTime.Year & "_" & _Month & "_" & _day - Case "DD_MM_YY" - datetemp = _day & "_" & _Month & "_" & My.Computer.Clock.LocalTime.Year.ToString.Substring(2) - Case "DD_MM_YYYY" - datetemp = _day & "_" & _Month & "_" & My.Computer.Clock.LocalTime.Year - Case "YYMMDD" - datetemp = My.Computer.Clock.LocalTime.Year.ToString.Substring(2) & _Month & _day - Case "YYYYMMDD" - datetemp = My.Computer.Clock.LocalTime.Year & _Month & _day - Case "DDMMYY" - datetemp = _day & _Month & My.Computer.Clock.LocalTime.Year.ToString.Substring(2) - Case "DDMMYYYY" - datetemp = _day & _Month & My.Computer.Clock.LocalTime.Year - Case "OFilename" - oNamenkonvention = oNamenkonvention.Replace(oElement.Value, System.IO.Path.GetFileNameWithoutExtension(My.Application.Globix.CURRENT_WORKFILE)) - Case "Username".ToUpper - oNamenkonvention = oNamenkonvention.Replace(oElement.Value, Environment.UserName) - Case "Usercode".ToUpper - oNamenkonvention = oNamenkonvention.Replace(oElement.Value, My.Application.User.ShortName) - Case "" - End Select - If datetemp <> "" Then - oNamenkonvention = oNamenkonvention.Replace(oElement.Value, datetemp) - End If - NewFileString = oNamenkonvention - Case "[%Version]".ToUpper - Try - Dim version As Integer = 1 - Dim Stammname As String = oRAWZielordner & "\" & oNamenkonvention.Replace(oElement.Value, "") - Dim _neuername As String = oRAWZielordner & "\" & oNamenkonvention.Replace(oElement.Value, "") - Stammname = _neuername.Replace(My.Application.Globix.VERSION_DELIMITER, "") - _neuername = _neuername.Replace(My.Application.Globix.VERSION_DELIMITER, "") - 'Dim MoveFilename As String = DATEINAME.Replace(element.Value, "") - 'Überprüfen ob File existiert - If File.Exists(_neuername) = False Then - NewFileString = _neuername - Else - Do While File.Exists(_neuername) - version = version + 1 - _neuername = Stammname.Replace(extension, "") & My.Application.Globix.VERSION_DELIMITER & version & extension - NewFileString = _neuername - Loop - End If - Catch ex As Exception - _Logger.Warn(" - Unexpected error in NameGenerieren - Fehler: " & vbNewLine & ex.Message) - _Logger.Error(ex.Message) - MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in Umbenennnen der Datei:") - err = True - End Try - Case Else - _Logger.Info(" - Achtung - in der Namenkonvention wurde ein Element gefunden welches nicht zugeordnet werden kann!" & vbNewLine & "Elementname: " & oElement.Value.ToUpper) - MsgBox("Achtung - in der Namenkonvention wurde ein Element gefunden welches nicht zugeordnet werden kann!" & vbNewLine & "Elementname: " & oElement.Value.ToUpper, MsgBoxStyle.Exclamation, "Unexpected error in Name generieren:") - End Select - Next - - My.Application.Globix.CURRENT_NEWFILENAME = oFilesystem.GetCleanFilename(NewFileString) - 'CURRENT_NEWFILENAME = ClassFilehandle.CleanFilename(NewFileString, "") - My.Application.Globix.CURRENT_NEWFILENAME = Path.Combine(oRAWZielordner, My.Application.Globix.CURRENT_NEWFILENAME) - - _Logger.Debug("#### ENDE Name_Generieren ####") - _Logger.Debug("") - If err = False Then - Return True - Else - Return False - End If - - Catch ex As Exception - _Logger.Warn(" - Unvorhergesehener Unexpected error in Name_Generieren - Fehler: " & vbNewLine & ex.Message) - _Logger.Error(ex.Message) - MsgBox(ex.Message, MsgBoxStyle.Critical, "Allgemeiner Unexpected error in Name_Generieren:") - Return False - End Try - - End Function - Private Function Move_File2_Target() - Dim oError As Boolean - Try - Dim oFolderForIndex = My.Helpers.GetValueFromDatatable(My.Application.Globix.CURR_DT_DOCTYPE, $"", "FOLDER_FOR_INDEX", "") - - If Not IsDBNull(oFolderForIndex) Then - CreateFolderForIndex(oFolderForIndex) - Else - CreateFolderForIndex(String.Empty) - End If - - Dim oIDBImportResult As Boolean = False - 'Variable Folder - If DropType = "|DROPFROMFSYSTEM|" Or DropType = "|OUTLOOK_ATTACHMENT|" Or DropType = "|ATTMNTEXTRACTED|" Or DropType = "|FW_SIMPLEINDEXER|" Then - oIDBImportResult = ImportFile2IDB() - - ' oExportSuccessful = SINGLEFILE_2_WINDREAM(My.Application.Globix.CURR_D) - ElseIf DropType = "|OUTLOOK_MESSAGE|" Or DropType = "|FW_MSGONLY|" Or DropType = "|MSGONLY|" Or DropType = "|FW_OUTLOOK_MESSAGE|" Then - oIDBImportResult = ImportFile2IDB() - End If - If oIDBImportResult = True Then - - 'Kein Fehler in Export2windream - oError = False - If Write_Indizes() = True Then - 'Kein Fehler in Setzen der windream-Indizes - Dim Insert_String As String - Try - Dim tempCur_WF = My.Application.Globix.CURRENT_WORKFILE.Replace("'", "''") - Dim tempCur_New_FN = My.Application.Globix.CURRENT_NEWFILENAME.Replace("'", "''") - Insert_String = sql_history_INSERT_INTO & ",ADDED_WHO) VALUES ('" & tempCur_WF & "','" & tempCur_New_FN & "'" & sql_history_Index_Values & ",'" & Environment.UserDomainName & "\" & Environment.UserName & "')" - My.DatabaseECM.ExecuteNonQuery(Insert_String) - If DropType.Contains("MSG") Or DropType = "|ATTMNTEXTRACTED|" Or DropType = "|OUTLOOK_ATTACHMENT|" Then - If My.Application.Globix.CURRENT_MESSAGEID <> "" Then - Dim max As String = "SELECT MAX(GUID) FROM TBGI_HISTORY" - Dim GUID = My.DatabaseECM.GetScalarValue(max) - Try - If GUID > 0 Then - Dim sqlUpdate As String - If DropType = "|ATTMNTEXTRACTED|" Or DropType = "|OUTLOOK_ATTACHMENT|" Then - sqlUpdate = "Update TBGI_HISTORY SET ATTACHMENT = 1, MSG_ID = '" & My.Application.Globix.CURRENT_MESSAGEID & "' WHERE GUID = " & GUID - My.DatabaseECM.ExecuteNonQuery(sqlUpdate) - Else - sqlUpdate = "Update TBGI_HISTORY SET ATTACHMENT = 0, MSG_ID = '" & My.Application.Globix.CURRENT_MESSAGEID & "' WHERE GUID = " & GUID - My.DatabaseECM.ExecuteNonQuery(sqlUpdate) - End If - End If - Catch ex As Exception - _Logger.Error(ex) - End Try - End If - End If - - Catch ex As Exception - _Logger.Error(ex) - MsgBox("Error in Insert-History - View logfile: " & ex.Message, MsgBoxStyle.Critical) - _Logger.Warn(" - Unexpected error in Insert-History - Fehler: " & vbNewLine & ex.Message) - _Logger.Warn(" - Unexpected error in Insert-History - SQL: " & Insert_String) - oError = True - End Try - Else - oError = True - End If - Else - oError = True - NI_TYPE = "ERROR" - If My.Application.User.Language = "de-DE" Then - NI_TITLE = "Fehler Globix-Import" - NI_MESSAGE = "Der Import war nicht erfolgreich - Check LogFile" - Else - NI_TITLE = "Error Globix-Import" - NI_MESSAGE = "The import was not successful - Check LogFile" - End If - - MsgBox(NI_MESSAGE, MsgBoxStyle.Critical, NI_TITLE) - End If - - 'False oder True zurückgeben - 'Kein Fehler aufgetreten - If oError = False Then - Return True - Else - 'Fehler aufgetreten - Return False - End If - Catch ex As Exception - _Logger.Error(ex) - MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected Error in Move File2Target:") - Return False - End Try - End Function - Private Function ImportFile2IDB() As Boolean - Try - If Move_File(My.Application.Globix.CURRENT_WORKFILE, My.Application.Globix.CURRENT_NEWFILENAME, My.Application.Globix.CURRENT_WORKFILE_EXTENSION, My.Application.Globix.VERSION_DELIMITER) = True Then - Dim oEXEC As String = $"EXEC PRIDB_ADD_DOC_FROM_FOLDER '{My.Application.Globix.CURRENT_NEWFILENAME}','{My.Application.User.UserName}'" - Dim oDTRESULT As DataTable = My.DatabaseIDB.GetDatatable(oEXEC) - If IsNothing(oDTRESULT) Then - Return False - Else - If oDTRESULT.Rows.Count = 0 Then - Return False - Else - My.Application.Globix.CURRENT_IDB_OBJ_ID = oDTRESULT.Rows(0).Item(0) - Return True - End If - End If - Else - Return False - End If - Catch ex As Exception - _Logger.Error(ex) - Return False - End Try - End Function - Function Move_File(Quelle As String, _NewFilename As String, extension As String, _versionTz As String) As Boolean - 'Überprüfen ob File existiert - My.Application.Globix.CURRENT_NEWFILENAME = _FileEx.GetVersionedFilename(_NewFilename) - - Dim opath = Path.GetDirectoryName(My.Application.Globix.CURRENT_NEWFILENAME) - If Directory.Exists(opath) = False Then - Directory.CreateDirectory(opath) - End If - - 'Die Datei wird nun an den neuen Ort kopiert - My.Computer.FileSystem.MoveFile(My.Application.Globix.CURRENT_WORKFILE, My.Application.Globix.CURRENT_NEWFILENAME) - - Dim Insert_String As String - Try - Dim tempCur_WF = My.Application.Globix.CURRENT_WORKFILE.Replace("'", "''") - Dim tempCur_New_FN = My.Application.Globix.CURRENT_NEWFILENAME.Replace("'", "''") - Insert_String = sql_history_INSERT_INTO & ",ADDED_WHO,ADDED_WHERE) VALUES ('" & tempCur_WF & "','" & tempCur_New_FN & "'" & sql_history_Index_Values & ",'" & Environment.UserDomainName & "\" & Environment.UserName & "','" & Environment.MachineName & "')" - If My.DatabaseECM.ExecuteNonQuery(Insert_String) = True Then - If My.Application.Globix.CURRENT_MESSAGEID <> "" Then - Dim oMax As String = "SELECT MAX(GUID) FROM TBGI_HISTORY" - Dim oGUID = My.DatabaseECM.GetScalarValue(oMax) - Try - If oGUID > 0 Then - Dim oSql As String - If My.Application.Globix.CURRENT_ISATTACHMENT = True Then - oSql = "Update TBGI_HISTORY SET ATTACHMENT = 1, MSG_ID = '" & My.Application.Globix.CURRENT_MESSAGEID & "' WHERE GUID = " & oGUID - My.DatabaseECM.GetScalarValue(oSql) - Else - oSql = "Update TBGI_HISTORY SET ATTACHMENT = 0, MSG_ID = '" & My.Application.Globix.CURRENT_MESSAGEID & "' WHERE GUID = " & oGUID - My.DatabaseECM.GetScalarValue(oSql) - End If - End If - Catch ex As Exception - - End Try - End If - End If - Return True - Catch ex As Exception - _Logger.Error(ex.Message) - _Logger.Warn(" - Unexpected error in Move_Rename - Insert_String: " & Insert_String) - Return False - End Try - End Function - Private Function Write_Indizes() - Try - Dim oSetVariableOK As Boolean = False - Dim oAttributeValue As String - Dim oAttributeName As String - 'Manuelle Indexe Indexieren - If My.Application.Globix.CURR_DT_MAN_INDEXE.Rows.Count > 0 Then - Dim Count As Integer = 0 - For Each row As DataRow In My.Application.Globix.CURR_DT_MAN_INDEXE.Rows - - oAttributeValue = row.Item("IndexValueGUI") - oAttributeName = row.Item("WD_INDEX").ToString - _Logger.Debug($"Write_Indizes - Index [{oAttributeName}]...") - Dim oIsOptional = CBool(row.Item("OPTIONAL")) - Dim oIndexed = CBool(row.Item("Indexed")) - If oIndexed And oAttributeValue.ToString <> "" And oAttributeValue <> "EMPTY_OI" Then - If oAttributeName <> String.Empty Then - If row.Item("SAVE_VALUE") = True Then - 'Den Indexwert zwischenspeichern - Dim oDTIndexResults As DataTable = GlobixDataset.TBTEMP_INDEXRESULTS - Dim rowexists As Boolean = False - For Each rowTemp As DataRow In oDTIndexResults.Rows - 'Wenn bereits ein Eintrag existiert..... - If rowTemp.Item("Dokumentart") = row.Item("DOKUMENTART") And rowTemp.Item("Indexname") = row.Item("INDEXNAME") Then - rowexists = True - '......überschreiben - rowTemp.Item("Value") = row.Item("IndexValueGUI") - End If - Next - '.....ansonsten neu anlegen - If rowexists = False Then - Dim newRow As DataRow = oDTIndexResults.NewRow() - newRow("Dokumentart") = row.Item("DOKUMENTART").ToString - newRow("Indexname") = row.Item("INDEXNAME").ToString - newRow("Value") = row.Item("IndexValueGUI") - oDTIndexResults.Rows.Add(newRow) - End If - End If - End If - _Logger.Debug($"Manueller Indexvalue [{oAttributeValue.ToString}]...NOW THE INDEXING...") - Count += 1 - ' den Typ des Zielindexes auslesen - Dim oIndexType As Integer = _idbdata.GetTypeOfIndex(oAttributeName) - _Logger.Debug($"oIndexType [{oIndexType.ToString}]...") - _Logger.Debug($"Indexing oIndexType < 8...") - oSetVariableOK = _idbdata.SetVariableValue(oAttributeName, oAttributeValue) - - 'indexierung_erfolgreich = ClassWindream.DateiIndexieren(CURRENT_NEWFILENAME, indexname, idxvalue) - If oSetVariableOK = False Then - MsgBox("Error in Indexing file - See log", MsgBoxStyle.Critical) - Return False - Exit For - End If - Else - _Logger.Debug("No Indexing Attributename: " & oAttributeName) - _Logger.Debug("is optional? " & oIsOptional.ToString) - End If - 'Else - '_Logger.Debug("Indexvalue is empty or field is not indexed - Indexname: " & oAttributeName) - '_Logger.Info("Indexvalue is empty or field is not indexed - Indexname: " & oAttributeName) - 'End If - Next - - End If - oSetVariableOK = False - 'Automatische Indexe Indexieren - If My.Application.Globix.CURR_DT_AUTO_INDEXE.Rows.Count > 0 Then - Dim Count As Integer = 0 - For Each row As DataRow In My.Application.Globix.CURR_DT_AUTO_INDEXE.Rows - oSetVariableOK = CBool(row.Item("Indexed")) - oAttributeValue = row.Item("IndexValueGUI").ToString - oAttributeName = row.Item("INDEXNAME").ToString - If oSetVariableOK = True And oAttributeValue <> "" Then - If oAttributeValue <> "EMPTY_OI" Then - _Logger.Info("Auto Indexname: " & oAttributeName.ToString) - _Logger.Info("oAttributeValue: " & oAttributeValue.ToString) - Count += 1 - ' den Typ des Zielindexes auslesen - Dim indexType As Integer = _idbdata.GetTypeOfIndex(oAttributeName) - oSetVariableOK = _idbdata.SetVariableValue(oAttributeName, oAttributeValue) - - If oSetVariableOK = False Then - MsgBox("Error in indexing file - See log", MsgBoxStyle.Critical) - Return False - Exit For - End If - End If - End If - Next - End If - If DropType = "|OUTLOOK_MESSAGE|" Or DropType = "|FW_MSGONLY|" Or DropType = "|MSGONLY|" Or My.Application.Globix.CURRENT_NEWFILENAME.EndsWith(".msg") Then - oSetVariableOK = SetEmailIndices() - If oSetVariableOK = False Then - MsgBox("Error in SetEmailIndices - See log", MsgBoxStyle.Critical) - Return False - End If - ElseIf DropType = "|ATTMNTEXTRACTED|" Or DropType = "|OUTLOOK_ATTACHMENT|" Then - oSetVariableOK = SetAttachmentIndices() - If oSetVariableOK = False Then - MsgBox("Error in SetEmailIndices - See log", MsgBoxStyle.Critical) - Return False - End If - End If - Return True - Catch ex As Exception - _Logger.Warn("Unexpected error in Write_Indizes - Fehler: " & vbNewLine & ex.Message) - _Logger.Error(ex.Message) - MsgBox("Error in Write_Indizes:" & vbNewLine & ex.Message, MsgBoxStyle.Critical) - Return False - End Try - - End Function - Private Function CreateFolderForIndex(DynamicFolderConfig As String) - Try - Dim oRootFolder As String = Path.GetDirectoryName(My.Application.Globix.CURRENT_NEWFILENAME) - Dim oFilesystem As New DigitalData.Modules.Filesystem.File(_LogConfig) - - - If DynamicFolderConfig <> String.Empty Then - '###### - Dim oRegexString As String = "\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}" - ' einen Regulären Ausdruck laden - Dim oRegex As Regex = New Regex(oRegexString) - ' die Vorkommen im Folder-String auslesen - Dim oMatches As MatchCollection = oRegex.Matches(DynamicFolderConfig) - '#### - - ' alle Vorkommen innerhalb des Ordnerstrings durchlaufen - For Each oMatch As Match In oMatches - _Logger.Info("Elementname in FolderString: '" & oMatch.ToString & "'") - Select Case oMatch.Value.Substring(2, 1).ToUpper - - 'Manueller Indexwert - Case "M" - Dim oManIndexName = oMatch.Value.Substring(3, oMatch.Value.Length - 4) - Dim oIsOptional As Boolean = My.Helpers.GetValueFromDatatable(My.Application.Globix.CURR_DT_MAN_INDEXE, $"DOK_ID = {My.Application.Globix.CURRENT_DOCTYPE_ID} AND INDEXNAME = '{oManIndexName}'", "OPTIONAL", "") - - _Logger.Info("Versuch den Indexwert aus '" & oManIndexName & "' auszulesen.") - Dim oManIndexValue As String = GetManIndex_Value(oManIndexName, "FILE", oIsOptional) - _Logger.Info("Ergebnis/Wert für neuen Ordner: '" & oManIndexName & "'") - If Not oManIndexValue = String.Empty Then - If IsDate(oManIndexValue) Then - oManIndexValue = CDate(oManIndexValue).ToString("yyyyMMdd") - End If - - oManIndexValue = oFilesystem.GetCleanPath(oManIndexValue) - 'oManIndexValue = ClassFilehandle.CleanFilename(oManIndexValue, "") - DynamicFolderConfig = DynamicFolderConfig.Replace(oMatch.ToString, oManIndexValue) - - _Logger.Info("FolderPattern: '" & DynamicFolderConfig & "'") - Else - - If oIsOptional = True Then - _Logger.Info("Optionaler Indexwert ist NICHT gefüllt") - DynamicFolderConfig = DynamicFolderConfig.Replace(oMatch.ToString, String.Empty) - Else - _Logger.Info(" - Achtung Ausnahme in 'CrFolderForIndex': der Index ist leer!") - Return True - End If - End If - Case "A" - Dim oAutoIndexName = oMatch.Value.Substring(3, oMatch.Value.Length - 4) - _Logger.Info("Versuch den Auto-Indexwert aus '" & oAutoIndexName & "' auszulesen.") - Dim oAutoIndexValue As String = GetAutoIndex_Value(oAutoIndexName) - _Logger.Info("Ergebnis/Wert für neuen Ordner: '" & oAutoIndexName & "'") - If Not oAutoIndexValue = String.Empty Then - - oAutoIndexValue = oFilesystem.GetCleanPath(oAutoIndexValue) - 'oAutoIndexValue = ClassFilehandle.CleanFilename(oAutoIndexValue, "") - If oAutoIndexValue = "EMPTY_OI" Then - DynamicFolderConfig = DynamicFolderConfig.Replace(oMatch.ToString, "") - Else - DynamicFolderConfig = DynamicFolderConfig.Replace(oMatch.ToString, oAutoIndexValue) - _Logger.Info("FolderPattern: '" & DynamicFolderConfig & "'") - End If - - Else - _Logger.Info(" - Achtung Ausnahme in 'CrFolderForIndex': der Index ist leer!") - End If - Case "V" - Dim oElementTemp As String - Dim _Month As String = My.Computer.Clock.LocalTime.Month - If _Month.Length = 1 Then - _Month = "0" & _Month - End If - Dim _day As String = My.Computer.Clock.LocalTime.Day - If _day.Length = 1 Then - _day = "0" & _day - End If - Dim type = oMatch.Value.Substring(3, oMatch.Value.Length - 4) - If type.StartsWith("_") Then - type = type.Replace("_", "") - End If - Select Case type - Case "YYYY/MM/DD" - oElementTemp = My.Computer.Clock.LocalTime.Year & "\" & _Month & "\" & _day - Case "YYYY/MM" - oElementTemp = My.Computer.Clock.LocalTime.Year & "\" & _Month - Case "YYYY" - oElementTemp = My.Computer.Clock.LocalTime.Year - Case "YYYY-MM" - oElementTemp = My.Computer.Clock.LocalTime.Year & "-" & _Month - End Select - DynamicFolderConfig = DynamicFolderConfig.Replace(oMatch.ToString, oElementTemp) - _Logger.Info("FolderPatter nach V-Element: '" & DynamicFolderConfig & "'") - Case Else - _Logger.Warn(" - Achtung - in der Namenkonvention wurde ein Element gefunden welches nicht zugeordnet werden kann!" & vbNewLine & "Elementname: " & oMatch.Value.ToUpper) - - If My.Application.User.Language = "de-DE" Then - MsgBox("Achtung - in der Namenkonvention wurde ein Element gefunden welches nicht zugeordnet werden kann!" & vbNewLine & "Elementname: " & oMatch.Value.ToUpper, MsgBoxStyle.Exclamation, "Unexpected error in Name generieren:") - Else - MsgBox("Attention - One element in Namingconvention could not be matched!" & vbNewLine & "Elementname: " & oMatch.Value.ToUpper, MsgBoxStyle.Exclamation, "Unexpected error in Name generieren:") - End If - End Select - Next - End If - - - - - _Logger.Info("Den Root-Folder zusammenfügen>> ") - - Dim oNewFullPath As String = System.IO.Path.Combine(oRootFolder, DynamicFolderConfig) - - _Logger.Info("Fullpath (mit evtl. Sonderzeichen (SZ)) '" & oNewFullPath & "'") - Dim invalidPathChars() As Char = Path.GetInvalidPathChars() - For Each sonderChar As Char In invalidPathChars - 'Sonderzeichen ausser Whitespace entfernen - If Char.IsWhiteSpace(sonderChar) = False Then - If oNewFullPath.Contains(sonderChar) Then - oNewFullPath = oNewFullPath.Replace(sonderChar, "") - End If - End If - Next sonderChar - ' oNewFullPath = WINDREAM.GetCleanedPath(oNewFullPath) - - _Logger.Info("Fullpath (ohne SZ) '" & oNewFullPath & "'") - If Directory.Exists(oNewFullPath) = False Then - Try - Dim oCreatedPath = Directory.CreateDirectory(oNewFullPath) - oNewFullPath = oCreatedPath.FullName - _Logger.Info("Folder '" & oNewFullPath & "' wurde angelegt") - Catch ex As Exception - _Logger.Info("Error in CreateFolderforIndex-Method - Root Folder '" & oNewFullPath & "' could not be created. " & ex.Message) - _Logger.Error(ex.Message) - MsgBox("Attention: Root Folder '" & oNewFullPath & "' could not be created." & vbNewLine & ex.Message, MsgBoxStyle.Critical) - Return False - End Try - End If - - My.Application.Globix.CURRENT_NEWFILENAME = Path.Combine(oNewFullPath, Path.GetFileName(My.Application.Globix.CURRENT_NEWFILENAME)) - - Return True - Catch ex As Exception - MsgBox("Unexpected Error in CreateFolderforIndex-Method:" & vbNewLine & ex.Message, MsgBoxStyle.Critical) - _Logger.Warn("Fehler in CrFolderForIndex: " & ex.Message) - _Logger.Error(ex) - Return False - End Try - End Function - Function GetAutoIndex_Value(indexname As String) - Try - - For Each oDataRow As DataRow In My.Application.Globix.CURR_DT_MAN_INDEXE.Rows - If oDataRow.Item("INDEXNAME").ToString.ToLower = indexname.ToLower Then - Dim oIndexWert = oDataRow.Item("IndexValueGUI") - Dim oIsIndexed = oDataRow.Item("Indexed") - - If oIsIndexed = True Then - If oIndexWert.ToString <> String.Empty Then - oIndexWert = oIndexWert.ToString - - ' If Index is a vectorfield (read: Value contains the VECTORSEPARATOR character), use the first value - If oIndexWert.Contains(ClassConstants.VECTORSEPARATOR) Then - Return oIndexWert.ToString.Split(ClassConstants.VECTORSEPARATOR).FirstOrDefault() - Else - ' Else just return the normal value - Return oIndexWert - End If - Else - ShowNotice("Der Automatische Index: " & oDataRow.Item("INDEXNAME") & " wurde nicht ordnungsgemäss indexiert!") - Return "" - End If - Else - ShowNotice("Der Automatische Index: " & oDataRow.Item("INDEXNAME") & " wurde nicht ordnungsgemäss indexiert!") - Return "" - End If - Exit For - End If - Next - Catch ex As Exception - _Logger.Warn(" - Unvorhergesehener Unexpected error in GetAutoIndex_Value - Indexname: " & indexname & " - Fehler: " & vbNewLine & ex.Message) - _Logger.Error(ex.Message) - MsgBox("Indexname: " & indexname & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Unexpected error in GetAutoIndex_Value:") - Return "" - End Try - End Function - Function GetManIndex_Value(indexname As String, RequestFor As String, opt As Boolean) - Try - - For Each DR As DataRow In My.Application.Globix.CURR_DT_MAN_INDEXE.Rows - If DR.Item("INDEXNAME").ToString.ToLower = indexname.ToLower Then - If DR.Item("Indexed") = True Then - _Logger.Info("## Manueller Index: " & indexname) - Select Case RequestFor - Case "FILE" - If DR.Item("IndexValue_File").ToString <> String.Empty Then - _Logger.Info("Es liegt ein separater nachbearbeiteter Wert für die Dateibenennung vor: " & DR.Item("IndexValue_File").ToString) - _Logger.Info("Zurückgegebener NachbearbeitungsWert: " & DR.Item("IndexValue_File")) - Return DR.Item("IndexValue_File") - Else - If DR.Item("IndexValueGUI").ToString <> String.Empty Then - _Logger.Info("Zurückgegebener manueller Indexwert: " & DR.Item("IndexValueGUI")) - Return DR.Item("IndexValueGUI") - Else - If opt = False Then - _Logger.Info("Achtung, der Indexwert des manuellen Indexes '" & indexname & "' ist String.empty!") - ShowNotice("Indexed = True - Der Index: " & DR.Item("INDEXNAME") & " wurde nicht ordnungsgemäss indexiert! - Automatischer Index konnte nicht gesetzt werden!") - Return Nothing - Else - Return "" - End If - - End If - End If - Case Else - If DR.Item("IndexValueGUI").ToString <> String.Empty Then - _Logger.Info("Zurückgegebener manueller Indexwert: " & DR.Item("IndexValueGUI")) - Return DR.Item("IndexValueGUI") - Else - - If opt = False Then - _Logger.Info("Achtung, der Indexwert des manuellen Indexes '" & indexname & "' ist String.empty!") - ShowNotice("Indexiert = True - Der Index: " & DR.Item("INDEXNAME") & " wurde nicht ordnungsgemäss indexiert! - Automatischer Index konnte nicht gesetzt werden!") - Return Nothing - Else - Return "" - End If - End If - End Select - Else - ShowNotice("Der Index: " & DR.Item("INDEXNAME") & " wurde nicht ordnungsgemäss indexiert! - Automatischer Index konnte nicht gesetzt werden!") - Return Nothing - End If - Exit For - End If - Next - Catch ex As Exception - _Logger.Warn(" - Unvorhergesehener Unexpected error in GetManIndex_Value - Fehler: " & vbNewLine & ex.Message) - _Logger.Error(ex.Message) - MsgBox("Indexname: " & indexname & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Unexpected error in GetManIndex_Value:") - Return Nothing - End Try - End Function - Function CheckWrite_IndexeMan(dokartid As Integer) - '#### Zuerst manuelle Werte indexieren #### - Try - _Logger.Info("In CheckWrite_IndexeMan") - Dim result 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 oIndexName = Replace(box.Name, "txt", "") - Dim optional_index As Boolean = My.Helpers.GetValueFromDatatable(My.Application.Globix.CURR_DT_MAN_INDEXE, $"DOK_ID = {dokartid} AND INDEXNAME = '{oIndexName}'", "OPTIONAL", "") - - If optional_index = False Then - MsgBox(TEXT_MISSING_INPUT, MsgBoxStyle.Exclamation, "Fehlende Eingabe:") - box.Focus() - Return False - Else - Indexwert_Postprocessing(Replace(box.Name, "txt", ""), "") - result = True - End If - Else - If Indexwert_checkValueDB(Replace(box.Name, "txt", ""), box.Text) = False Then - _Logger.Info(" - Der eingegebene Wert wurde nicht in der Datenbank gefunden") - MsgBox("Der eingegebene Wert wurde nicht in der Datenbank gefunden!", MsgBoxStyle.Exclamation, "Fehlerhafte Indexierung:") - box.Focus() - Return False - Else - Indexwert_Postprocessing(Replace(box.Name, "txt", ""), box.Text) - result = True - End If - End If - End If - - If oControl.Name.StartsWith("cmbMulti") Then - Dim oLookup = DirectCast(oControl, LookupControl3) - Dim values As List(Of String) = oLookup.Properties.SelectedValues - - If values.Count = 0 Then - Dim oIndexName = Replace(oLookup.Name, "cmbMulti", "") - Dim optional_index As Boolean = My.Helpers.GetValueFromDatatable(My.Application.Globix.CURR_DT_MAN_INDEXE, $"DOK_ID = {dokartid} AND INDEXNAME = '{oIndexName}'", "OPTIONAL", "") - - - If optional_index = False Then - MsgBox(TEXT_MISSING_INPUT, MsgBoxStyle.Exclamation, Text) - oLookup.Focus() - Return False - Else - Indexwert_Postprocessing(Replace(oLookup.Name, "cmbMulti", ""), "") - result = True - End If - Else - Dim vectorValue = String.Join(ClassConstants.VECTORSEPARATOR, values) - Indexwert_Postprocessing(Replace(oLookup.Name, "cmbMulti", ""), vectorValue) - result = True - End If - ElseIf oControl.Name.StartsWith("cmbSingle") Then - Dim cmbSingle As TextBox = oControl - - If cmbSingle.Text = "" Then - Dim oIndexName = Replace(cmbSingle.Name, "cmbSingle", "") - Dim optional_index As Boolean = My.Helpers.GetValueFromDatatable(My.Application.Globix.CURR_DT_MAN_INDEXE, $"DOK_ID = dokartid AND INDEXNAME = '{oIndexName}'", "OPTIONAL", "") - - - If optional_index = False Then - MsgBox(TEXT_MISSING_INPUT, MsgBoxStyle.Exclamation, Text) - cmbSingle.Focus() - Return False - Else - Indexwert_Postprocessing(Replace(cmbSingle.Name, "cmbSingle", ""), "") - result = True - End If - Else - Indexwert_Postprocessing(Replace(cmbSingle.Name, "cmbSingle", ""), cmbSingle.Text) - result = True - End If - ElseIf oControl.Name.StartsWith("cmb") Then - Dim cmb As ComboBox = oControl - If cmb.Text = "" Then - Dim oIndexName = Replace(cmb.Name, "cmb", "") - Dim optional_index As Boolean = My.Helpers.GetValueFromDatatable(My.Application.Globix.CURR_DT_MAN_INDEXE, $"DOK_ID = dokartid AND INDEXNAME = '{oIndexName}'", "OPTIONAL", "") - - If optional_index = False Then - MsgBox(TEXT_MISSING_INPUT, MsgBoxStyle.Exclamation, Text) - cmb.Focus() - Return False - Else - Indexwert_Postprocessing(Replace(cmb.Name, "cmb", ""), "") - result = True - End If - Else - Indexwert_Postprocessing(Replace(cmb.Name, "cmb", ""), cmb.Text) - result = 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 = My.Helpers.GetValueFromDatatable(My.Application.Globix.CURR_DT_MAN_INDEXE, $"DOK_ID = dokartid AND INDEXNAME = '{oIndexName}'", "OPTIONAL", "") - - - If optional_index = False Then - MsgBox(TEXT_MISSING_INPUT, MsgBoxStyle.Exclamation, Text) - dtp.Focus() - Return False - Else - Indexwert_Postprocessing(oIndexName, "") - result = True - End If - Else - Indexwert_Postprocessing(Replace(dtp.Name, "dtp", ""), dtp.Text) - result = True - End If - End If - If oControl.Name.StartsWith("chk") Then - Dim chk As CheckBox = oControl - Indexwert_Postprocessing(Replace(chk.Name, "chk", ""), chk.Checked) - result = True - End If - If TypeOf (oControl) Is Button Then - Continue For - End If - If oControl.Name.StartsWith("lbl") = False And result = False Then - _Logger.Info("Die Überprüfung der manuellen Indices ist fehlerhaft. Bitte informieren Sie den Systembetreuer") - Return False - End If - Next - - Return True - Catch ex As Exception - _Logger.Warn(" - Unvorhergesehener Fehler in CheckWrite_IndexeMan - Fehler: " & vbNewLine & ex.Message) - _Logger.Error(ex.Message) - MsgBox(ex.Message, MsgBoxStyle.Critical, "Unerwarteter Unexpected error in CheckWrite_IndexeMan:") - Return False - End Try - End Function - Private Function SetAttachmentIndices() - Dim indexierung_erfolgreich As Boolean = True - Try - Dim DT As DataTable = My.DatabaseECM.GetDatatable("SELECT * FROM TBGI_OBJECTTYPE_EMAIL_INDEX WHERE OBJECTTYPE = 'DEFAULT'") - If DT.Rows.Count = 1 Then - - If Not My.Application.Globix.CURRENT_MESSAGEID Is Nothing Then - If My.Application.Globix.CURRENT_MESSAGEID <> "" Then - indexierung_erfolgreich = _idbdata.SetVariableValue(DT.Rows(0).Item("IDX_EMAIL_ID").ToString, My.Application.Globix.CURRENT_MESSAGEID) - If indexierung_erfolgreich = False Then - MsgBox("Error in SetAttachmentIndices MESSAGE-ID - See log", MsgBoxStyle.Critical) - Return False - End If - End If - End If - 'Das Subject speichern - If My.Application.Globix.CURRENT_MESSAGESUBJECT <> "" Then - indexierung_erfolgreich = _idbdata.SetVariableValue(DT.Rows(0).Item("IDX_EMAIL_SUBJECT").ToString, My.Application.Globix.CURRENT_MESSAGESUBJECT) - If indexierung_erfolgreich = False Then - MsgBox("Error in SetAttachmentIndices SUBJECT - See log", MsgBoxStyle.Critical) - Return False - End If - End If - 'Das MesageDate speichern - If My.Application.Globix.CURRENT_MESSAGEDATE <> "" Then - indexierung_erfolgreich = _idbdata.SetVariableValue(DT.Rows(0).Item("IDX_EMAIL_DATE_IN").ToString, My.Application.Globix.CURRENT_MESSAGEDATE) - If indexierung_erfolgreich = False Then - MsgBox("Error in SetAttachmentIndices DATE - See log", MsgBoxStyle.Critical) - Return False - End If - End If - 'Kennzeichnen das es ein Anhang war! - indexierung_erfolgreich = _idbdata.SetVariableValue(DT.Rows(0).Item("IDX_CHECK_ATTACHMENT").ToString, True) - If indexierung_erfolgreich = False Then - MsgBox("Error in SetAttachmentIndices ATTACHMENT Y/N - See log", MsgBoxStyle.Critical) - Return False - End If - Return indexierung_erfolgreich - End If - Catch ex As Exception - _Logger.Error(ex) - MsgBox("Error in SetAttachmentIndices:" & vbNewLine & ex.Message, MsgBoxStyle.Critical) - Return False - End Try - - End Function - Function Indexwert_checkValueDB(indexname As String, wert As String) - Try - Dim oRow As DataRow - 'DT = DD_DMSLiteDataSet.VWINDEX_MAN - For Each oRow In DT_INDEXEMAN.Rows - If oRow.Item("NAME") = indexname Then - If oRow.Item("SQL_CHECK").ToString <> String.Empty Then - Dim connectionString As String - Dim sql As String - connectionString = My.DatabaseECM.Get_ConnectionStringforID(oRow.Item("CONNECTION_ID")) - If connectionString <> "" Then - Dim sqlscalar = oRow.Item("SQL_CHECK") - Select Case oRow.Item("DATENTYP") - Case "INTEGER" - sqlscalar = sqlscalar.ToString.Replace("@manValue", wert) - Case Else - sqlscalar = sqlscalar.ToString.Replace("@manValue", "'" & wert & "'") - End Select - - sql = sqlscalar - Dim ergebnis As Integer - 'If DR.Item("SQL_PROVIDER") = "Oracle" Then - ' ergebnis = ClassDatabase.OracleExecute_Scalar(sql, connectionString) - 'Else - 'MSQL - ergebnis = My.DatabaseECM.GetScalarValueWithConnection(sql, connectionString) - ' End If - - Select Case ergebnis - Case 1 - Return True - Case 2 - ShowNotice("Indexwert nicht eindeutig: " & sql) - Return False - Case 99 - Return False - End Select - - End If - Else - Return True - End If - - End If - Next - Catch ex As Exception - MsgBox("Indexname: " & indexname & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Unexpected error in Indexwert_checkValue:") - _Logger.Info(" - Unvorhergesehener Unexpected error in Indexwert_checkValue - Fehler: " & vbNewLine & ex.Message) - Return False - End Try - End Function - Function FillIndexe_Autom(dokart_id As Integer) - Try - - Dim oSQL = $"SELECT * FROM VWDDINDEX_AUTOM WHERE DOCTYPE_ID = {My.Application.Globix.CURRENT_DOCTYPE_ID}" - Dim oFilter = $"DOCTYPE_ID = {My.Application.Globix.CURRENT_DOCTYPE_ID}" - My.Application.Globix.CURR_DT_AUTO_INDEXE = _DataASorDB.GetDatatable("DD_ECM", oSQL, "VWDDINDEX_AUTOM", oFilter, "") - - - - Dim oRegex As New Regex("\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}") - - If My.Application.Globix.CURR_DT_AUTO_INDEXE.Rows.Count = 0 Then - Return True - End If - - ' 1. Schritt: Einfach-Indexe und Platzhalter ersetzen - For Each oAutoIndexRow As DataRow In My.Application.Globix.CURR_DT_AUTO_INDEXE.Rows - _Logger.Info("Working on AutomaticIndex: " & oAutoIndexRow.Item("INDEXNAME") & "...") - Dim oSqlResult As String = NotNull(oAutoIndexRow.Item("SQL_RESULT"), "") - Dim oSqlActive As Boolean = NotNull(oAutoIndexRow.Item("SQL_ACTIVE"), False) - Dim oSqlConnectionId As Integer = NotNull(oAutoIndexRow.Item("CONNECTION_ID"), -1) - Dim oSqlProvider As String = NotNull(oAutoIndexRow.Item("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 = NotNull(oAutoIndexRow.Item("VALUE"), "") - - oPlaceholderResult = GetPlaceholderValue(oValue, My.Application.Globix.CURRENT_WORKFILE, My.Application.User.ShortName) - - If Not IsNothing(oPlaceholderResult) Then - oValue = oPlaceholderResult - End If - - oAutoIndexRow.Item("Indexed") = True - oAutoIndexRow.Item("IndexValueGUI") = oValue - - Continue For - End If - - ' 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 - - ' Einfachen Platzhalter Wert erzeugen - oPlaceholderResult = GetPlaceholderValue(oIndexValue, My.Application.Globix.CURRENT_WORKFILE, My.Application.User.ShortName) - - ' Einfachen Platzhalter ersetzen - If Not IsNothing(oPlaceholderResult) Then - oSqlResult = oSqlResult.Replace(oMatch.Value, oPlaceholderResult) - End If - - oOptionalIndex = My.Helpers.GetValueFromDatatable(My.Application.Globix.CURR_DT_MAN_INDEXE, $"DOK_ID = {My.Application.Globix.CURRENT_DOCTYPE_ID} AND INDEXNAME = '{oIndexValue}'", "OPTIONAL", "") - - - 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 - - - 'TODO: Replace Windream Patterns? - oSqlResult = clsPatterns.ReplaceControlValues(oSqlResult, pnlIndex) - oSqlResult = clsPatterns.ReplaceInternalValues(oSqlResult) - If oSqlResult <> String.Empty Then - _Logger.Debug("oSqlResult after Replace [" & oSqlResult & "]") - End If - ' Ergebnis: Es wurden alle einfachen Platzhalter ersetzt, 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 Then - _Logger.Info(" There are " & oVectorMatches.Count & " matches for vectors!") - Dim oIsFirstMatch = True - - For Each oVectorMatch As Match In oVectorMatches - Dim oIndexValue As String = StripPlaceholder(oVectorMatch.Value) - Dim oOptionalIndex = False - Dim oManualIndexResult As String = Nothing - - oOptionalIndex = My.Helpers.GetValueFromDatatable(My.Application.Globix.CURR_DT_MAN_INDEXE, $"DOK_ID = {My.Application.Globix.CURRENT_DOCTYPE_ID} AND INDEXNAME = '{oIndexValue}'", "OPTIONAL", "") - - 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 - oAutoIndexRow.Item("Indexed") = True - oAutoIndexRow.Item("IndexValueGUI") = String.Join(ClassConstants.VECTORSEPARATOR, oEndResult.ToArray) - Next - Else - Dim oResult = GetAutomaticIndexSQLValue(oSqlResult, oSqlConnectionId, oSqlProvider) - _Logger.Info("Got a simple SQLResult: " & oResult.ToString) - oAutoIndexRow.Item("Indexed") = True - oAutoIndexRow.Item("IndexValueGUI") = oResult - - End If - Next - - Return True - Catch ex As Exception - _Logger.Error(ex) - MsgBox(ex.Message) - Return False - End Try - End Function - Function StripPlaceholder(Placeholder As String) As String - Dim oResult = Placeholder - oResult = Regex.Replace(oResult, "^\[%", "") - oResult = Regex.Replace(oResult, "\]$", "") - Return oResult - End Function - Function GetAutomaticIndexSQLValue(SQLCommand As String, vconnectionID As Integer, vProvider As String) As String - Try - Dim oConnectionString As String - oConnectionString = My.DatabaseECM.Get_ConnectionStringforID(vconnectionID) - If oConnectionString <> "" Then - 'NEU - Dim oErgebnis - 'Welcher Provider? - 'If vProvider.ToLower = "oracle" Then - 'oErgebnis = My.Database.leExecute_Scalar(SQLCommand, oConnectionString) - 'Else 'im Moment nur SQL-Server - oErgebnis = My.DatabaseECM.GetScalarValueWithConnection(SQLCommand, oConnectionString) - 'End If - _Logger.Debug("SQL-ConnectionString: " & oConnectionString.Substring(0, oConnectionString.LastIndexOf("="))) - If oErgebnis Is Nothing Then - 'showlblhinweis("Kein Ergebnis für automatisches SQL: " & vsqlstatement) - Return "" - Else - Return oErgebnis - End If - End If - - Catch ex As Exception - _Logger.Warn(" - Unexpected error in Get_AutomatischerIndex_SQL - Fehler: " & vbNewLine & ex.Message) - _Logger.Error(ex.Message) - MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in Get_AutomatischerIndex_SQL:") - Return "" - End Try - End Function - Sub Indexwert_Postprocessing(indexname As String, wert_in As String) - Try - - Dim value_post As String = "" - For Each oDataRow As DataRow In My.Application.Globix.CURR_DT_MAN_INDEXE.Rows - If oDataRow.Item("INDEXNAME") = indexname Then - Dim idxid As Integer = oDataRow.Item("GUID") - If idxid > 0 Then - ' In jedem Fall schon mal den Wert einfügen - oDataRow.Item("IndexValueGUI") = wert_in - 'Die Nachbearbeitungsschritte laden - 'FILE AND INDEX - 'Zuerst nur die Fälle für die Variante ONLY FILE/FOLDER - Dim DTNB As DataTable = My.Helpers.GetFilteredDatatable(My.Application.Globix.CURR_INDEX_MAN_POSTPROCESSING, $"IDXMAN_ID = {idxid} AND VARIANT = 'ONLY FILE/FOLDER'", "SEQUENCE") - - If DTNB Is Nothing = False Then - If DTNB.Rows.Count > 0 Then - value_post = clsPostProcessing.Get_Nachbearbeitung_Wert(wert_in, DTNB) - oDataRow.Item("IndexValueGUI") = value_post - oDataRow.Item("IndexValue_File") = value_post - End If - End If - 'Jetzt die Fälle für die Variante FILE AND INDEX - DTNB = Nothing - - DTNB = My.Helpers.GetFilteredDatatable(My.Application.Globix.CURR_INDEX_MAN_POSTPROCESSING, "IDXMAN_ID = " & idxid & " AND VARIANT = 'FILE AND INDEX'", "SEQUENCE") - - If DTNB Is Nothing = False Then - If DTNB.Rows.Count > 0 Then - value_post = clsPostProcessing.Get_Nachbearbeitung_Wert(wert_in, DTNB) - oDataRow.Item("IndexValueGUI") = value_post - End If - End If - End If - oDataRow.Item("Indexed") = True - End If - Next - Catch ex As Exception - _Logger.Warn(" - Unvorhergesehener Unexpected error in Indexwert_Postprocessing - Indexname: " & indexname & " - Fehler: " & vbNewLine & ex.Message) - _Logger.Error(ex.Message) - MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in Indexwert_Postprocessing:") - End Try - End Sub - - - - Private Function SetEmailIndices() - Dim indexierung_erfolgreich As Boolean = False - Dim _step As String = "1" - Try - Dim msg As Msg.Message = New Msg.Message(My.Application.Globix.CURRENT_NEWFILENAME) - Dim msgDisplayTo = msg.DisplayTo - Dim msgInternetAccountName = msg.InternetAccountName - - _Logger.Debug("") - _Logger.Debug("msgInternetAccountName: " & msgInternetAccountName) - _Logger.Debug("SenderName: " & msg.SenderName) - _Logger.Debug("SenderEmailAddress: " & msg.SenderEmailAddress) - _Logger.Debug("ReceivedByName: " & msg.ReceivedByName) - _Logger.Debug("ReceivedByEmailAddress: " & msg.ReceivedByEmailAddress) - _Logger.Debug("") - - _step = "2" - - Dim fromPattern As String = "" - Dim toPattern As String = "" - Dim messageIDPattern As String = "" - Dim finalize_pattern As String = "" - - ' Email Header auslesen - Dim headers As String = ClassEmailHeaderExtractor.getMessageHeaders(msg) - - For Each rowregex As DataRow In My.Application.Globix.DT_FUNCTION_REGEX.Rows - If rowregex.Item("FUNCTION_NAME") = "FROM_EMAIL_HEADER" Then - fromPattern = rowregex.Item("REGEX") - ElseIf rowregex.Item("FUNCTION_NAME") = "TO_EMAIL_HEADER" Then - toPattern = rowregex.Item("REGEX") - ElseIf rowregex.Item("FUNCTION_NAME") = "MESSAGE_ID" Then - messageIDPattern = rowregex.Item("REGEX") - ElseIf rowregex.Item("FUNCTION_NAME") = "FINALIZE" Then - finalize_pattern = rowregex.Item("REGEX") - End If - Next - - Dim DT As DataTable = My.DatabaseECM.GetDatatable("SELECT * FROM TBGI_OBJECTTYPE_EMAIL_INDEX WHERE OBJECTTYPE = 'DEFAULT'") - If IsNothing(DT) Then - _Logger.Info("SELECT * FROM TBGI_OBJECTTYPE_EMAIL_INDEX RESULTED in NOTHING") - Return False - End If - If DT.Rows.Count = 1 Then - _step = "3" - My.Application.Globix.CURRENT_MESSAGEDATE = "" - My.Application.Globix.CURRENT_MESSAGESUBJECT = "" - 'Message-ID nur auswerten wenn vorher nicht gestzt wurde! - If My.Application.Globix.CURRENT_MESSAGEID = "" Then - If Not msg.InternetMessageId Is Nothing Then - indexierung_erfolgreich = _idbdata.SetVariableValue(DT.Rows(0).Item("IDX_EMAIL_ID").ToString, msg.InternetMessageId) - - 'Die aktuelle Message-ID zwischenspeichern - My.Application.Globix.CURRENT_MESSAGEID = msg.InternetMessageId - If indexierung_erfolgreich = False Then - MsgBox("Error in SetEmailIndices-EmailID - See log", MsgBoxStyle.Critical) - Return False - End If - Else - If messageIDPattern = String.Empty Then - _Logger.Info("A messageID could not be read!") - Else - If Not IsNothing(headers) Then - My.Application.Globix.CURRENT_MESSAGEID = ClassEmailHeaderExtractor.extractFromHeader(headers, messageIDPattern) - If IsNothing(My.Application.Globix.CURRENT_MESSAGEID) Then - My.Application.Globix.CURRENT_MESSAGEID = "" - End If - Else - _Logger.Info("A messageID could not be read - messageheader nothing/messagIDpattern value!") - End If - End If - - End If - Else - indexierung_erfolgreich = _idbdata.SetVariableValue(DT.Rows(0).Item("IDX_EMAIL_ID").ToStrin, My.Application.Globix.CURRENT_MESSAGEID) - If indexierung_erfolgreich = False Then - MsgBox("Error in SetEmailIndices-EmailID - See log", MsgBoxStyle.Critical) - Return False - End If - End If - _step = "4" - ' Regular Expressions vorbereiten - - If fromPattern <> "" And toPattern <> "" Then - _step = "4.1" - Dim FromRegexList As New List(Of Regex) - Dim ToRegexList As New List(Of Regex) - Dim fromRegex As New Regex(fromPattern, RegexOptions.IgnoreCase) - Dim toRegex As New Regex(toPattern, RegexOptions.IgnoreCase) - - FromRegexList.Add(fromRegex) - ToRegexList.Add(toRegex) - - - Dim emailFrom - Dim emailTo - ' Email Absender und Empfänger - If headers Is Nothing Then - _step = "4.2" - If IsNothing(msgDisplayTo) Then - _step = "4.3" - _Logger.Info("DisplayTo in email is nothing - default will be set") - emailTo = "NO RECIPIENT" - Else - _step = "4.4" - emailTo = msgDisplayTo.ToString.Replace("'", "") - End If - If IsNothing(msgInternetAccountName) Then - _step = "4.5" - _Logger.Info("InternetAccountName in email is nothing - default will be set") - emailFrom = "" - Else - _step = "4.6" - emailFrom = msgInternetAccountName.ToString.Replace("'", "") - End If - Else - _step = "5" - _Logger.Info("emailTo and From Extraction via messageheader.") - emailFrom = ClassEmailHeaderExtractor.extractFromHeader(headers, fromPattern) 'FromRegexList) - - emailTo = ClassEmailHeaderExtractor.extractFromHeader(headers, toPattern) ' extractToAddress(headers, ToRegexList) - - 'Handler für leere emailTo-Adresse - If IsNothing(emailTo) Then - _step = "5.1" - _Logger.Info("emailTo couldn't be extracted from messageheader...") - If (headers.Contains("exc") Or headers.Contains("exchange")) Then - _step = "5.2" - _Logger.Info("...try with LDAP-option") - Dim _email = GetUserEmailfromLDAP(msgDisplayTo) - _step = "5.3" - If _email <> "" Then - emailTo = _email - Else - _Logger.Info(">> email-adress couldn't be read from LDAP with name '" & msgDisplayTo & "'") - MsgBox("Could't get 'emailto' from messageHeader and later on with LDAP-Option." & vbNewLine & "Please check the dropped email and Configuration of Email-Indexing!", MsgBoxStyle.Exclamation) - Return False - End If - Else - _step = "5.4" - CURR_MISSING_PATTERN_NAME = "Email To" - CURR_MISSING_SEARCH_STRING = headers - CURR_MISSING_MANUAL_VALUE = String.Empty - frmGlobixMissingInput.ShowDialog() - _step = "5.4.1" - If CURR_MISSING_MANUAL_VALUE <> String.Empty Then - _step = "5.4.2" - emailTo = CURR_MISSING_MANUAL_VALUE - Else - _step = "5.4.3" - _Logger.Info("no exchange patterns found in headers!") - MsgBox("Could't get 'emailto' from messageHeader and exhange-Patterns weren't found." & vbNewLine & "Please check the dropped email and Configuration of Email-Indexing!", MsgBoxStyle.Exclamation) - Return False - End If - - End If - End If - _step = "6" - emailTo = ClassEmailHeaderExtractor.extractFromHeader(emailTo, finalize_pattern) - emailFrom = ClassEmailHeaderExtractor.extractFromHeader(emailFrom, finalize_pattern) - _step = "6.1" - If Not IsNothing(emailFrom) Then - emailFrom = emailFrom.Replace("<", "") - emailFrom = emailFrom.Replace(">", "") - Else - _step = "6.1.x" - _Logger.Info("emailFrom is Nothing?!") - End If - - If Not IsNothing(emailTo) Then - _step = "6.1.1 " & emailTo.ToString - emailTo = emailTo.Replace("<", "") - emailTo = emailTo.Replace(">", "") - _step = "6.2" - Dim _duplicatesCheck As List(Of String) = New List(Of String) - _duplicatesCheck = emailTo.ToString.Split(";").ToList - ' Filter distinct elements, and convert back into list. - Dim result As List(Of String) = _duplicatesCheck.Distinct().ToList - ' Display result. - Dim i As Integer = 0 - For Each element As String In result - If i = 0 Then - emailTo = element - Else - emailTo = emailTo & ";" & element - End If - i += 1 - Next - Else - _step = "6.3" - _Logger.Info("emailTo is Nothing?!") - End If - - _Logger.Info("Headers-Content: ") - _Logger.Info(headers.ToString) - End If - 'Handler für leere emailFrom-Adresse - If IsNothing(emailFrom) Then - _step = "7" - _Logger.Info("emailFrom couldn't be extracted from messageheader...") - If Not IsNothing(msg.SenderEmailAddress) Then - If msg.SenderEmailAddress <> String.Empty Then - _step = "7.1" - _Logger.Info("emailFrom via msg.SenderEmailAddress will be used instead!") - emailFrom = msg.SenderEmailAddress.ToString.Replace("'", "") - End If - End If - End If - If IsNothing(emailFrom) Or emailFrom = String.Empty Then - _step = "7.2" - CURR_MISSING_PATTERN_NAME = "Email From" - CURR_MISSING_SEARCH_STRING = emailFrom - CURR_MISSING_MANUAL_VALUE = String.Empty - frmGlobixMissingInput.ShowDialog() - If CURR_MISSING_MANUAL_VALUE <> String.Empty Then - _step = "7.3" - emailFrom = CURR_MISSING_MANUAL_VALUE - Else - MsgBox("Could't get 'emailfrom' from messageHeader." & vbNewLine & "Please check the dropped email and Configuration of Email-Indexing!", MsgBoxStyle.Exclamation) - Return False - End If - End If - - _Logger.Info("emailFrom: " & emailFrom) - _Logger.Info("emailTo: " & emailTo) - 'FROM - If Not IsNothing(emailFrom) Then - indexierung_erfolgreich = _idbdata.SetVariableValue(DT.Rows(0).Item("IDX_EMAIL_FROM").ToString, emailFrom) - If indexierung_erfolgreich = False Then - MsgBox("Error in SetEmailIndices [emailFrom] - See log", MsgBoxStyle.Critical) - Return False - End If - Else - _Logger.Info("emailFrom is still Nothing?!") - _step = "7.4" - End If - 'TO - If Not IsNothing(emailTo) Then - indexierung_erfolgreich = _idbdata.SetVariableValue(DT.Rows(0).Item("IDX_EMAIL_TO").ToString, emailTo) - If indexierung_erfolgreich = False Then - MsgBox("Error in SetEmailIndices [emailTo] - See log", MsgBoxStyle.Critical) - Return False - End If - Else - _Logger.Info("emailTo is still Nothing?!") - _step = "7.5" - End If - - ' Dim subj As String = ClassFormFunctions.CleanInput(msg.Subject) - Dim subj As String = msg.Subject - If IsNothing(subj) Or subj = "" Then - _Logger.Info("msg subject is empty...DEFAULT will be set") - subj = "No subject" - MsgBox("Attention: Email was send without a subject - Default value 'No subject' will be used!", MsgBoxStyle.Exclamation) - Else - subj = encode_utf8(msg.Subject) - If IsNothing(subj) Then - subj = msg.Subject - End If - End If - - _Logger.Info("Now all email-items will be indexed!") - - _Logger.Info("subj: " & subj) - indexierung_erfolgreich = _idbdata.SetVariableValue(DT.Rows(0).Item("IDX_EMAIL_SUBJECT").ToString, subj) - My.Application.Globix.CURRENT_MESSAGESUBJECT = subj - If indexierung_erfolgreich = False Then - MsgBox("Error in SetEmailIndices [Subject] - See log", MsgBoxStyle.Critical) - Return False - End If - _Logger.Info("MessageDeliveryTime: " & msg.MessageDeliveryTime) - indexierung_erfolgreich = _idbdata.SetVariableValue(DT.Rows(0).Item("IDX_EMAIL_DATE_IN").ToString, msg.MessageDeliveryTime) - My.Application.Globix.CURRENT_MESSAGEDATE = msg.MessageDeliveryTime - If indexierung_erfolgreich = False Then - MsgBox("Error in SetEmailIndices [Datein] - See log", MsgBoxStyle.Critical) - Return False - End If - Else - indexierung_erfolgreich = False - End If - - Return indexierung_erfolgreich - End If - Catch ex As Exception - MsgBox("Error in SetEmailIndices:" & vbNewLine & ex.Message & vbNewLine & "Please check the configuration Email-Indexing!", MsgBoxStyle.Critical) - _Logger.Warn("Error in SetEmailIndices (Step finisched: " & _step & "): " & ex.Message) - _Logger.Error(ex) - Return False - End Try - End Function - Public Function GetUserEmailfromLDAP(ByVal userName As String) As String - - Dim domainName As String = Environment.UserDomainName '"PutYourDomainNameHere" '< Change this value to your actual domain name. For example: "yahoo" - Dim dommain As String = "com" '> Unexpected Error in GetUserEmail from LDAP: " & ex.Message) - _Logger.Error(ex) - End Try - End Using - - Return userEmail - - End Function - - Private Sub btnAblageFlow_Click(sender As Object, e As EventArgs) Handles btnAblageFlow.Click - GlobixFlow() - End Sub - - Private Async Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click - Dim oDokart As DocType = cmbDocType.SelectedItem - Dim oResult = Await GlobixFlowNew(oDokart) - If oResult = True Then - CancelAttempts = MaxCancelAttempts + CancelAttempts = MAX_CANCEL_ATTEMPTS Close() End If End Sub - Private Async Function GlobixFlowNew(pDocType As DocType) As Threading.Tasks.Task(Of Boolean) - Try - ClearError() - ClearNotice() - Cursor = Cursors.WaitCursor - - Dim oValidator As New ClassValidator(My.LogConfig, My.Application.Service.Client) - If oValidator.ValidateControls(pnlIndex, pDocType) = False Then - Return False - End If - - Dim oValues = oValidator.GetControlValues(pnlIndex) - - Dim oFileName As String = My.Application.Globix.CURRENT_WORKFILE - Dim oObjectStore As String = "WORK" - Dim oObjectKind As String = "DOC" - Dim oBusinessEntity As String = "DEFAULT" - Dim oProfileId As Integer = My.Application.Globix.CURRENT_DOCTYPE_ID - Dim oAttributes As List(Of UserAttributeValue) = oValues - Dim oOptions As New Modules.EDMI.API.Options.ImportFileOptions - - Await My.Application.Service.Client.ImportFileAsync(oFileName, oProfileId, oAttributes, oObjectStore, oObjectKind, oBusinessEntity, oOptions) - - MsgBox("Die Datei wurde erfolgreich verarbeitet!", MsgBoxStyle.Information, Text) - - Return True - Catch ex As Exception - _Logger.Error(ex) - MsgBox("Indexierung fehlgeschlagen!", MsgBoxStyle.Critical, Text) - Return False - - Finally - Cursor = Cursors.Default - - End Try - End Function - - + Private Sub PreviewItem_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles PreviewItem.CheckedChanged + SetFilePreview(PreviewItem.Checked) + End Sub End Class diff --git a/GUIs.ZooFlow/ModuleHelpers.vb b/GUIs.ZooFlow/ModuleHelpers.vb index 21fe76ee..28f794b9 100644 --- a/GUIs.ZooFlow/ModuleHelpers.vb +++ b/GUIs.ZooFlow/ModuleHelpers.vb @@ -30,20 +30,12 @@ Module ModuleHelpers End Try End Function - Public Function CheckSpecialSigns(ByVal str As String) - Try - Dim pattern As String = "[!""#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~\s]" - Dim matches As MatchCollection = Regex.Matches(str, pattern) - Return matches.Count - Catch ex As Exception - MsgBox("Unexpected error in CheckSpecialSigns: " & ex.Message, MsgBoxStyle.Critical) - Return 0 - End Try - End Function - Public Sub Refresh_RegexTable() + + Public Sub NNRefresh_RegexTable() Dim oSQL = "select * from TBGI_FUNCTION_REGEX" My.Application.Globix.DT_FUNCTION_REGEX = clsDataASorDB.GetDatatable("DD_ECM", oSQL, "TBGI_FUNCTION_REGEX", "", "") End Sub + Public Function GetConnectionString(id As Integer) Dim connectionString As String = "" Try diff --git a/GUIs.ZooFlow/My Project/Resources.Designer.vb b/GUIs.ZooFlow/My Project/Resources.Designer.vb index 4239c406..13c4376f 100644 --- a/GUIs.ZooFlow/My Project/Resources.Designer.vb +++ b/GUIs.ZooFlow/My Project/Resources.Designer.vb @@ -500,6 +500,16 @@ Namespace My.Resources End Get End Property + ''' + ''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage. + ''' + Friend ReadOnly Property actions_send() As DevExpress.Utils.Svg.SvgImage + Get + Dim obj As Object = ResourceManager.GetObject("actions_send", resourceCulture) + Return CType(obj,DevExpress.Utils.Svg.SvgImage) + End Get + End Property + ''' ''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage. ''' diff --git a/GUIs.ZooFlow/My Project/Resources.resx b/GUIs.ZooFlow/My Project/Resources.resx index ae0d358c..ec3eb74e 100644 --- a/GUIs.ZooFlow/My Project/Resources.resx +++ b/GUIs.ZooFlow/My Project/Resources.resx @@ -118,6 +118,12 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\actions_addcircled2.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + + ..\Resources\actions_database.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + ..\Resources\save5.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a @@ -142,12 +148,6 @@ ..\Resources\save.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\actions_deletecircled6.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - - ..\Resources\editquery.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - ..\Resources\Checked-outforEdit_Color_13297.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -157,8 +157,8 @@ ..\Resources\definednameuseinformula.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\action_add_16xLG.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\gear_32xLG.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\DD_Icons_ICO_PMANAGER_128px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -175,14 +175,8 @@ ..\Resources\about2.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\del.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - - ..\Resources\StatusAnnotations_Stop_16xLG_color.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\actions_addcircled4.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\renamedatasource.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a ..\Resources\actions_check5.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a @@ -193,6 +187,9 @@ ..\Resources\actions_window.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\pagesetup.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + ..\Resources\ZOO_FLOW_ sysicon_256.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -208,6 +205,9 @@ ..\Resources\CW_GEFUNDEN_klein.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\actions_check2.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + ..\Resources\definednameuseinformula1.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a @@ -247,12 +247,15 @@ ..\Resources\save2.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\doublenext.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - ..\Resources\del1.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\1_LOGO_ZOO_FLOW.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\CW_klein.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\Checked-outforEdit_13297.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -262,21 +265,18 @@ ..\Resources\2_LUPE_INAKTIV_ZOO.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\actions_check1.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + ..\Resources\editnames.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\about.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - ..\Resources\actions_addcircled5.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a ..\Resources\about1.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\save3.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - ..\Resources\save7.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a @@ -298,8 +298,8 @@ ..\Resources\DD_Icons_ICO_PMANAGER_256px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\ZooFlow_CW_DevExpress.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\save4.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a ..\Resources\ZooFlow-25.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -307,11 +307,11 @@ ..\Resources\insertsheet.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\3_PERSON_INAKTIV_ZOO.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\ZooFlow_CW_DevExpress.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\actions_addcircled2.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\actions_edit.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a ..\Resources\actions_edit2.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a @@ -331,35 +331,35 @@ ..\Resources\about3.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\pagesetup.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\doublenext.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a ..\Resources\actions_add1.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\3_PERSON_AKTIV_ZOO.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\del3.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\bo_appearance.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\actions_check6.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a ..\Resources\actions_deletecircled2.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\4_GLOBIX_AKTIV_ZOO.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\del4.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\2_ZOO_FLOW_Abo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\actions_addcircled4.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a ..\Resources\bo_document.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\save4.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\about.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a ..\Resources\pagesetup1.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a @@ -373,6 +373,9 @@ ..\Resources\actions_deletecircled4.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\1_LOGO_ZOO_FLOW_DROP2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\ZooFlow_G_DevExpress.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a @@ -382,23 +385,23 @@ ..\Resources\1_LOGO_ZOO_FLOW1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\actions_edit.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\StatusAnnotations_Stop_16xLG_color.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\actions_deletecircled1.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\actions_check1.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\editquery.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\CW_klein.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\3_PERSON_AKTIV_ZOO.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\actions_edit1.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\actions_check2.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\bo_appearance.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a ..\Resources\actions_addcircled1.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a @@ -406,29 +409,29 @@ ..\Resources\crossdatasourcefiltering.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\actions_check6.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\Flow.PNG;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\4_GLOBIX_AKTIV_ZOO.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\save3.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\actions_deletecircled.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\actions_deletecircled6.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\Flow.PNG;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\2_ZOO_FLOW_Abo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\bo_appearance1.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\actions_database.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\3_PERSON_INAKTIV_ZOO.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\highimportance.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\renamedatasource.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\action_add_16xLG.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\2_LUPE_AKTIV_ZOO.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -442,16 +445,16 @@ ..\Resources\windows.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\1_LOGO_ZOO_FLOW_DROP2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\actions_deletecircled.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\1_LOGO_ZOO_FLOW.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\del.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a ..\Resources\GLOBIX_short.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\gear_32xLG.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\actions_send.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a \ No newline at end of file diff --git a/GUIs.ZooFlow/My Project/Settings.Designer.vb b/GUIs.ZooFlow/My Project/Settings.Designer.vb index 3fa2f2eb..0cc188f0 100644 --- a/GUIs.ZooFlow/My Project/Settings.Designer.vb +++ b/GUIs.ZooFlow/My Project/Settings.Designer.vb @@ -73,17 +73,6 @@ Partial Friend NotInheritable Class Settings End Get End Property - _ - Public ReadOnly Property ECMConnectionStringDEFAULT() As String - Get - Return CType(Me("ECMConnectionStringDEFAULT"),String) - End Get - End Property - _ + Public ReadOnly Property ECMConnectionStringDEFAULT() As String + Get + Return CType(Me("ECMConnectionStringDEFAULT"),String) + End Get + End Property End Class Namespace My diff --git a/GUIs.ZooFlow/My Project/Settings.settings b/GUIs.ZooFlow/My Project/Settings.settings index ca8890e2..0dee0401 100644 --- a/GUIs.ZooFlow/My Project/Settings.settings +++ b/GUIs.ZooFlow/My Project/Settings.settings @@ -13,13 +13,6 @@ True - - <?xml version="1.0" encoding="utf-16"?> -<SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <ConnectionString>Data Source=SDD-VMP04-SQL17\DD_DEVELOP01;Initial Catalog=DD_ECM_TEST;User ID=sa;Password=dd</ConnectionString> -</SerializableConnectionString> - Data Source=SDD-VMP04-SQL17\DD_DEVELOP01;Initial Catalog=DD_ECM_TEST;User ID=sa;Password=dd - <?xml version="1.0" encoding="utf-16"?> <SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> @@ -31,5 +24,12 @@ + + <?xml version="1.0" encoding="utf-16"?> +<SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <ConnectionString>Data Source=SDD-VMP04-SQL17\DD_DEVELOP01;Initial Catalog=DD_ECM;User ID=sa;Password=dd</ConnectionString> +</SerializableConnectionString> + Data Source=SDD-VMP04-SQL17\DD_DEVELOP01;Initial Catalog=DD_ECM;User ID=sa;Password=dd + \ No newline at end of file diff --git a/GUIs.ZooFlow/MyDataset.Designer.vb b/GUIs.ZooFlow/MyDataset.Designer.vb index 0ddc0859..96706fc2 100644 --- a/GUIs.ZooFlow/MyDataset.Designer.vb +++ b/GUIs.ZooFlow/MyDataset.Designer.vb @@ -1662,7 +1662,7 @@ Namespace DSClipboardWatcherTableAdapters Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")> _ Private Sub InitConnection() Me._connection = New Global.System.Data.SqlClient.SqlConnection() - Me._connection.ConnectionString = Global.DigitalData.GUIs.ZooFlow.Settings.Default.DD_ECMConnectionString + Me._connection.ConnectionString = Global.DigitalData.GUIs.ZooFlow.Settings.Default.ECMConnectionStringDEFAULT End Sub _ Private Sub InitConnection() Me._connection = New Global.System.Data.SqlClient.SqlConnection() - Me._connection.ConnectionString = Global.DigitalData.GUIs.ZooFlow.Settings.Default.DD_ECMConnectionString + Me._connection.ConnectionString = Global.DigitalData.GUIs.ZooFlow.Settings.Default.ECMConnectionStringDEFAULT End Sub - + - + SELECT GUID, NAME, REGEX_EXPRESSION, COMMENT, ACTIVE, PROFILE_TYPE, PROC_NAME, USER_ID, GROUP_ID FROM dbo.VWCW_USER_PROFILE @@ -33,7 +33,7 @@ - + DELETE FROM [dbo].[TBCW_PROFILES] WHERE (([GUID] = @Original_GUID) AND ([NAME] = @Original_NAME) AND ((@IsNull_COMMENT = 1 AND [COMMENT] IS NULL) OR ([COMMENT] = @Original_COMMENT)) AND ([REGEX_EXPRESSION] = @Original_REGEX_EXPRESSION) AND ([ADDED_WHO] = @Original_ADDED_WHO) AND ((@IsNull_ADDED_WHEN = 1 AND [ADDED_WHEN] IS NULL) OR ([ADDED_WHEN] = @Original_ADDED_WHEN)) AND ((@IsNull_CHANGED_WHO = 1 AND [CHANGED_WHO] IS NULL) OR ([CHANGED_WHO] = @Original_CHANGED_WHO)) AND ((@IsNull_CHANGED_WHEN = 1 AND [CHANGED_WHEN] IS NULL) OR ([CHANGED_WHEN] = @Original_CHANGED_WHEN)) AND ([ACTIVE] = @Original_ACTIVE) AND ([PROFILE_TYPE] = @Original_PROFILE_TYPE)) diff --git a/GUIs.ZooFlow/Resources/actions_send.svg b/GUIs.ZooFlow/Resources/actions_send.svg new file mode 100644 index 00000000..c0372ba0 --- /dev/null +++ b/GUIs.ZooFlow/Resources/actions_send.svg @@ -0,0 +1,15 @@ + + + + + + + \ No newline at end of file diff --git a/GUIs.ZooFlow/ZooFlow.vbproj b/GUIs.ZooFlow/ZooFlow.vbproj index 1a4248df..fb193a44 100644 --- a/GUIs.ZooFlow/ZooFlow.vbproj +++ b/GUIs.ZooFlow/ZooFlow.vbproj @@ -244,6 +244,8 @@ Form + + True @@ -336,8 +338,6 @@ Form - - @@ -943,6 +943,9 @@ + + +