Files
Modules/GUIs.ZooFlow/Globix/frmGlobix_Index.vb

1085 lines
56 KiB
VB.net

Imports System.IO
Imports System.Security.AccessControl
Imports System.Security.Principal
Imports System.Text.RegularExpressions
Imports DigitalData.Modules.Logging
Public Class frmGlobix_Index
#Region "+++++ Variablen ++++++"
Public vPathFile As String
Private MULTIFILES As Integer
Private akttxtbox As TextBox
Dim DT_INDEXEMAN As DataTable
Dim DT_DOKART As DataTable
Public FormLoaded As Boolean = False
Dim DropType As String
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 Const TEXT_MISSING_INPUT = "Bitte vervollständigen Sie die Eingaben!"
Private _LogConfig As LogConfig
Private _Logger As Logger
Private clswindowLocation As ClassWindowLocation
Private clsPatterns As GlobixPatterns
Private clsPostProcessing As GlobixPostprocessing
#End Region
Public Sub New(LogConfig 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
clswindowLocation = New ClassWindowLocation(_LogConfig)
clsPatterns = New GlobixPatterns(LogConfig)
clsPostProcessing = New GlobixPostprocessing(LogConfig)
End Sub
Private Sub frmGlobix_Index_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' Abbruchzähler zurücksetzen
CancelAttempts = 0
My.Application.Globix.INDEXING_ACTIVE = True
Try
My.Application.Globix.CURRENT_ISATTACHMENT = False
DropType = My.Database.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
SourceDeleteItem.Enabled = True
SourceDeleteItem.Checked = My.UIConfig.Globix.DeleteOriginalFile
DocumentViewer1.Init(_LogConfig, My.Application.GDPictureLicense)
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
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
Else
SourceDeleteItem.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
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
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
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
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
labelFilePath.Caption = My.Application.Globix.CURRENT_WORKFILE
clswindowLocation.LoadFormLocationSize(Me)
SetFilePreview(My.UIConfig.Globix.FilePreview)
SplitContainerControl1.SplitterPosition = My.UIConfig.Globix.SplitterDistanceViewer
My.Application.Globix.DTTBGI_REGEX_DOCTYPE = My.Database.GetDatatable("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.CURR_INDEX_MAN_POSTPROCESSING = My.Database.GetDatatable("SELECT * FROM TBDD_INDEX_MAN_POSTPROCESSING")
MULTIFILES = My.Database.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
RibbonPageGroupMultiIndex.Text = "Alle nachfolgenden Dateien (" & MULTIFILES & ") identisch indexieren"
Else
RibbonPageGroupMultiIndex.Text = "All following files (" & MULTIFILES & ") will be indexed identically"
End If
chkMultiindexing.Checked = False
chkMultiindexing.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
Else
chkMultiindexing.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
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 SetFilePreview(ShowPreview As Boolean)
If ShowPreview Then
SplitContainerControl1.Collapsed = False
PreviewFile()
PreviewItem.Checked = True
Else
SplitContainerControl1.Collapsed = True
PreviewItem.Checked = False
End If
End Sub
Sub PreviewFile()
Try
DocumentViewer1.LoadFile(My.Application.Globix.CURRENT_WORKFILE)
Catch ex As Exception
_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.UIConfig.Globix.DeleteOriginalFile = SourceDeleteItem.Checked
My.SystemConfigManager.Save()
End If
End Sub
Private Sub BarCheckItem5_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles PreviewItem.CheckedChanged
End Sub
Private Sub SourceDeleteItem_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles SourceDeleteItem.CheckedChanged
End Sub
'Private Sub SaveProfileItem_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles SaveProfileItem.CheckedChanged
' My.UIConfig.Globix.ProfilePreselection = SaveProfileItem.Checked
' My.SystemConfigManager.Save()
'End Sub
Private Sub SkipItem_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles SkipItem.ItemClick
My.Database.ExecuteNonQuery($"DELETE FROM TBGI_FILES_USER WHERE GUID = {My.Application.Globix.CURRENT_WORKFILE_GUID}")
CancelAttempts = 2
Close()
End Sub
Private Sub BarCheckItem3_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles chkMultiindexing.CheckedChanged
If chkMultiindexing.Checked Then
chkMultiindexing.Caption = "Active"
Else
chkMultiindexing.Caption = "Inactive"
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
cmbDoctype.SelectedIndex = cmbDoctype.FindStringExact(My.Application.Globix.CURRENT_LASTDOCTYPE)
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)
cmbDoctype.SelectedIndex = cmbDoctype.FindStringExact(oRoW.Item("DOCTYPE"))
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
Sub Refresh_Dokart()
Try
Dim sql = String.Format("select * from VWGI_DOCTYPE where UPPER(USERNAME) = UPPER('{0}') ORDER BY SEQUENCE", Environment.UserName)
_Logger.Debug("SQL DoctypeList: " & sql)
DT_DOKART = My.Database.GetDatatable(sql)
cmbDoctype.DataSource = DT_DOKART
cmbDoctype.ValueMember = DT_DOKART.Columns("DOCTYPE_ID").ColumnName
cmbDoctype.DisplayMember = DT_DOKART.Columns("DOCTYPE").ColumnName
cmbDoctype.AutoCompleteMode = AutoCompleteMode.Suggest
cmbDoctype.AutoCompleteSource = AutoCompleteSource.ListItems
cmbDoctype.SelectedIndex = -1
Catch ex As Exception
_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
Private Sub cmbDoctype_SelectedValueChanged(sender As Object, e As EventArgs) Handles cmbDoctype.SelectedValueChanged
End Sub
Private Sub cmbDoctype_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbDoctype.SelectedIndexChanged
If cmbDoctype.SelectedIndex <> -1 And FormLoaded = True Then
If cmbDoctype.SelectedValue.GetType.ToString = "System.Int32" Then
My.Application.Globix.CURRENT_DOCTYPE_ID = cmbDoctype.SelectedValue
'lblhinweis.Visible = False
ClearNotice()
'lblerror.Visible = False
ClearError()
Me.pnlIndex.Controls.Clear()
Dim sql As String = "Select * from TBDD_DOKUMENTART WHERE GUID = " & cmbDoctype.SelectedValue.ToString
My.Application.Globix.CURR_DT_DOCTYPE = My.Database.GetDatatable(sql)
My.Application.Globix.CURRENT_DOCTYPE_DuplicateHandling = My.Application.Globix.CURR_DT_DOCTYPE.Rows(0).Item("DUPLICATE_HANDLING").ToString
Refresh_IndexeMan(cmbDoctype.SelectedValue)
End If
End If
End Sub
Private Sub Refresh_IndexeMan(dokartid As Integer)
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"
DT_INDEXEMAN = My.Database.GetDatatable(oSql)
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)
MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in Refresh_IndexeMan:")
End Try
End Sub
Sub addLabel(indexname As String, hinweis As String, ylbl As Integer, anz As String)
Dim lbl As New Label With {
.Name = "lbl" & indexname,
.AutoSize = True,
.Text = hinweis,
.Location = New Point(11, ylbl)
}
pnlIndex.Controls.Add(lbl)
End Sub
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
Private Sub LoadIndexe_Man()
Try
Dim oControlCount As Integer = 1
Dim oLabelPosition As Integer = 11
Dim oControlPosition As Integer = 33
Dim oControls As New GlobixControls(_LogConfig, pnlIndex, Me)
If DT_INDEXEMAN.Rows.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")
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")
If oDataType <> "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
Dim DefaultValue = GetPlaceholderValue(oRow.Item("DEFAULT_VALUE"), My.Application.Globix.CURRENT_WORKFILE, My.Application.User.ShortName)
' End If
Select Case oDataType
Case "BOOLEAN"
Dim chk As CheckBox = oControls.AddCheckBox(oControlName, oControlPosition, DefaultValue, 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 oControl = oControls.AddVorschlag_ComboBox(oControlName, oControlPosition, oConnectionId, oRow.Item("SQL_RESULT"), MultiSelect, oDataType, DefaultValue, AddNewItems, PreventDuplicates, oSQLSuggestion)
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 "VARCHAR"
If (oSQLSuggestion = True And oRow.Item("SQL_RESULT").ToString.Length > 0) Or MultiSelect = True Then
Dim oControl = oControls.AddVorschlag_ComboBox(oControlName, oControlPosition, oConnectionId, oRow.Item("SQL_RESULT"), MultiSelect, oDataType, DefaultValue, AddNewItems, PreventDuplicates, oSQLSuggestion)
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(My.Application.Globix.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, oDataType, DefaultValue)
pnlIndex.Controls.Add(oPicker)
Case Else
If My.Application.User.Language = "de-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
oControlPosition += 50
'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
_Logger.Error(ex)
MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in LoadIndexe_Man:")
End Try
End Sub
Function GetPlaceholderValue(InputValue As String, FileName As String, UserShortName As String) As String
Dim oResult As String
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
Return oResult
End Function
'Function Check_HistoryValues(Indexname As String, Dokart As String) As String
' Try
' Dim result = Nothing
' Dim DT As DataTable = MyDataset.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
Sub ClearNotice()
labelNotice.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
labelNotice.Caption = String.Empty
End Sub
Private Sub frmGlobix_Index_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
If File.Exists(My.Application.Globix.CURRENT_FILENAME) Then
Select Case CancelAttempts
Case 0
If My.Application.User.Language = "de-DE" Then
MsgBox("Bitte indexieren Sie die Datei vollständig!" & vbNewLine & "(Abbruch 1 des Indexierungsvorgangs)", MsgBoxStyle.Information)
Else
MsgBox("Please Index file completely" & vbNewLine & "(Abort 1 of Indexdialog)", MsgBoxStyle.Information)
End If
CancelAttempts = CancelAttempts + 1
e.Cancel = True
Case 1
Dim result As MsgBoxResult
If My.Application.User.Language = "de-DE" Then
result = MessageBox.Show("Sie brechen nun zum zweiten Mal den Indexierungsvorgang ab!" & vbNewLine & "Wollen Sie die Indexierung aller Dateien abbrechen?", "Bestätigung erforderlich:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
Else
result = MessageBox.Show("You abort the indexdialog for the 2nd time!" & vbNewLine & "Do You want to abort indexing?", "Confirmation needed:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
End If
If result = MsgBoxResult.Yes Then
Dim containsfw_file As Boolean = False
Try
My.Application.Globix.ABORT_INDEXING = True
Dim sql As String = $"SELECT * FROM TBGI_FILES_USER WHERE WORKED = 0 AND UPPER(USER@WORK) = UPPER('{My.Application.User.UserName}')"
Dim DT As DataTable = My.Database.GetDatatable(sql)
Dim anz = DT.Rows.Count
For Each Filerow As DataRow In DT.Rows
Dim filestring As String = Filerow.Item("FILENAME2WORK")
Dim handletype As String = Filerow.Item("HANDLE_TYPE")
If handletype = "|MSGONLY|" Or handletype = "|ATTMNTEXTRACTED|" Then
Try
System.IO.File.Delete(filestring)
Catch ex As Exception
End Try
ElseIf handletype.StartsWith("|FW") Then
containsfw_file = True
End If
Next
'Zuerst die Daten des Ablaufs löschen
If My.Database.ExecuteNonQuery($"DELETE FROM TBGI_FILES_USER WHERE UPPER(USER@WORK) = UPPER('{My.Application.User.UserName}')") = True Then
If containsfw_file = True Then
If My.Application.User.Language = "de-DE" Then
MsgBox("Der Indexierungsprozess beinhaltete (auch) Dateien per Folderwatch!" & vbNewLine & "Diese Dateien wurden nicht gelöscht und verbleiben im Folderwatch-Verzeichnis!" & vbNewLine & "Bitte verschieben Sie die Dateien ggfls.", MsgBoxStyle.Information, "Achtung - Hinweis:")
Else
MsgBox("The Indexingprocess contained (also) files from folderwatch!" & vbNewLine & "These files weren't deleted and will stay in the folderwatch-folder!" & vbNewLine & "Please move these files manually.", MsgBoxStyle.Information, "Achtung - Hinweis:")
End If
End If
End If
Catch ex As Exception
_Logger.Error(ex)
MsgBox("Unexpected Error in Abort Indexing: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
Try
My.Application.Globix.INDEXING_ACTIVE = False
DocumentViewer1.CloseDocument()
DocumentViewer1.Done()
clswindowLocation.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)
MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in Schliessen des Formulares:")
End Try
e.Cancel = False
Else
e.Cancel = True
End If
Case Else
Try
My.Application.Globix.INDEXING_ACTIVE = False
DocumentViewer1.CloseDocument()
DocumentViewer1.Done()
clswindowLocation.SaveFormLocationSize(Me)
My.Settings.Save()
Catch ex As Exception
_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
Else
My.Application.Globix.INDEXING_ACTIVE = False
End If
End Sub
Private Sub BarButtonItem1_ItemClick_1(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
'ClearError()
'ClearNotice()
'Me.Cursor = Cursors.WaitCursor
'Refresh_RegexTable()
'For Each rowregex As DataRow In My.Application.BASE_DATA_DT_REGEX.Rows
' If rowregex.Item("FUNCTION_NAME") = "CLEAN_FILENAME" Then
' My.Application.Globix.REGEX_CLEAN_FILENAME = rowregex.Item("REGEX")
' 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.Database.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()
' 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
' If My.Application.User.Language = "de-DE" Then
' MsgBox("Die Datei wurde erfolgreich verarbeitet!" & vbNewLine & "Ablagepfad:" & vbNewLine & My.Application.Globix.CURRENT_NEWFILENAME, MsgBoxStyle.Information, "Erfolgsmeldung")
' Else
' MsgBox("File sucessfully processed!" & vbNewLine & "Path:" & vbNewLine & My.Application.Globix.CURRENT_NEWFILENAME, MsgBoxStyle.Information, "Success")
' End If
' End If
' DocumentViewer1.CloseDocument()
' DocumentViewer1.Done()
' CancelAttempts = 2
' Me.Close()
' End If
'End If
'Me.Cursor = Cursors.Default
End Sub
'Private Function WORK_FILE()
' Try
' Dim oSQL = $"SELECT * FROM VWDDINDEX_MAN WHERE DOK_ID = {My.Application.Globix.CURRENT_DOCTYPE_ID}"
' My.Application.Globix.CURR_DT_MAN_INDEXE = My.Database.GetDatatable(oSQL)
' _Logger.Debug("Manuelle Indexe geladen")
' If My.Application.Globix.CURR_DT_MAN_INDEXE.Rows.Count > 0 Then
' My.Application.Globix.CURRENT_DOCTYPE_ID = Me.cmbDoctype.SelectedValue
' If CheckWrite_IndexeMan(Me.cmbDoctype.SelectedValue) = True Then
' '##### Manuelle Indexe indexiert #####
' _Logger.Info("Datei [" & My.Application.Globix.CURRENT_WORKFILE & "] wird nun indexiert...")
' If FillIndexe_Autom(Me.cmbDoctype.SelectedValue) = True Then
' _Logger.Debug(" ...FillIndexe_Autom durchlaufen")
' 'Den Zielnamen zusammenbauen
' If Name_Generieren() = True Then
' 'Dokumentenviewer ausblenden um keinen Zugriffsfehler zu produzieren
' DocumentViewer1.Done()
' DocumentViewer1.CloseDocument()
' _Logger.Debug(" ...Viewer geschlossen")
' 'Die Datei verschieben
' If Move_File2_Target() = True Then
' _Logger.Debug(" ...Move_File2_Target durchlaufen")
' My.Application.Globix.CURRENT_LASTDOCTYPE = cmbDoctype.Text
' _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.Database.ExecuteNonQuery(oDEL)
' 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 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 = FilterDatatable(My.Application.Globix.CURR_DT_MAN_INDEXE, $"DOK_ID = dokartid AND INDEXNAME = '{oIndexName}'", "OPTIONAL", "", False)
' 'My.Database.ExecuteNonQuery("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & dokartid & " AND NAME = '" & Replace(box.Name, "txt", "") & "'", MyConnectionString, True)
' 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, DigitalData.Controls.LookupGrid.LookupControl2)
' Dim values As List(Of String) = oLookup.SelectedValues
' If values.Count = 0 Then
' Dim oIndexName = Replace(oLookup.Name, "cmbMulti", "")
' Dim optional_index As Boolean = FilterDatatable(My.Application.Globix.CURR_DT_MAN_INDEXE, $"DOK_ID = dokartid AND INDEXNAME = '{oIndexName}'", "OPTIONAL", "", False)
' 'ClassDatabase.Execute_Scalar("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & dokartid & " AND NAME = '" & Replace(oLookup.Name, "cmbMulti", "") & "'", MyConnectionString, True)
' 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 = FilterDatatable(My.Application.Globix.CURR_DT_MAN_INDEXE, $"DOK_ID = dokartid AND INDEXNAME = '{oIndexName}'", "OPTIONAL", "", False)
' 'ClassDatabase.Execute_Scalar("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & dokartid & " AND NAME = '" & Replace(cmbSingle.Name, "cmbSingle", "") & "'", MyConnectionString, True)
' 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 = FilterDatatable(My.Application.Globix.CURR_DT_MAN_INDEXE, $"DOK_ID = dokartid AND INDEXNAME = '{oIndexName}'", "OPTIONAL", "", False)
' 'Dim optional_index As Boolean = ClassDatabase.Execute_Scalar("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & dokartid & " AND NAME = '" & Replace(cmb.Name, "cmb", "") & "'", MyConnectionString, True)
' 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 = FilterDatatable(My.Application.Globix.CURR_DT_MAN_INDEXE, $"DOK_ID = dokartid AND INDEXNAME = '{oIndexName}'", "OPTIONAL", "", False)
' 'ClassDatabase.Execute_Scalar($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {dokartid} AND NAME = '{oIndexName}'", MyConnectionString, True)
' 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
'Function FillIndexe_Autom(dokart_id As Integer)
' Try
' Dim oSQL = $"SELECT * FROM VWDDINDEX_AUTOM WHERE DOK_ID = {My.Application.Globix.CURRENT_DOCTYPE_ID}"
' My.Application.Globix.CURR_DT_AUTO_INDEXE = My.Database.GetDatatable(oSQL)
' 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("Indexiert") = True
' oAutoIndexRow.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, 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 = FilterDatatable(My.Application.Globix.CURR_DT_MAN_INDEXE, $"DOK_ID = {My.Application.Globix.CURRENT_DOCTYPE_ID} AND INDEXNAME = '{oIndexValue}'", "OPTIONAL", "", False)
' 'ClassDatabase.Execute_Scalar($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {CURRENT_DOKART_ID} AND UPPER(NAME) = UPPER('{oIndexValue}')", MyConnectionString, True)
' 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 = FilterDatatable(My.Application.Globix.CURR_DT_MAN_INDEXE, $"DOK_ID = {My.Application.Globix.CURRENT_DOCTYPE_ID} AND INDEXNAME = '{oIndexValue}'", "OPTIONAL", "", False)
' ' ClassDatabase.Execute_Scalar($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {CURRENT_DOKART_ID} AND UPPER(NAME) = UPPER('{oIndexValue}')", MyConnectionString, True)
' 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("Indexiert") = True
' oAutoIndexRow.Item("Indexwert") = String.Join(ClassConstants.VECTORSEPARATOR, oEndResult.ToArray)
' Next
' Else
' Dim oResult = GetAutomaticIndexSQLValue(oSqlResult, oSqlConnectionId, oSqlProvider)
' _Logger.Info("Got a simple SQLResult: " & oResult.ToString)
' oAutoIndexRow.Item("Indexiert") = True
' oAutoIndexRow.Item("Indexwert") = oResult
' End If
' Next
' Return True
' Catch ex As Exception
' _Logger.Error(ex)
' MsgBox(ex.Message)
' Return False
' End Try
'End Function
'Function GetAutomaticIndexSQLValue(SQLCommand As String, vconnectionID As Integer, vProvider As String) As String
' Try
' Dim oConnectionString As String
' oConnectionString = My.Database.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.Database.GetScalarValueConStr(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("Indexwert") = wert_in
' 'Die Nachbearbeitungsschritte laden
' 'FILE AND INDEX
' 'Zuerst nur die Fälle für die Variante ONLY FILE/FOLDER
' Dim DTNB As DataTable = FilterDatatable(My.Application.Globix.CURR_INDEX_MAN_POSTPROCESSING, "IDXMAN_ID = " & idxid & " AND VARIANT = 'ONLY FILE/FOLDER'", "", "SEQUENCE", True)
' 'ClassDatabase.Return_Datatable("SELECT * FROM TBDD_INDEX_MAN_POSTPROCESSING WHERE IDXMAN_ID = " & idxid & " AND VARIANT = 'ONLY FILE/FOLDER' ORDER BY SEQUENCE")
' If DTNB Is Nothing = False Then
' If DTNB.Rows.Count > 0 Then
' value_post = clsPostProcessing.Get_Nachbearbeitung_Wert(wert_in, DTNB)
' oDataRow.Item("Indexwert") = wert_in
' oDataRow.Item("Indexwert_File") = value_post
' End If
' End If
' 'Jetzt die Fälle für die Variante FILE AND INDEX
' DTNB = Nothing
' DTNB = FilterDatatable(My.Application.Globix.CURR_INDEX_MAN_POSTPROCESSING, "IDXMAN_ID = " & idxid & " AND VARIANT = 'FILE AND INDEX'", "", "SEQUENCE", True)
' 'ClassDatabase.Return_Datatable("SELECT * FROM TBDD_INDEX_MAN_POSTPROCESSING WHERE IDXMAN_ID = " & idxid & " AND VARIANT = 'FILE AND INDEX' ORDER BY SEQUENCE")
' If DTNB Is Nothing = False Then
' If DTNB.Rows.Count > 0 Then
' value_post = clsPostProcessing.Get_Nachbearbeitung_Wert(wert_in, DTNB)
' oDataRow.Item("Indexwert") = value_post
' End If
' End If
' End If
' oDataRow.Item("Indexiert") = 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
End Class