From c9a667d5f264c6a8fd5357c7004168453c62293f Mon Sep 17 00:00:00 2001 From: OlgunR Date: Thu, 7 May 2026 14:35:29 +0200 Subject: [PATCH] Clean up frmIndex.vb: remove legacy and unused code Removed large blocks of commented-out legacy code, redundant imports, and obsolete alternatives throughout frmIndex.vb. Simplified logic for Multi-Indexing UI, file handling, and folder creation by retaining only active code. These changes improve readability and maintainability without altering functionality. --- Global_Indexer/frmIndex.vb | 1526 +----------------------------------- 1 file changed, 2 insertions(+), 1524 deletions(-) diff --git a/Global_Indexer/frmIndex.vb b/Global_Indexer/frmIndex.vb index f829b73..ece054e 100644 --- a/Global_Indexer/frmIndex.vb +++ b/Global_Indexer/frmIndex.vb @@ -4,18 +4,13 @@ Imports System.Text Imports System.Text.RegularExpressions Imports DevExpress.XtraEditors Imports DevExpress.XtraEditors.Controls -Imports DevExpress.XtraSpreadsheet.TileLayout Imports DigitalData.Controls.LookupGrid Imports DigitalData.GUIs.Common Imports DigitalData.GUIs.GlobalIndexer Imports DigitalData.Modules.Base -'Imports System.Security.Principal Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Windream -Imports GdPicture.Internal.MSOfficeBinary.translator.Spreadsheet.XlsFileFormat.Records Imports Limilabs.Mail -'Imports DevExpress.DataAccess.Native.Json -'Imports GdPicture.Internal.MSOfficeBinary.translator.Spreadsheet.XlsFileFormat.Records Public Class frmIndex #Region "+++++ Variablen ++++++" @@ -123,9 +118,6 @@ Public Class frmIndex '#Region "+++++ Allgemeine Funktionen ++++++" Sub ShowError(text As String) - 'lblerror.Visible = True - 'lblerror.Text = text - 'lblerror.ForeColor = Color.Red labelError.Visibility = DevExpress.XtraBars.BarItemVisibility.Always labelError.Caption = text End Sub @@ -136,8 +128,6 @@ Public Class frmIndex End Sub Sub ShowNotice(text As String) - 'lblhinweis.Visible = True - 'lblhinweis.Text = text labelNotice.Visibility = DevExpress.XtraBars.BarItemVisibility.Always labelNotice.Caption = text End Sub @@ -197,7 +187,6 @@ Public Class frmIndex Function Indexwert_checkValueDB(indexname As String, wert As String) Try Dim DR As DataRow - 'DT = DD_DMSLiteDataSet.VWINDEX_MAN For Each DR In DT_INDEXEMAN.Rows If DR.Item("NAME") = indexname Then If DR.Item("SQL_CHECK").ToString <> String.Empty Then @@ -350,7 +339,6 @@ Public Class frmIndex Dim oErgebnis 'Welcher Provider? If vProvider.ToLower = "oracle" Then - 'oErgebnis = ClassDatabase.OracleExecute_Scalar(SQLCommand, oConnectionString) LOGGER.Warn("Oracle Database Queries are not supported") Else 'im Moment nur SQL-Server oErgebnis = DATABASE_ECM.GetScalarValueWithConnection(SQLCommand, oConnectionString) @@ -361,7 +349,6 @@ Public Class frmIndex End If If oErgebnis Is Nothing Then - 'showlblhinweis("Kein Ergebnis für automatisches SQL: " & vsqlstatement) Return "" Else Return oErgebnis @@ -374,392 +361,6 @@ Public Class frmIndex End Try End Function - '#End Region - '#Region "+++++ Funktionen bei OK - schliessen ++++++" - 'Function CheckWrite_IndexeMan(oDocumentTypeId As Integer) - ' '#### Zuerst manuelle Werte indexieren #### - - ' Try - ' _Logger.Info("In CheckWrite_IndexeMan") - - ' DxErrorProvider1.ClearErrors() - - ' Dim oResult As Boolean = False - ' For Each oControl As Control In Me.pnlIndex.Controls - ' ' MsgBox(ctrl.Name) - ' If oControl.Name.StartsWith("txt") Then - ' Dim box As DevExpress.XtraEditors.TextEdit = oControl - ' If box.Text = "" Then - ' Dim optional_index As Boolean = DATABASE_ECM.GetScalarValue("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & oDocumentTypeId & " AND NAME = '" & Replace(box.Name, "txt", "") & "'") - ' If optional_index = False Then - - ' If USER_LANGUAGE = LANG_DE Then - ' 'MsgBox(TEXT_MISSING_INPUT_DE, MsgBoxStyle.Exclamation, "Fehlende Eingabe:") - ' DxErrorProvider1.SetError(box, TEXT_MISSING_INPUT_DE) - ' Else - ' 'MsgBox(TEXT_MISSING_INPUT_EN, MsgBoxStyle.Exclamation, "Missing Input:") - ' DxErrorProvider1.SetError(box, TEXT_MISSING_INPUT_EN) - ' End If - - ' box.Focus() - ' Return False - ' Else - ' DxErrorProvider1.SetError(box, "") - ' Indexwert_Postprocessing(Replace(box.Name, "txt", ""), "") - ' oResult = True - ' End If - ' Else - ' If Indexwert_checkValueDB(Replace(box.Name, "txt", ""), box.Text) = False Then - ' Dim oMessage, oTitle As String - - ' If USER_LANGUAGE = LANG_DE Then - ' oTitle = "Fehlerhafte Indexierung:" - ' oMessage = "Der eingegebene Wert wurde nicht in der Datenbank gefunden!" - ' Else - ' oTitle = "Erroneous Indexing:" - ' oMessage = "The value was not found in the Database!" - ' End If - - ' _Logger.Info(oMessage) - ' DxErrorProvider1.SetError(box, oMessage) - ' box.Focus() - ' Return False - ' Else - ' DxErrorProvider1.SetError(box, "") - ' Indexwert_Postprocessing(Replace(box.Name, "txt", ""), box.Text) - ' oResult = True - ' End If - ' End If - ' End If - - ' If oControl.Name.StartsWith("cmbMulti") Then - ' Dim oLookup = DirectCast(oControl, DigitalData.Controls.LookupGrid.LookupControl3) - ' Dim oValues As List(Of String) = oLookup.Properties.SelectedValues - - ' If oValues.Count = 0 Then - ' Dim oIsOptionalIndex As Boolean = DATABASE_ECM.GetScalarValue("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & oDocumentTypeId & " AND NAME = '" & Replace(oLookup.Name, "cmbMulti", "") & "'") - - ' If oIsOptionalIndex = False Then - ' If USER_LANGUAGE = LANG_DE Then - ' 'MsgBox(TEXT_MISSING_INPUT_DE, MsgBoxStyle.Exclamation, Text) - ' DxErrorProvider1.SetError(oLookup, TEXT_MISSING_INPUT_DE) - ' Else - ' 'MsgBox(TEXT_MISSING_INPUT_EN, MsgBoxStyle.Exclamation, Text) - ' DxErrorProvider1.SetError(oLookup, TEXT_MISSING_INPUT_EN) - ' End If - - ' oLookup.Focus() - ' Return False - ' Else - ' DxErrorProvider1.SetError(oLookup, "") - ' Indexwert_Postprocessing(Replace(oLookup.Name, "cmbMulti", ""), "") - ' oResult = True - ' End If - ' Else - ' DxErrorProvider1.SetError(oLookup, "") - ' Dim vectorValue = String.Join(ClassConstants.VECTORSEPARATOR, oValues) - ' Indexwert_Postprocessing(Replace(oLookup.Name, "cmbMulti", ""), vectorValue) - ' oResult = True - ' End If - ' ElseIf oControl.Name.StartsWith("cmbSingle") Then - ' Dim cmbSingle As TextBox = oControl - - ' If cmbSingle.Text = "" Then - ' Dim optional_index As Boolean = DATABASE_ECM.GetScalarValue("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & oDocumentTypeId & " AND NAME = '" & Replace(cmbSingle.Name, "cmbSingle", "") & "'") - - ' If optional_index = False Then - ' If USER_LANGUAGE = LANG_DE Then - ' 'MsgBox(TEXT_MISSING_INPUT_DE, MsgBoxStyle.Exclamation, Text) - ' DxErrorProvider1.SetError(cmbSingle, TEXT_MISSING_INPUT_DE) - ' Else - ' 'MsgBox(TEXT_MISSING_INPUT_EN, MsgBoxStyle.Exclamation, Text) - ' DxErrorProvider1.SetError(cmbSingle, TEXT_MISSING_INPUT_EN) - ' End If - ' cmbSingle.Focus() - ' Return False - ' Else - ' DxErrorProvider1.SetError(cmbSingle, "") - ' Indexwert_Postprocessing(Replace(cmbSingle.Name, "cmbSingle", ""), "") - ' oResult = True - ' End If - ' Else - ' Indexwert_Postprocessing(Replace(cmbSingle.Name, "cmbSingle", ""), cmbSingle.Text) - ' oResult = True - ' End If - ' ElseIf oControl.Name.StartsWith("cmb") Then - ' Dim cmb As ComboBox = oControl - ' If cmb.Text = "" Then - ' Dim optional_index As Boolean = DATABASE_ECM.GetScalarValue("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & oDocumentTypeId & " AND NAME = '" & Replace(cmb.Name, "cmb", "") & "'") - ' If optional_index = False Then - ' If USER_LANGUAGE = LANG_DE Then - ' 'MsgBox(TEXT_MISSING_INPUT_DE, MsgBoxStyle.Exclamation, Text) - ' DxErrorProvider1.SetError(cmb, TEXT_MISSING_INPUT_DE) - ' Else - ' 'MsgBox(TEXT_MISSING_INPUT_EN, MsgBoxStyle.Exclamation, Text) - ' DxErrorProvider1.SetError(cmb, TEXT_MISSING_INPUT_EN) - ' End If - ' cmb.Focus() - ' Return False - ' Else - ' DxErrorProvider1.SetError(cmb, "") - ' Indexwert_Postprocessing(Replace(cmb.Name, "cmb", ""), "") - ' oResult = True - ' End If - ' Else - ' DxErrorProvider1.SetError(cmb, "") - ' Indexwert_Postprocessing(Replace(cmb.Name, "cmb", ""), cmb.Text) - ' oResult = True - ' End If - ' End If - ' If oControl.Name.StartsWith("dtp") Then - ' Dim dtp As DevExpress.XtraEditors.DateEdit = oControl - ' Dim oIndexName As String = Replace(dtp.Name, "dtp", "") - - ' If dtp.Text = String.Empty Then - ' Dim optional_index As Boolean = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {oDocumentTypeId} AND NAME = '{oIndexName}'") - - ' If optional_index = False Then - ' If USER_LANGUAGE = LANG_DE Then - ' 'MsgBox(TEXT_MISSING_INPUT_DE, MsgBoxStyle.Exclamation, Text) - ' DxErrorProvider1.SetError(dtp, TEXT_MISSING_INPUT_DE) - ' Else - ' 'MsgBox(TEXT_MISSING_INPUT_EN, MsgBoxStyle.Exclamation, Text) - ' DxErrorProvider1.SetError(dtp, TEXT_MISSING_INPUT_EN) - ' End If - ' dtp.Focus() - ' Return False - ' Else - ' DxErrorProvider1.SetError(dtp, "") - ' Indexwert_Postprocessing(oIndexName, "") - ' oResult = True - ' End If - ' Else - ' DxErrorProvider1.SetError(dtp, "") - ' Indexwert_Postprocessing(Replace(dtp.Name, "dtp", ""), dtp.Text) - ' oResult = True - ' End If - ' End If - ' If oControl.Name.StartsWith("chk") Then - ' Dim chk As CheckEdit = oControl - ' DxErrorProvider1.SetError(chk, "") - ' Indexwert_Postprocessing(Replace(chk.Name, "chk", ""), chk.Checked) - ' oResult = True - ' End If - ' If TypeOf (oControl) Is Button Then - ' Continue For - ' End If - ' If oControl.Name.StartsWith("lbl") = False And oResult = False Then - ' _Logger.Info(TEXT_CHECK_MANUAL_INDEXES_EN) - ' Return False - ' End If - ' Next - - ' Return True - ' Catch ex As Exception - ' ShowErrorMessage(ex, "CheckWrite_IndexeMan") - ' Return False - ' End Try - 'End Function - - 'Function CheckWrite_IndexeMan(oDocumentTypeId As Integer) As Boolean - ' _Logger.Info("In CheckWrite_IndexeMan") - - ' DxErrorProvider1.ClearErrors() - ' Dim oResult As Boolean = False - - ' For Each oControl As Control In Me.pnlIndex.Controls - ' ' Uninteressante Controls überspringen - ' If TypeOf oControl Is System.Windows.Forms.Label OrElse - ' TypeOf oControl Is Button OrElse - ' TypeOf oControl Is Panel Then - ' Continue For - ' End If - - ' ' Textfelder (TextEdit) - ' If oControl.Name.StartsWith("txt") Then - ' Dim txt = TryCast(oControl, DevExpress.XtraEditors.TextEdit) - ' If txt IsNot Nothing AndAlso DxErrorProvider1.GetError(txt) = "" Then - ' oResult = True - ' End If - - ' ' Kombinationsfelder (Multi oder Single Select) - ' ElseIf oControl.Name.StartsWith("cmbMulti") OrElse oControl.Name.StartsWith("cmbSingle") OrElse oControl.Name.StartsWith("cmb") Then - ' Dim cmb = TryCast(oControl, DevExpress.XtraEditors.LookUpEdit) - ' If cmb IsNot Nothing AndAlso DxErrorProvider1.GetError(cmb) = "" Then - ' oResult = True - ' End If - - ' ' Datumsauswahl - ' ElseIf oControl.Name.StartsWith("dtp") Then - ' Dim dtp = TryCast(oControl, DevExpress.XtraEditors.DateEdit) - ' If dtp IsNot Nothing AndAlso DxErrorProvider1.GetError(dtp) = "" Then - ' oResult = True - ' End If - - ' ' Checkboxen - ' ElseIf oControl.Name.StartsWith("chk") Then - ' Dim chk = TryCast(oControl, CheckBox) - ' If chk IsNot Nothing AndAlso DxErrorProvider1.GetError(chk) = "" Then - ' oResult = True - ' End If - - ' ' Sonstiges Control (Debug-Ausgabe) - ' Else - ' _Logger.Warn($"Unbekanntes oder nicht unterstütztes Steuerelement gefunden: {oControl.Name} ({oControl.GetType().Name})") - ' End If - ' Next - - ' If Not oResult Then - ' _Logger.Info(TEXT_CHECK_MANUAL_INDEXES_EN) - ' Return False - ' End If - - ' Return True - 'End Function - - 'Function CheckWrite_IndexeMan(oDocumentTypeId As Integer) As Boolean - ' Try - ' _Logger.Info("In CheckWrite_IndexeMan") - - ' DxErrorProvider1.ClearErrors() - - ' Dim oResult As Boolean = False - - ' For Each oControl As Control In Me.pnlIndex.Controls - - ' ' Labels ignorieren - ' If TypeOf oControl Is System.Windows.Forms.Label Then - ' Continue For - ' End If - - ' ' Textfelder (TextEdit) - ' If oControl.Name.StartsWith("txt") Then - ' Dim box As DevExpress.XtraEditors.TextEdit = DirectCast(oControl, DevExpress.XtraEditors.TextEdit) - ' Dim indexName As String = Replace(box.Name, "txt", "") - ' If box.Text = "" Then - ' Dim optional_index As Boolean = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {oDocumentTypeId} AND NAME = '{indexName}'") - ' If Not optional_index Then - ' DxErrorProvider1.SetError(box, If(USER_LANGUAGE = LANG_DE, TEXT_MISSING_INPUT_DE, TEXT_MISSING_INPUT_EN)) - ' box.Focus() - ' Return False - ' End If - ' Indexwert_Postprocessing(indexName, "") - ' Else - ' If Not Indexwert_checkValueDB(indexName, box.Text) Then - ' Dim msg As String = If(USER_LANGUAGE = LANG_DE, "Der eingegebene Wert wurde nicht in der Datenbank gefunden!", "The value was not found in the Database!") - ' _Logger.Info(msg) - ' DxErrorProvider1.SetError(box, msg) - ' box.Focus() - ' Return False - ' End If - ' Indexwert_Postprocessing(indexName, box.Text) - ' End If - ' oResult = True - ' Continue For - ' End If - - ' ' Multi-Combo (LookupControl3) - ' If oControl.Name.StartsWith("cmbMulti") Then - ' Dim oLookup = DirectCast(oControl, DigitalData.Controls.LookupGrid.LookupControl3) - ' Dim oValues As List(Of String) = oLookup.Properties.SelectedValues - ' Dim indexName As String = Replace(oLookup.Name, "cmbMulti", "") - - ' If oValues.Count = 0 Then - ' Dim optional_index As Boolean = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {oDocumentTypeId} AND NAME = '{indexName}'") - ' If Not optional_index Then - ' DxErrorProvider1.SetError(oLookup, If(USER_LANGUAGE = LANG_DE, TEXT_MISSING_INPUT_DE, TEXT_MISSING_INPUT_EN)) - ' oLookup.Focus() - ' Return False - ' End If - ' Indexwert_Postprocessing(indexName, "") - ' Else - ' Dim vectorValue As String = String.Join(ClassConstants.VECTORSEPARATOR, oValues) - ' Indexwert_Postprocessing(indexName, vectorValue) - ' End If - ' oResult = True - ' Continue For - ' End If - - ' ' Single-Combo (TextBox als Dropdown?) - ' If oControl.Name.StartsWith("cmbSingle") Then - ' Dim cmbSingle As System.Windows.Forms.TextBox = DirectCast(oControl, System.Windows.Forms.TextBox) - ' Dim indexName As String = Replace(cmbSingle.Name, "cmbSingle", "") - ' If cmbSingle.Text = "" Then - ' Dim optional_index As Boolean = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {oDocumentTypeId} AND NAME = '{indexName}'") - ' If Not optional_index Then - ' DxErrorProvider1.SetError(cmbSingle, If(USER_LANGUAGE = LANG_DE, TEXT_MISSING_INPUT_DE, TEXT_MISSING_INPUT_EN)) - ' cmbSingle.Focus() - ' Return False - ' End If - ' Indexwert_Postprocessing(indexName, "") - ' Else - ' Indexwert_Postprocessing(indexName, cmbSingle.Text) - ' End If - ' oResult = True - ' Continue For - ' End If - - ' ' Standard-ComboBox - ' If oControl.Name.StartsWith("cmb") Then - ' Dim cmb As System.Windows.Forms.ComboBox = DirectCast(oControl, System.Windows.Forms.ComboBox) - ' Dim indexName As String = Replace(cmb.Name, "cmb", "") - ' If cmb.Text = "" Then - ' Dim optional_index As Boolean = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {oDocumentTypeId} AND NAME = '{indexName}'") - ' If Not optional_index Then - ' DxErrorProvider1.SetError(cmb, If(USER_LANGUAGE = LANG_DE, TEXT_MISSING_INPUT_DE, TEXT_MISSING_INPUT_EN)) - ' cmb.Focus() - ' Return False - ' End If - ' Indexwert_Postprocessing(indexName, "") - ' Else - ' Indexwert_Postprocessing(indexName, cmb.Text) - ' End If - ' oResult = True - ' Continue For - ' End If - - ' ' DatePicker - ' If oControl.Name.StartsWith("dtp") Then - ' Dim dtp As DevExpress.XtraEditors.DateEdit = DirectCast(oControl, DevExpress.XtraEditors.DateEdit) - ' Dim indexName As String = Replace(dtp.Name, "dtp", "") - ' If dtp.Text = "" Then - ' Dim optional_index As Boolean = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {oDocumentTypeId} AND NAME = '{indexName}'") - ' If Not optional_index Then - ' DxErrorProvider1.SetError(dtp, If(USER_LANGUAGE = LANG_DE, TEXT_MISSING_INPUT_DE, TEXT_MISSING_INPUT_EN)) - ' dtp.Focus() - ' Return False - ' End If - ' Indexwert_Postprocessing(indexName, "") - ' Else - ' Indexwert_Postprocessing(indexName, dtp.Text) - ' End If - ' oResult = True - ' Continue For - ' End If - - ' ' Checkbox - ' If oControl.Name.StartsWith("chk") Then - ' Dim chk As DevExpress.XtraEditors.CheckEdit = DirectCast(oControl, DevExpress.XtraEditors.CheckEdit) - ' Dim indexName As String = Replace(chk.Name, "chk", "") - ' Indexwert_Postprocessing(indexName, chk.Checked) - ' oResult = True - ' Continue For - ' End If - - ' ' Buttons ignorieren - ' If TypeOf oControl Is System.Windows.Forms.Button Then - ' Continue For - ' End If - ' Next - - ' Return True - - ' Catch ex As Exception - ' ShowErrorMessage(ex, "CheckWrite_IndexeMan") - ' Return False - ' End Try - 'End Function - Function CheckWrite_IndexeMan(oDocumentTypeId As Integer) As Boolean Try _Logger.Info("In CheckWrite_IndexeMan") @@ -1066,7 +667,7 @@ Public Class frmIndex If _day.Length = 1 Then _day = "0" & _day End If - Dim type = oElement.Value '.ToUpper.Replace("[v%", "") + Dim type = oElement.Value type = type.Replace("[%v_", "") type = type.Replace("[%v", "") type = type.Replace("]", "") @@ -1106,7 +707,6 @@ Public Class frmIndex Dim _neuername As String = oRAWZielordner & "\" & oNamenkonvention.Replace(oElement.Value, "") Stammname = _neuername.Replace(VERSION_DELIMITER, "") _neuername = _neuername.Replace(VERSION_DELIMITER, "") - 'Dim MoveFilename As String = DATEINAME.Replace(element.Value, "") 'Überprüfen ob File existiert If File.Exists(_neuername) = False Then NewFileString = _neuername @@ -1130,7 +730,6 @@ Public Class frmIndex Next CURRENT_NEWFILENAME = FILESYSTEM.GetCleanFilename(NewFileString) - 'CURRENT_NEWFILENAME = ClassFilehandle.CleanFilename(NewFileString, "") CURRENT_NEWFILENAME = Path.Combine(oRAWZielordner, CURRENT_NEWFILENAME) _Logger.Debug("#### ENDE Name_Generieren ####") @@ -1147,179 +746,6 @@ Public Class frmIndex End Try End Function - 'Private Function Write_Indizes() As Boolean - ' Try - - ' _Logger.Info("Indexing file [{0}]", CURRENT_NEWFILENAME) - - ' Dim indexierung_erfolgreich As Boolean = False - ' 'Manuelle Indexe Indexieren - ' Dim DTMan As DataTable = MyDataset.VWDDINDEX_MAN - ' If DTMan.Rows.Count > 0 Then - ' Dim Count As Integer = 0 - ' For Each row As DataRow In DTMan.Rows - ' Dim idxvalue = row.Item("Indexwert") - ' Dim indexname = row.Item("WD_INDEX").ToString - ' _Logger.Debug($"Write_Indizes - Index [{indexname}]...") - ' Dim optional_Index = CBool(row.Item("OPTIONAL")) - ' Dim indexiert = CBool(row.Item("Indexiert")) - ' If indexiert And idxvalue.ToString <> "" And idxvalue <> "EMPTY_OI" Then - ' If indexname <> String.Empty Then - ' If row.Item("SAVE_VALUE") = True Then - ' 'Den Indexwert zwischenspeichern - ' Dim DTTemp As DataTable = MyDataset.TBTEMP_INDEXRESULTS - ' Dim rowexists As Boolean = False - ' For Each rowTemp As DataRow In DTTemp.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("Indexwert") - ' End If - ' Next - ' '.....ansonsten neu anlegen - ' If rowexists = False Then - ' Dim newRow As DataRow = DTTemp.NewRow() - ' newRow("Dokumentart") = row.Item("DOKUMENTART").ToString - ' newRow("Indexname") = row.Item("INDEXNAME").ToString - ' newRow("Value") = row.Item("Indexwert") - ' DTTemp.Rows.Add(newRow) - ' End If - ' End If - - ' _Logger.Debug($"Manueller Indexvalue [{idxvalue}]...NOW THE INDEXING...") - ' Count += 1 - - - ' ' den Typ des Zielindexes auslesen - ' Dim oIndexType As Integer = WINDREAM.GetIndexType(indexname) - ' _Logger.Debug($"oIndexType [{oIndexType}]...") - ' If oIndexType = 0 Then - ' MsgBox("Could not get the windream-indextype. Check Your Configuration", MsgBoxStyle.Information, "Attention") - ' Return False - ' End If - ' If oIndexType > 4095 Then - ' _Logger.Debug($"Indexing Vektor - oIndexType [{oIndexType}] ...") - ' Dim oSplitArray = Split(idxvalue, ClassConstants.VECTORSEPARATOR) - ' Dim oListofString As New List(Of String) - ' 'If oSplitArray.Length <= 1 Then - ' ' indexierung_erfolgreich = WINDREAM.SetFileIndex(CURRENT_NEWFILENAME, indexname, idxvalue, CURR_DOKART_OBJECTTYPE) - ' 'Else - ' For Each oStr In oSplitArray - ' oListofString.Add(oStr) - ' Next - ' indexierung_erfolgreich = WINDREAM.SetFileIndexLoS(CURRENT_NEWFILENAME, indexname, oListofString, CURR_DOKART_OBJECTTYPE) - ' 'End If - - ' Else - ' indexierung_erfolgreich = WINDREAM.SetFileIndex(CURRENT_NEWFILENAME, indexname, idxvalue, CURR_DOKART_OBJECTTYPE) - ' End If - - ' 'indexierung_erfolgreich = ClassWindream.DateiIndexieren(CURRENT_NEWFILENAME, indexname, idxvalue) - ' If indexierung_erfolgreich = False Then - ' MsgBox("Error in Indexing file - See log", MsgBoxStyle.Critical) - ' Return False - ' Exit For - ' End If - ' Else - - ' _Logger.Debug("No Indexing: indexname: " & indexname) - ' _Logger.Debug("No Indexing: is optional? " & optional_Index.ToString) - ' End If - ' Else - ' _Logger.Debug("Indexvalue is empty or field is not indexed - Indexname: " & indexname) - ' _Logger.Info("Indexvalue is empty or field is not indexed - Indexname: " & indexname) - ' End If - ' Next - - ' End If - ' 'Automatische Indexe Indexieren - ' Dim DTAut As DataTable = MyDataset.VWDDINDEX_AUTOM - ' If DTAut.Rows.Count > 0 Then - ' _Logger.Debug(" #### Es gibt automatische Atrribute - Anzahl: " & DTAut.Rows.Count.ToString & " #####") - ' Dim Count As Integer = 0 - ' For Each row As DataRow In DTAut.Rows - ' Dim oIsIndexed = CBool(row.Item("Indexiert")) - ' Dim oIndexValue = row.Item("Indexwert").ToString - ' Dim oIndexName = row.Item("INDEXNAME").ToString - ' Dim oOverwrite As Boolean = row.ItemEx("VKT_OVERWRITE", False) - ' Dim oPreventMultipleValues As Boolean = row.ItemEx("VKT_PREVENT_MULTIPLE_VALUES", False) - - ' If oIsIndexed = True And oIndexValue <> "" Then - ' If oIndexValue <> "EMPTY_OI" Then - ' _Logger.Info("Auto Indexname: " & oIndexName.ToString) - ' _Logger.Info("Indexvalue: " & oIndexValue.ToString) - ' Count += 1 - - ' ' den Typ des Zielindexes auslesen - ' Dim oIndexType As Integer = WINDREAM.GetIndexType(oIndexName) - ' _Logger.Debug("WMIndexType: " & oIndexType.ToString) - ' If oIndexType > 4095 Then - ' _Logger.Debug("Es Handelt sich um einen VektorIndex...") - ' Dim oExistingItems = WINDREAM.GetIndexValue(CURRENT_NEWFILENAME, oIndexName) - - ' Dim oSplitArray = Split(oIndexValue, ClassConstants.VECTORSEPARATOR) - ' Dim oListofString As New List(Of String) - ' If oSplitArray.Length = 0 Then - ' _Logger.Debug("oSplitArray.Length = 0") - ' oListofString.Add(oIndexValue) - ' Else - ' _Logger.Debug("oSplitArray is > 0 ...") - ' For Each oStr In oSplitArray - ' _Logger.Debug("oSplitArray - oStr: {0}", oStr) - ' oListofString.Add(oStr) - ' Next - ' End If - - ' 'If oSplitArray.Length <= 1 Then - ' ' indexierung_erfolgreich = WINDREAM.SetFileIndex(CURRENT_NEWFILENAME, oIndexName, oIndexValue, CURR_DOKART_OBJECTTYPE) - ' 'Else - ' If oOverwrite = False And oExistingItems.Count > 0 And oIndexType <> 4100 Then - ' _Logger.Debug("oOverwrite = False and WMObject already contains [{0}] values in attribute,Values will be concatted", oExistingItems.Count) - ' oListofString = oExistingItems.Concat(oListofString).ToList() - ' End If - ' If oPreventMultipleValues = True Then - ' _Logger.Debug("Preventing multiple values in Vektor") - ' oListofString = oListofString.Distinct().ToList() - ' End If - ' indexierung_erfolgreich = WINDREAM.SetFileIndexLoS(CURRENT_NEWFILENAME, oIndexName, oListofString, CURR_DOKART_OBJECTTYPE) - ' 'End If - - ' Else - ' indexierung_erfolgreich = WINDREAM.SetFileIndex(CURRENT_NEWFILENAME, oIndexName, oIndexValue, CURR_DOKART_OBJECTTYPE) - ' End If - - ' 'indexierung_erfolgreich = WINDREAM.SetFileIndex(CURRENT_NEWFILENAME, indexname, Indexvalue, CURR_DOKART_OBJECTTYPE) - ' If indexierung_erfolgreich = 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 CURRENT_NEWFILENAME.ToUpper.EndsWith(".MSG") Or CURRENT_NEWFILENAME.ToUpper.EndsWith(".EML") Then - ' indexierung_erfolgreich = SetEmailIndicies(False) - ' If indexierung_erfolgreich = False Then - ' MsgBox("Error in SetEmailIndices - See log", MsgBoxStyle.Critical) - ' Return False - ' End If - ' ElseIf DropType = "|ATTMNTEXTRACTED|" Or DropType = "|OUTLOOK_ATTACHMENT|" Then - ' indexierung_erfolgreich = SetEmailIndicies(True) - ' If indexierung_erfolgreich = False Then - ' MsgBox("Error in SetEmailIndices - See log", MsgBoxStyle.Critical) - ' Return False - ' End If - ' End If - ' Catch ex As Exception - ' ShowErrorMessage(ex, "Write_Indizes") - ' Return False - ' Finally - - ' End Try - ' Return True - 'End Function Private Function Write_Indizes() As Boolean Try @@ -1468,7 +894,6 @@ Public Class frmIndex End Try End Function - Private Function WriteIndex2File(pIndexName As String, pIndexValue As String) Try _Logger.Info($"Indexing with Name {pIndexName} and Value: {pIndexValue}") @@ -1479,122 +904,6 @@ Public Class frmIndex End Try End Function - 'Private Function SetEmailIndicies(pIndexAttachment As Boolean) As Boolean - ' Try - ' Dim oIndexNames As Dictionary(Of String, Object) - - ' Dim oSQL As String = $"SELECT * FROM TBGI_OBJECTTYPE_EMAIL_INDEX WHERE OBJECTTYPE = '{CURR_DOKART_OBJECTTYPE}'" - ' Dim oTable As DataTable = DATABASE_ECM.GetDatatable(oSQL) - - ' If IsNothing(oTable) Then - ' _Logger.Info("Could not get Email Indicies for OBJECTTYPE = [{0}]. Exiting.", CURR_DOKART_OBJECTTYPE) - ' Return False - ' End If - - ' If oTable.Rows.Count = 0 Then - ' LOGGER.Warn("Could not get Email Indicies for OBJECTTYPE = [{0}]. Exiting.", CURR_DOKART_OBJECTTYPE) - ' MsgBox($"Definition von Email Indizes für den Objekttyp [{oTable}] fehlt." + vbNewLine + "Bitte informieren Sie Ihren Systembetreuer.", MsgBoxStyle.Critical) - ' Return False - ' End If - - ' If oTable.Rows.Count > 1 Then - ' LOGGER.Warn("Got multiple rows for Email Indicies for OBJECTTYPE = [{0}]. Exiting.", CURR_DOKART_OBJECTTYPE) - ' Return False - ' End If - - ' Dim oRow As DataRow = oTable.Rows.Item(0) - - ' ' If file is an email files (eml,msg) parse it to extract email data and save for later - ' ' If file is an attachment, rely on the previously extracted value - - - - ' If pIndexAttachment = False Then - ' LOGGER.Debug("Indexing Email File: [{0}]", CURRENT_NEWFILENAME) - - ' ' This cannot use Path.Combine, otherwise the WINDREAM_BASEPATH will be swallowed... lol - ' 'Dim oMsgFilePath As String = Path.Combine(WINDREAM_BASEPATH, CURRENT_NEWFILENAME) - - ' Dim oMsgFilePath As String = CURRENT_NEWFILENAME - ' If CURRENT_NEWFILENAME.StartsWith(WINDREAM_BASEPATH) = False Then - ' oMsgFilePath = WINDREAM_BASEPATH & oMsgFilePath - ' End If - - ' Dim oMail As IMail = EMAIL.Load_Email(oMsgFilePath) - - ' Dim oMessageId As String = oMail.MessageID - ' LOGGER.Debug("MessageId: [{0}]", oMessageId) - - ' Dim oMessageFrom As String = EMAIL.Get_MessageSender(oMail) - ' Dim oMessageTo As String = EMAIL.Get_MessageReceiver(oMail) - ' LOGGER.Debug("oMessageTo: [{0}]", oMessageTo.ToString) - ' Dim oDateIn As Date = EMAIL.Get_MessageDate(oMail) - ' LOGGER.Debug("oDateIn: [{0}]", oDateIn.ToString) - ' Dim oSubject As String = oMail.Subject - ' LOGGER.Debug("oSubject: [{0}]", oSubject) - - ' CURRENT_MESSAGEID = oMessageId - ' CURRENT_MESSAGEDATE = oDateIn - - ' If oSubject IsNot Nothing Then - ' CURRENT_MESSAGESUBJECT = oSubject - ' Else - ' CURRENT_MESSAGESUBJECT = "" - ' LOGGER.Info("No subject - Default will be used!") - ' End If - - ' oIndexNames = New Dictionary(Of String, Object) From { - ' {"IDX_EMAIL_ID", oMessageId}, - ' {"IDX_EMAIL_FROM", oMessageFrom}, - ' {"IDX_EMAIL_TO", oMessageTo}, - ' {"IDX_EMAIL_SUBJECT", CURRENT_MESSAGESUBJECT}, - ' {"IDX_EMAIL_DATE_IN", oDateIn} - ' } - ' Else - ' oIndexNames = New Dictionary(Of String, Object) From { - ' {"IDX_EMAIL_ID", CURRENT_MESSAGEID}, - ' {"IDX_EMAIL_SUBJECT", CURRENT_MESSAGESUBJECT}, - ' {"IDX_EMAIL_DATE_IN", CURRENT_MESSAGEDATE}, - ' {"IDX_CHECK_ATTACHMENT", True} - ' } - ' End If - - - ' For Each oIndex In oIndexNames - ' Try - ' If oIndex.Value Is Nothing Then - ' LOGGER.Warn("Value for Index [{0}] was empty. Skipping.", oIndex.Key) - ' Continue For - - ' End If - - ' If TypeOf oIndex.Value Is String AndAlso oIndex.Value = String.Empty Then - ' LOGGER.Warn("Value for Index [{0}] was empty. Skipping.", oIndex.Key) - ' Continue For - - ' End If - - ' Dim oIndexingSuccessful = WriteIndex2File(oRow.Item(oIndex.Key), oIndex.Value) - - ' If oIndexingSuccessful = False Then - ' MsgBox($"Error while Indexing Email at Index [{oIndex.Key}]", MsgBoxStyle.Critical) - ' Return False - - ' End If - ' Catch ex As Exception - ' LOGGER.Warn("Error while Indexing Email at Index [{0}]", oIndex.Key) - ' LOGGER.Error(ex) - ' Return False - ' End Try - ' Next - - ' Return True - ' Catch ex As Exception - ' LOGGER.Error(ex) - ' Return False - ' End Try - 'End Function - Private Function SetEmailIndicies(pIndexAttachment As Boolean) As Boolean Try Dim oIndexNames As Dictionary(Of String, Object) @@ -1711,386 +1020,6 @@ Public Class frmIndex End Try End Function - - 'Private Function SetEmailIndicesOld() - ' Dim indexierung_erfolgreich As Boolean = False - ' Dim _step As String = "1" - - ' Try - ' Dim oTempPath As String = Path.Combine(WINDREAM_BASEPATH, CURRENT_NEWFILENAME) - ' Dim msg As Msg.Message = New Msg.Message(oTempPath) - ' Dim msgDisplayTo = msg.DisplayTo - ' Dim msgInternetAccountName = msg.InternetAccountName - ' If LogErrorsOnly = False Then - ' _Logger.Info("") - ' _Logger.Info("msgInternetAccountName: " & msgInternetAccountName) - ' _Logger.Info("SenderName: " & msg.SenderName) - ' _Logger.Info("SenderEmailAddress: " & msg.SenderEmailAddress) - ' _Logger.Info("ReceivedByName: " & msg.ReceivedByName) - ' _Logger.Info("ReceivedByEmailAddress: " & msg.ReceivedByEmailAddress) - ' _Logger.Info("") - ' End If - ' _step = "2" - - ' 'Console.WriteLine("Subject: " + msg.Subject) - ' 'Console.WriteLine("MessageDeliveryTime:" & msg.MessageDeliveryTime) - ' 'Console.WriteLine("SenderName: " + msg.SenderName) - ' 'Console.WriteLine("SenderEmailAddress: " + msg.SenderEmailAddress) - ' 'Console.WriteLine("ReceivedByName: " + msg.ReceivedByName) - ' 'Console.WriteLine("ReceivedByEmailAddress: " + msg.ReceivedByEmailAddress) - ' 'Console.WriteLine("DisplayTo: " + msg.DisplayTo) - ' 'Console.WriteLine("DisplayCc: " + msg.DisplayCc) - ' 'Console.WriteLine("Body: " + msg.Body) - ' 'Console.WriteLine("-----------------------------------------------------------------------") - ' 'Console.WriteLine("BodyHtmlText: " + msg.BodyHtmlText) - ' 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 CURRENT_DT_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 = DATABASE_ECM.GetDatatable("SELECT * FROM TBGI_OBJECTTYPE_EMAIL_INDEX WHERE OBJECTTYPE = '" & CURR_DOKART_OBJECTTYPE & "'") - ' If IsNothing(DT) Then - ' _Logger.Info("SELECT * FROM TBGI_OBJECTTYPE_EMAIL_INDEX WHERE OBJECTTYPE = '" & CURR_DOKART_OBJECTTYPE & "' RESULTED in NOTHING") - ' Return False - ' End If - ' If DT.Rows.Count = 1 Then - ' _step = "3" - ' CURRENT_MESSAGEDATE = "" - ' CURRENT_MESSAGESUBJECT = "" - ' 'Message-ID nur auswerten wenn vorher nicht gestzt wurde! - ' If CURRENT_MESSAGEID = "" Then - ' If Not msg.InternetMessageId Is Nothing Then - ' indexierung_erfolgreich = WriteIndex2File(DT.Rows(0).Item("IDX_EMAIL_ID").ToString, msg.InternetMessageId) - ' 'Die aktuelle Message-ID zwischenspeichern - ' 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 - ' CURRENT_MESSAGEID = ClassEmailHeaderExtractor.extractFromHeader(headers, messageIDPattern) - ' If IsNothing(CURRENT_MESSAGEID) Then - ' 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 = WriteIndex2File(DT.Rows(0).Item("IDX_EMAIL_ID").ToString, 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 - ' frmMissingInput.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 - ' frmMissingInput.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 = WriteIndex2File(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 = WriteIndex2File(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 = ClassHelper.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 = WriteIndex2File(DT.Rows(0).Item("IDX_EMAIL_SUBJECT").ToString, subj) - ' 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 = WriteIndex2File(DT.Rows(0).Item("IDX_EMAIL_DATE_IN").ToString, msg.MessageDeliveryTime) - ' 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 - ' ShowErrorMessage(ex, "SetEmailIndices") - ' 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 Function SetAttachmentIndices() - ' Dim indexierung_erfolgreich As Boolean = True - ' Try - ' Dim DT As DataTable = DATABASE_ECM.GetDatatable("SELECT * FROM TBGI_OBJECTTYPE_EMAIL_INDEX WHERE OBJECTTYPE = '" & CURR_DOKART_OBJECTTYPE & "'") - ' If DT.Rows.Count = 1 Then - - ' If Not CURRENT_MESSAGEID Is Nothing Then - ' If CURRENT_MESSAGEID <> "" Then - ' indexierung_erfolgreich = WriteIndex2File(DT.Rows(0).Item("IDX_EMAIL_ID").ToString, 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 CURRENT_MESSAGESUBJECT <> "" Then - ' indexierung_erfolgreich = WriteIndex2File(DT.Rows(0).Item("IDX_EMAIL_SUBJECT").ToString, 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 CURRENT_MESSAGEDATE <> "" Then - ' indexierung_erfolgreich = WriteIndex2File(DT.Rows(0).Item("IDX_EMAIL_DATE_IN").ToString, 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 = WriteIndex2File(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 - ' ShowErrorMessage(ex, "SetAttachmentIndices") - ' Return False - ' End Try - - 'End Function - Private Function SINGLEFILE_2_WINDREAM(_Objekttyp As String) As Boolean Try CURR_DOKART_OBJECTTYPE = _Objekttyp @@ -2132,12 +1061,6 @@ Public Class frmIndex 'Die Datei wird nun an den neuen Ort kopiert My.Computer.FileSystem.MoveFile(CURRENT_WORKFILE, CURRENT_NEWFILENAME) - 'If CURR_DELETE_ORIGIN = True Then - ' My.Computer.FileSystem.MoveFile(CURRENT_WORKFILE, CURRENT_NEWFILENAME) - 'Else - ' My.Computer.FileSystem.CopyFile(CURRENT_WORKFILE, CURRENT_NEWFILENAME) - 'End If - Dim Insert_String As String Try Dim oCurrentWorkfile = CURRENT_WORKFILE.Replace("'", "''") @@ -2171,7 +1094,6 @@ Public Class frmIndex Return True End Try End Function - '#End Region Private Sub frmIndex_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing If File.Exists(CURRENT_FILENAME) Then @@ -2265,8 +1187,6 @@ Public Class frmIndex End If End Sub - - Private Sub frmIndex_Load(sender As Object, e As System.EventArgs) Handles Me.Load ' Abbruchzähler zurücksetzen CancelAttempts = 0 @@ -2363,24 +1283,7 @@ Public Class frmIndex MULTIFILES = DATABASE_ECM.GetScalarValue("SELECT COUNT(*) FROM TBGI_FILES_USER WHERE WORKED = 0 AND GUID <> " & CURRENT_WORKFILE_GUID & " AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')") Dim allFiles As Integer = MULTIFILES + 1 MULTIINDEXING_ACTIVE = False - 'If allFiles > 1 Then - ' If USER_LANGUAGE = LANG_DE Then - ' 'BarCheckItem_MultiIndexing.Caption = "Multi-Indexing - Alle nachfolgenden Dateien (" & MULTIFILES & ") identisch indexieren" - ' BarCheckItem_MultiIndexing.Caption = "Multi-Indexing - (" & allFiles & ") zu indexierende Dateien" - ' Else - ' 'BarCheckItem_MultiIndexing.Caption = "Multi-Indexing - All following files (" & MULTIFILES & ") will be indexed identically" - ' BarCheckItem_MultiIndexing.Caption = "Multi-Indexing - (" & allFiles & ") files to be indexed" - ' End If - ' BarCheckItem_MultiIndexing.Checked = False - ' BarCheckItem_MultiIndexing.Visibility = True - - ' BarButtonItem1.Visibility = DevExpress.XtraBars.BarItemVisibility.Always - 'Else - ' BarCheckItem_MultiIndexing.Visibility = False - - ' BarButtonItem1.Visibility = DevExpress.XtraBars.BarItemVisibility.Never - 'End If If allFiles < 2 Then BarCheckItem_MultiIndexing.Caption = "Multi-Indexing" BarCheckItem_MultiIndexing.Enabled = False @@ -2397,7 +1300,6 @@ Public Class frmIndex End If End If - Catch ex As Exception ShowErrorMessage(ex, "Form Open") End Try @@ -2478,7 +1380,6 @@ Public Class frmIndex Next End If - If ComboboxDoctype.EditValue Is Nothing Then ComboboxDoctype.Select() End If @@ -2522,10 +1423,8 @@ Public Class frmIndex CURRENT_DOKART_ID = oSelectedItem.Guid CURRENT_LASTDOKART = oSelectedItem.Name - 'lblhinweis.Visible = False ClearNotice() - 'lblerror.Visible = False ClearError() pnlIndex.Controls.Clear() @@ -2543,7 +1442,6 @@ Public Class frmIndex oNewDestination = oDestination End If - LOGGER.Debug("Path from Database is [{0}]", oDestination) LOGGER.Debug("Checking for path [{0}]", oNewDestination) Dim oPathExists As Boolean @@ -2590,7 +1488,7 @@ Public Class frmIndex ShowErrorMessage(ex, "Refresh_IndexeMan", "DOKART-ID: " & dokartid) End Try End Sub - ' _ + Function Check_HistoryValues(Indexname As String, Dokart As String) As String Try Dim result = Nothing @@ -2611,128 +1509,6 @@ Public Class frmIndex End Try End Function - 'Private Sub LoadIndexe_Man() - ' Try - - ' Dim oScreen As New DigitalData.Modules.Windows.Screen() - ' Dim oDpiscale = oScreen.GetScreenScaling(Me) - - ' Dim oControlCount As Integer = 1 - ' Dim oLabelPosition As Integer = 11 * oDpiscale - ' Dim oControlPosition As Integer = 33 * oDpiscale - - ' _Logger.Info("Loading Indicies for Screen Scaling Factor [{0}]", oDpiscale) - - ' Dim oControls As New ControlCreator(LOGCONFIG, pnlIndex, Me) With { - ' .OnControlChanged = AddressOf PrepareDependingControl, - ' .OnLookupData = AddressOf GetLookupData - ' } - - ' 'Dim oControls As New ClassControls(pnlIndex, Me) - - ' If DT_INDEXEMAN.Rows.Count = 0 Then - ' ' ShowError("Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & cmbDokumentart.Text & " definiert") - ' '_Logger.Info(" - Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & cmbDokumentart.Text & " definiert") - - ' ShowError("Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & ComboboxDoctype.Text & " definiert") - ' _Logger.Info(" - Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & ComboboxDoctype.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 = oRow.ItemEx("CONNECTION_ID", 0) - ' Dim oSQLSuggestion = oRow.Item("SUGGESTION") - ' Dim oSQLResult = oRow.Item("SQL_RESULT") - - ' LOGGER.Debug("IndexName: {0}", oControlName) - ' LOGGER.Debug("SQL: {0}", oSQLResult) - - ' If oDataType <> ClassConstants.INDEX_TYPE_BOOLEAN Then - ' addLabel(oControlName, oRow.Item("COMMENT").ToString, oLabelPosition, oControlCount) - ' End If - - ' Dim DefaultValue = Check_HistoryValues(oControlName, oRow.Item("DOKUMENTART")) - ' If DefaultValue Is Nothing Then - ' DefaultValue = GetPlaceholderValue(oRow.Item("DEFAULT_VALUE"), CURRENT_WORKFILE, USER_SHORTNAME) - ' End If - - ' Select Case oDataType - ' Case ClassConstants.INDEX_TYPE_BOOLEAN - ' Dim chk As CheckEdit = oControls.AddCheckBox(oControlName, oControlPosition, DefaultValue, oRow.Item("COMMENT").ToString) - ' If Not IsNothing(chk) Then - ' pnlIndex.Controls.Add(chk) - ' End If - ' Case ClassConstants.INDEX_TYPE_INTEGER - ' If (oSQLSuggestion = True And oSQLResult.ToString.Length > 0) Or MultiSelect = True Then - ' Dim oControl = oControls.AddLookupControl(oControlName, oControlPosition, MultiSelect, oDataType, oSQLResult, oConnectionId, DefaultValue, AddNewItems, PreventDuplicates) - ' If Not IsNothing(oControl) Then - ' pnlIndex.Controls.Add(oControl) - ' End If - ' Else - ' 'nur eine Textbox - ' Dim oControl = oControls.AddTextBox(oControlName, oControlPosition, DefaultValue, oDataType) - ' If Not IsNothing(oControl) Then - ' pnlIndex.Controls.Add(oControl) - ' End If - ' End If - ' Case ClassConstants.INDEX_TYPE_VARCHAR - ' If (oSQLSuggestion = True And oSQLResult.ToString.Length > 0) Or MultiSelect = True Then - ' Dim oControl = oControls.AddLookupControl(oControlName, oControlPosition, MultiSelect, oDataType, oSQLResult, oConnectionId, DefaultValue, AddNewItems, PreventDuplicates) - ' If Not IsNothing(oControl) Then - ' pnlIndex.Controls.Add(oControl) - ' End If - ' Else - ' If oControlName.ToString.ToLower = "dateiname" Then - ' Dim oControl = oControls.AddTextBox(oControlName, oControlPosition, System.IO.Path.GetFileNameWithoutExtension(CURRENT_WORKFILE), oDataType) - ' If Not IsNothing(oControl) Then - ' pnlIndex.Controls.Add(oControl) - ' End If - ' Else - ' Dim VORBELGUNG As String = DefaultValue - ' Dim oControl = oControls.AddTextBox(oControlName, oControlPosition, VORBELGUNG, oDataType) - ' If Not IsNothing(oControl) Then - ' pnlIndex.Controls.Add(oControl) - ' End If - ' End If - ' End If - ' Case "DATE" - ' Dim oPicker = oControls.AddDateTimePicker(oControlName, oControlPosition, DefaultValue) - ' pnlIndex.Controls.Add(oPicker) - - ' Case Else - ' If USER_LANGUAGE = LANG_DE Then - ' MsgBox("Bitte überprüfen Sie den Datentyp des hinterlegten Indexwertes!", MsgBoxStyle.Critical, "Achtung:") - ' Else - ' MsgBox("Please check Datatype of Indexvalue!", MsgBoxStyle.Critical, "Warning:") - ' End If - - ' _Logger.Warn(" - Datentyp nicht hinterlegt - LoadIndexe_Man") - ' End Select - - ' oControlCount += 1 - ' oLabelPosition += 50 * oDpiscale - ' oControlPosition += 50 * oDpiscale - ' 'make y as height in fom - ' Next - ' Dim oPanelHeight = oControlPosition - 30 - - ' If pnlIndex.Height < oPanelHeight Then - ' If (Me.Height - 315) < oPanelHeight Then - ' Me.Height = (Me.Height - 315) + oPanelHeight - ' End If - ' pnlIndex.Height = oPanelHeight - ' End If - - ' SendKeys.Send("{TAB}") - ' Catch ex As Exception - ' ShowErrorMessage(ex, "LoadIndexe_Man") - ' End Try - 'End Sub - Private Sub LoadIndexe_Man() Try Dim oScreen As New DigitalData.Modules.Windows.Screen() @@ -2880,7 +1656,6 @@ Public Class frmIndex pSQLCommand = ClassPatterns.ReplaceInternalValues(pSQLCommand) pSQLCommand = ClassPatterns.ReplaceUserValues(pSQLCommand, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_DOKART_ID) - 'Dim oDatatable = ClassDatabase.Return_Datatable_Combined(pSQLCommand, oConnectionString, False) Dim oDatatable = DATABASE_ECM.GetDatatableWithConnection(pSQLCommand, oConnectionString) Return oDatatable End If @@ -3009,10 +1784,6 @@ Public Class frmIndex 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() Dim fileInfo As FileInfo = New FileInfo(FileName) Dim fileSecurity As FileSecurity = fileInfo.GetAccessControl() @@ -3045,151 +1816,6 @@ Public Class frmIndex Return oResult End Function - 'Function FillIndexe_Autom(dokart_id As Integer) - ' Try - ' VWINDEX_AUTOMTableAdapter.Fill(MyDataset.VWDDINDEX_AUTOM, CURRENT_DOKART_ID) - - ' Dim oDatatable = MyDataset.VWDDINDEX_AUTOM - ' Dim oRegex As New Regex("\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}") - - ' If oDatatable.Rows.Count = 0 Then - ' Return True - ' End If - ' Dim oIndexName As String - ' ' 1. Schritt: Einfach-Indexe und Platzhalter ersetzen - ' For Each oRow As DataRow In oDatatable - ' oIndexName = oRow.Item("INDEXNAME") - ' _Logger.Info("Working on AutomaticIndex: " & oRow.Item("INDEXNAME") & "...") - ' Dim oSqlResult As String = oRow.ItemEx("SQL_RESULT", "") - ' Dim oSqlActive As Boolean = oRow.ItemEx("SQL_ACTIVE", False) - ' Dim oSqlConnectionId As Integer = oRow.ItemEx("CONNECTION_ID", -1) - ' Dim oSqlProvider As String = oRow.ItemEx("SQL_PROVIDER", "") - ' Dim oEndResult As New List(Of String) - - ' ' Wenn kein SQL Befehl vorhanden oder aktiv ist, - ' ' versuchen wir, die Spalte VALUE zu ersetzen - ' If oSqlResult = String.Empty Or oSqlActive = 0 Then - ' Dim oPlaceholderResult As String - ' Dim oValue As String = oRow.ItemEx("VALUE", "") - - ' oPlaceholderResult = GetPlaceholderValue(oValue, CURRENT_WORKFILE, USER_SHORTNAME) - - ' If Not IsNothing(oPlaceholderResult) Then - ' oValue = oPlaceholderResult - ' End If - - ' oRow.Item("Indexiert") = True - ' oRow.Item("Indexwert") = oValue - - ' 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, CURRENT_WORKFILE, USER_SHORTNAME) - - ' ' Einfachen Platzhalter ersetzen - ' If Not IsNothing(oPlaceholderResult) Then - ' oSqlResult = oSqlResult.Replace(oMatch.Value, oPlaceholderResult) - ' End If - - ' oOptionalIndex = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {CURRENT_DOKART_ID} AND UPPER(NAME) = UPPER('{oIndexValue}')") - ' oManualIndexResult = GetManIndex_Value(oIndexValue, "IDX_AUTO", oOptionalIndex) - - ' ' Wenn Ergebnis den VektorPlatzhalter enthält, soll nichts ersetzt werden. - ' ' Werden im nächsten Schritt ersetzt. - ' If oManualIndexResult.Contains(ClassConstants.VECTORSEPARATOR) Then - ' oManualIndexResult = Nothing - ' End If - - ' If Not IsNothing(oManualIndexResult) Then - ' oSqlResult = oSqlResult.Replace(oMatch.Value, oManualIndexResult) - ' End If - ' Next - - ' oSqlResult = ClassPatterns.ReplaceControlValues(oSqlResult, pnlIndex) - ' oSqlResult = ClassPatterns.ReplaceInternalValues(oSqlResult) - ' oSqlResult = ClassPatterns.ReplaceUserValues(oSqlResult, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_DOKART_ID) - - - ' If oSqlResult <> String.Empty Then - ' _Logger.Debug("oSqlResult after Replace [" & oSqlResult & "]") - ' End If - ' ' Ergebnis: Es wurden alle einfachen Platzhalter ersetz't, jetzt haben wir einen SQL Befehl, - ' ' der nur noch vektorfelder-platzhalter enthält - - ' ' 2. Schritt: Vektorfelder ersetzen - ' Dim oVectorMatches As MatchCollection = oRegex.Matches(oSqlResult) - ' If oVectorMatches.Count > 0 Or oIndexName.Contains("Vektor") Then - ' Dim oResult = GetAutomaticIndexSQLValue(oSqlResult, oSqlConnectionId, oSqlProvider) - ' Dim oConnectionString As String - ' oConnectionString = DATABASE_ECM.Get_ConnectionStringforID(oSqlConnectionId) - ' Try - ' Dim oResultDT As DataTable = DATABASE_ECM.GetDatatableWithConnection(oSqlResult, oConnectionString) - ' If Not IsNothing(oResultDT) Then - ' _Logger.Info("We got [" & oResultDT.Rows.Count & "] result(s) for the vector-field!") - ' For Each oResultRow As DataRow In oResultDT.Rows - ' oEndResult.Add(oResultRow.Item(0)) - ' Next - ' End If - ' If oEndResult.Count > 0 Then - ' oRow.Item("Indexiert") = True - ' oRow.Item("Indexwert") = String.Join(ClassConstants.VECTORSEPARATOR, oEndResult.ToArray) - ' End If - ' Catch ex As Exception - ' ShowErrorMessage(ex, $"FillIndexe_Autom - Vektorfield [{oIndexName}] ") - ' End Try - - ' 'Dim oIsFirstMatch = True - ' 'D - ' 'For Each oVectorMatch As Match In oVectorMatches - ' ' Dim oIndexValue As String = StripPlaceholder(oVectorMatch.Value) - ' ' Dim oOptionalIndex = False - ' ' Dim oManualIndexResult As String = Nothing - - ' ' oOptionalIndex = DATABASE_ECM.GetScalarValue($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {CURRENT_DOKART_ID} AND UPPER(NAME) = UPPER('{oIndexValue}')") - ' ' oManualIndexResult = GetManIndex_Value(oIndexValue, "IDX_AUTO", oOptionalIndex) - - ' ' Dim oVectorIndexValues = oManualIndexResult.Split(ClassConstants.VECTORSEPARATOR).ToList() - - ' ' For Each oVectorIndexValue In oVectorIndexValues - ' ' Dim oTempSql = oSqlResult.Replace(oVectorMatch.Value, oVectorIndexValue) - ' ' Dim oResult = GetAutomaticIndexSQLValue(oTempSql, oSqlConnectionId, oSqlProvider) - ' ' oEndResult.Add(oResult) - ' ' Next - - ' ' ' Verhindert, dass die Schleife mehrmals durchlaufen wird - ' ' If oIsFirstMatch Then - ' ' Exit For - ' ' End If - ' ' oRow.Item("Indexiert") = True - ' ' oRow.Item("Indexwert") = String.Join(ClassConstants.VECTORSEPARATOR, oEndResult.ToArray) - ' 'Next - ' Else - ' Dim oResult = GetAutomaticIndexSQLValue(oSqlResult, oSqlConnectionId, oSqlProvider) - ' _Logger.Info("Got a simple SQLResult: " & oResult.ToString) - ' oRow.Item("Indexiert") = True - ' oRow.Item("Indexwert") = oResult - - ' End If - ' Next - - ' Return True - ' Catch ex As Exception - ' ShowErrorMessage(ex, "FillIndexe_Autom") - ' Return False - ' End Try - 'End Function - Function FillIndexe_Autom(dokart_id As Integer) As Boolean Try VWINDEX_AUTOMTableAdapter.Fill(MyDataset.VWDDINDEX_AUTOM, dokart_id) @@ -3383,67 +2009,6 @@ Public Class frmIndex End Try End Function - 'Private Sub OK_Button_Click(sender As Object, e As EventArgs) - ' ClearError() - ' ClearNotice() - - ' 'lblhinweis.Visible = False - ' 'lblerror.Visible = False - - ' Me.Cursor = Cursors.WaitCursor - ' ClassHelper.Refresh_RegexTable() - ' For Each rowregex As DataRow In CURRENT_DT_REGEX.Rows - ' If rowregex.Item("FUNCTION_NAME") = "CLEAN_FILENAME" Then - ' REGEX_CLEAN_FILENAME = rowregex.Item("REGEX") - ' End If - ' Next - ' If checkMultiindex.Visible = True And checkMultiindex.Checked = True Then - ' 'Die erste Datei indexieren - ' If WORK_FILE() = True Then - ' 'Und nun die folgenden - ' Dim DTFiles2Work As DataTable = DATABASE_ECM.GetDatatable("SELECT * FROM TBGI_FILES_USER WHERE WORKED = 0 AND GUID <> " & CURRENT_WORKFILE_GUID & " AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')") - ' If Not DTFiles2Work Is Nothing Then - ' Dim err = False - ' For Each filerow As DataRow In DTFiles2Work.Rows - ' CURRENT_WORKFILE_GUID = filerow.Item("GUID") - ' CURRENT_WORKFILE_HASH = NotNull(filerow.Item("FILE_HASH"), "") - ' 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 USER_LANGUAGE = LANG_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 - - ' Me.Close() - ' End If - ' End If - ' End If - ' Else - ' If WORK_FILE() = True Then - ' Me.Cursor = Cursors.Default - - ' If CONFIG.Config.ShowIndexResult = True Then - ' If USER_LANGUAGE = LANG_DE Then - ' MsgBox("Die Datei wurde erfolgreich verarbeitet!" & vbNewLine & "Ablagepfad:" & vbNewLine & CURRENT_NEWFILENAME, MsgBoxStyle.Information, "Erfolgsmeldung") - ' Else - ' MsgBox("File sucessfully processed!" & vbNewLine & "Path:" & vbNewLine & CURRENT_NEWFILENAME, MsgBoxStyle.Information, "Success") - ' End If - ' End If - - ' Me.Close() - ' End If - ' End If - ' Me.Cursor = Cursors.Default - 'End Sub Private Function Move_File_and_Index() Dim oError As Boolean Try @@ -3548,7 +2113,6 @@ Public Class frmIndex Private Function CreateFolderForIndex(DynamicFolderConfig As String) Try Dim oRootFolder As String = Path.GetDirectoryName(CURRENT_NEWFILENAME) - 'Dim oFilesystem As New Filesystem(LOGCONFIG) If DynamicFolderConfig <> String.Empty Then '###### @@ -3577,7 +2141,6 @@ Public Class frmIndex End If oManIndexValue = FILESYSTEM.GetCleanPath(oManIndexValue) - 'oManIndexValue = ClassFilehandle.CleanFilename(oManIndexValue, "") DynamicFolderConfig = DynamicFolderConfig.Replace(oMatch.ToString, oManIndexValue) _Logger.Info("FolderPattern: '" & DynamicFolderConfig & "'") @@ -3599,7 +2162,6 @@ Public Class frmIndex If Not oAutoIndexValue = String.Empty Then oAutoIndexValue = FILESYSTEM.GetCleanPath(oAutoIndexValue) - 'oAutoIndexValue = ClassFilehandle.CleanFilename(oAutoIndexValue, "") If oAutoIndexValue = "EMPTY_OI" Then DynamicFolderConfig = DynamicFolderConfig.Replace(oMatch.ToString, "") Else @@ -3648,9 +2210,6 @@ Public Class frmIndex Next End If - - - _Logger.Info("Den Root-Folder zusammenfügen>> ") Dim oNewFullPath As String = System.IO.Path.Combine(oRootFolder, DynamicFolderConfig) @@ -3716,7 +2275,6 @@ Public Class frmIndex Dim DT As DataTable = DATABASE_ECM.GetDatatable(sql) - Dim anz = DT.Rows.Count For Each Filerow As DataRow In DT.Rows Dim filestring As String = Filerow.Item("FILENAME2WORK") @@ -3745,13 +2303,11 @@ Public Class frmIndex End If End If - Catch ex As Exception _Logger.Error(ex) MsgBox("Unexpected Error in Abort Indexing: " & vbNewLine & ex.Message, MsgBoxStyle.Critical) End Try - Close() End If End Select @@ -3784,79 +2340,6 @@ Public Class frmIndex End If End Sub - 'Private Sub SimpleButton1_Click(sender As Object, e As EventArgs) Handles btnOK.Click - ' Try - ' ClearError() - ' ClearNotice() - - ' Me.Cursor = Cursors.WaitCursor - ' CURRENT_DT_REGEX = DATABASE_ECM.GetDatatable("SELECT * FROM TBGI_FUNCTION_REGEX") - ' For Each rowregex As DataRow In CURRENT_DT_REGEX.Rows - ' If rowregex.Item("FUNCTION_NAME") = "CLEAN_FILENAME" Then - ' REGEX_CLEAN_FILENAME = rowregex.Item("REGEX") - ' End If - ' Next - ' If BarCheckItem_MultiIndexing.Checked = True Then - ' 'Die erste Datei indexieren - ' If WORK_FILE() = True Then - ' 'Und nun die folgenden - ' Dim DTFiles2Work As DataTable = DATABASE_ECM.GetDatatable("SELECT * FROM TBGI_FILES_USER WHERE WORKED = 0 AND GUID <> " & CURRENT_WORKFILE_GUID & " AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')") - ' If DTFiles2Work IsNot Nothing Then - ' Dim err = False - ' For Each oRow As DataRow In DTFiles2Work.Rows - ' CURRENT_WORKFILE_GUID = oRow.Item("GUID") - ' CURRENT_WORKFILE = oRow.Item("FILENAME2WORK") - ' CURRENT_WORKFILE_HASH = oRow.ItemEx("FILE_HASH", "") - ' DropType = oRow.Item("HANDLE_TYPE") - - ' If WORK_FILE() = False Then - ' err = True - ' Exit For - ' End If - ' Next - ' Me.Cursor = Cursors.Default - ' If err = False Then - ' If USER_LANGUAGE = LANG_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 - - ' CloseViewer() - - ' CancelAttempts = 2 - ' Me.Close() - ' End If - ' End If - ' End If - ' Else - ' If WORK_FILE() = True Then - ' Me.Cursor = Cursors.Default - ' If CONFIG.Config.ShowIndexResult = True Then - ' If USER_LANGUAGE = LANG_DE Then - ' ' MsgBox("Die Datei wurde erfolgreich verarbeitet!" & vbNewLine & "Ablagepfad:" & vbNewLine & CURRENT_NEWFILENAME, MsgBoxStyle.Information, "Erfolgsmeldung") - ' _FormHelper.ShowSuccessMessage($"Die Datei wurde erfolgreich verarbeitet!{vbNewLine}Ablagepfad:{vbNewLine}{CURRENT_NEWFILENAME}", "Erfolgsmeldung") - ' Else - ' 'MsgBox($"File sucessfully processed!{vbNewLine}Path:{vbNewLine}{CURRENT_NEWFILENAME}" & vbNewLine & "Path:" & vbNewLine & CURRENT_NEWFILENAME, MsgBoxStyle.Information, "Success") - ' _FormHelper.ShowSuccessMessage($"File sucessfully processed!{vbNewLine}Path:{vbNewLine}{CURRENT_NEWFILENAME}", "Success") - ' End If - - - ' End If - - ' CloseViewer() - - ' CancelAttempts = 2 - ' Me.Close() - ' End If - ' End If - ' Catch ex As Exception - ' MsgBox("Uncaught error while indexing: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, Text) - ' Finally - ' Me.Cursor = Cursors.Default - ' End Try - 'End Sub - Private Sub checkItemPreview_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles checkItemPreview.CheckedChanged SetFilePreview(checkItemPreview.Checked) CONFIG.Config.FilePreview = checkItemPreview.Checked @@ -3879,7 +2362,6 @@ Public Class frmIndex CONFIG.Save() End Sub - Private Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick Try MsgBox($"Deleting [{CURRENT_WORKFILE}]", MsgBoxStyle.Information, Text) @@ -3887,7 +2369,6 @@ Public Class frmIndex File.SetAttributes(CURRENT_WORKFILE, FileAttributes.Normal) File.Delete(CURRENT_WORKFILE) - 'IO.File.Delete(CURRENT_WORKFILE) Catch ex As Exception _Logger.Error(ex) MsgBox(ex.Message) @@ -3972,14 +2453,11 @@ Public Class frmIndex Me.Cursor = Cursors.Default If CONFIG.Config.ShowIndexResult = True Then If USER_LANGUAGE = LANG_DE Then - ' MsgBox("Die Datei wurde erfolgreich verarbeitet!" & vbNewLine & "Ablagepfad:" & vbNewLine & CURRENT_NEWFILENAME, MsgBoxStyle.Information, "Erfolgsmeldung") _FormHelper.ShowSuccessMessage($"Die Datei wurde erfolgreich verarbeitet!{vbNewLine}Ablagepfad:{vbNewLine}{CURRENT_NEWFILENAME}", "Erfolgsmeldung") Else - 'MsgBox($"File sucessfully processed!{vbNewLine}Path:{vbNewLine}{CURRENT_NEWFILENAME}" & vbNewLine & "Path:" & vbNewLine & CURRENT_NEWFILENAME, MsgBoxStyle.Information, "Success") _FormHelper.ShowSuccessMessage($"File sucessfully processed!{vbNewLine}Path:{vbNewLine}{CURRENT_NEWFILENAME}", "Success") End If - End If CloseViewer()