jj: WIP - VectorIndexing
This commit is contained in:
parent
469f0f3474
commit
d35106f7d6
3
Global_Indexer/ClassConstants.vb
Normal file
3
Global_Indexer/ClassConstants.vb
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Public Class ClassConstants
|
||||||
|
Public Const VECTORSEPARATOR = "╚"
|
||||||
|
End Class
|
||||||
@ -45,4 +45,18 @@ Public Class ClassHelper
|
|||||||
CURRENT_DT_REGEX = ClassDatabase.Return_Datatable("SELECT * FROM TBGI_FUNCTION_REGEX")
|
CURRENT_DT_REGEX = ClassDatabase.Return_Datatable("SELECT * FROM TBGI_FUNCTION_REGEX")
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Überprüft einen Wert auf verschiedene Arten von "Null" und gibt einen Standard-Wert zurück, wenn der Wert "Null" ist.
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="value">Der zu überprüfende Wert</param>
|
||||||
|
''' <param name="defaultValue">Der Standard Wert</param>
|
||||||
|
''' <returns>value oder wenn dieser "Null" ist, defaultValue</returns>
|
||||||
|
Public Shared Function NotNull(Of T)(ByVal value As T, ByVal defaultValue As T) As T
|
||||||
|
If IsNothing(value) OrElse String.IsNullOrEmpty(value.ToString) OrElse IsDBNull(value) Then
|
||||||
|
Return defaultValue
|
||||||
|
Else
|
||||||
|
Return value
|
||||||
|
End If
|
||||||
|
End Function
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@ -1,51 +1,112 @@
|
|||||||
Imports System.Text.RegularExpressions
|
Imports System.Text.RegularExpressions
|
||||||
|
|
||||||
Public Class ClassPostprocessing
|
Public Class ClassPostprocessing
|
||||||
Public Shared Function Get_Nachbearbeitung_Wert(idxvalue As String, DTNB As DataTable) As String
|
|
||||||
Dim result As String = idxvalue
|
|
||||||
Try
|
|
||||||
For Each row As DataRow In DTNB.Rows
|
|
||||||
Select Case row.Item("TYPE").ToString.ToUpper
|
|
||||||
Case "VBSPLIT"
|
|
||||||
If LogErrorsOnly = False Then ClassLogger.Add(" ...Nachbearbeitung mit VBSPLIT", False)
|
|
||||||
Dim strSplit() As String
|
|
||||||
strSplit = result.Split(row.Item("TEXT1"))
|
|
||||||
For i As Integer = 0 To strSplit.Length - 1
|
|
||||||
If i = CInt(row.Item("TEXT2")) Then
|
|
||||||
If LogErrorsOnly = False Then ClassLogger.Add(" ...Split-Ergebnis für Index (" & i.ToString & "): " & strSplit(i), False)
|
|
||||||
result = strSplit(i).ToString
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
Case "VBREPLACE"
|
|
||||||
If LogErrorsOnly = False Then
|
|
||||||
ClassLogger.Add(" ...Nachbearbeitung mit VBREPLACE", False)
|
|
||||||
ClassLogger.Add(" ...Ersetze '" & row.Item("TEXT1") & "' mit '" & row.Item("TEXT2") & "'", False)
|
|
||||||
result = result.Replace(row.Item("TEXT1"), row.Item("TEXT2"))
|
|
||||||
End If
|
|
||||||
|
|
||||||
result = result.Replace(row.Item("TEXT1"), row.Item("TEXT2"))
|
Private Const VBSPLIT = "VBSPLIT"
|
||||||
Case "REG. EXPRESSION"
|
Private Const VBREPLACE = "VBREPLACE"
|
||||||
|
Private Const REGEXPRESSION = "REG. EXPRESSION"
|
||||||
|
|
||||||
|
Public Shared Function Get_Nachbearbeitung_Wert(idxvalue As String, Datatable As DataTable) As String
|
||||||
|
Dim oIndexValues As List(Of String) = idxvalue.Split(ClassConstants.VECTORSEPARATOR).ToList()
|
||||||
|
|
||||||
|
Try
|
||||||
|
For Each oDataRow As DataRow In Datatable.Rows
|
||||||
|
Dim oResult As New List(Of String)
|
||||||
|
Dim oType As String = oDataRow.Item("TYPE").ToString.ToUpper
|
||||||
|
|
||||||
|
Select Case oType
|
||||||
|
Case VBSPLIT
|
||||||
|
If LogErrorsOnly = False Then ClassLogger.Add(" ...Nachbearbeitung mit VBSPLIT", False)
|
||||||
|
|
||||||
|
Dim oSeparator As String = oDataRow.Item("TEXT1")
|
||||||
|
Dim oSplitIndex As Integer = 0
|
||||||
|
Integer.TryParse(oDataRow.Item("TEXT2"), oSplitIndex)
|
||||||
|
|
||||||
|
For Each oIndexValue In oIndexValues
|
||||||
|
Dim oSplitted As List(Of String) = oIndexValue.Split(oSeparator).ToList()
|
||||||
|
oResult.Add(oSplitted.Item(oSplitIndex))
|
||||||
|
Next
|
||||||
|
|
||||||
|
Case VBREPLACE
|
||||||
|
Dim oFindString = oDataRow.Item("TEXT1")
|
||||||
|
Dim oReplaceString = oDataRow.Item("TEXT2")
|
||||||
|
|
||||||
|
If LogErrorsOnly = False Then ClassLogger.Add(" ...Nachbearbeitung mit VBREPLACE", False)
|
||||||
|
If LogErrorsOnly = False Then ClassLogger.Add(" ...Ersetze '" & oFindString & "' mit '" & oReplaceString & "'", False)
|
||||||
|
|
||||||
|
For Each oIndexValue In oIndexValues
|
||||||
|
Dim oReplaceResult = oIndexValue.Replace(oFindString, oReplaceString)
|
||||||
|
oResult.Add(oReplaceResult)
|
||||||
|
Next
|
||||||
|
Case REGEXPRESSION
|
||||||
If LogErrorsOnly = False Then ClassLogger.Add(" ...Nachbearbeitung mit RegEx", False)
|
If LogErrorsOnly = False Then ClassLogger.Add(" ...Nachbearbeitung mit RegEx", False)
|
||||||
Dim RegexList As New List(Of System.Text.RegularExpressions.Regex)
|
|
||||||
Dim Regex As New System.Text.RegularExpressions.Regex(row.Item("TEXT1"), System.Text.RegularExpressions.RegexOptions.IgnoreCase)
|
Dim oRegexList As New List(Of Regex)
|
||||||
RegexList.Add(Regex)
|
Dim oRegex As New Regex(oDataRow.Item("TEXT1"), RegexOptions.IgnoreCase)
|
||||||
'
|
|
||||||
Dim resultRegex = ClassPostprocessing.extractFromStringviaRE(result, RegexList)
|
oRegexList.Add(oRegex)
|
||||||
If Not IsNothing(resultRegex) Then
|
|
||||||
If LogErrorsOnly = False Then ClassLogger.Add(" ...Ergebnis des RegEx: " & resultRegex.ToString, False)
|
For Each oIndexValue In oIndexValues
|
||||||
result = resultRegex.ToString
|
Dim oProcessedString = extractFromStringviaRE(oIndexValue, oRegexList)
|
||||||
Else
|
oResult.Add(oProcessedString)
|
||||||
ClassLogger.Add("Postprocessing RegEx konnte kein Ergebnis auswerten!", True)
|
|
||||||
End If
|
If LogErrorsOnly = False Then ClassLogger.Add(" ...Ergebnis des RegEx: " & oProcessedString, False)
|
||||||
|
Next
|
||||||
End Select
|
End Select
|
||||||
|
|
||||||
|
oIndexValues = oResult
|
||||||
Next
|
Next
|
||||||
Return result
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
ClassLogger.Add(" - Unvorhergesehener Unexpected error in Get_Nachbearbeitung_Wert - result: " & result & " - Fehler: " & vbNewLine & ex.Message)
|
|
||||||
MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in Get_Nachbearbeitung_Wert:")
|
MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in Get_Nachbearbeitung_Wert:")
|
||||||
Return result
|
ClassLogger.Add(" - Unvorhergesehener Unexpected error in Get_Nachbearbeitung_Wert - result: " & idxvalue & " - Fehler: " & vbNewLine & ex.Message)
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
|
Return String.Join(ClassConstants.VECTORSEPARATOR, oIndexValues.ToArray)
|
||||||
|
|
||||||
|
'Dim result As String = idxvalue
|
||||||
|
'Try
|
||||||
|
' For Each row As DataRow In Datatable.Rows
|
||||||
|
' Select Case row.Item("TYPE").ToString.ToUpper
|
||||||
|
' Case "VBSPLIT"
|
||||||
|
' If LogErrorsOnly = False Then ClassLogger.Add(" ...Nachbearbeitung mit VBSPLIT", False)
|
||||||
|
' Dim strSplit() As String
|
||||||
|
' strSplit = result.Split(row.Item("TEXT1"))
|
||||||
|
' For i As Integer = 0 To strSplit.Length - 1
|
||||||
|
' If i = CInt(row.Item("TEXT2")) Then
|
||||||
|
' If LogErrorsOnly = False Then ClassLogger.Add(" ...Split-Ergebnis für Index (" & i.ToString & "): " & strSplit(i), False)
|
||||||
|
' result = strSplit(i).ToString
|
||||||
|
' End If
|
||||||
|
' Next
|
||||||
|
' Case "VBREPLACE"
|
||||||
|
' If LogErrorsOnly = False Then
|
||||||
|
' ClassLogger.Add(" ...Nachbearbeitung mit VBREPLACE", False)
|
||||||
|
' ClassLogger.Add(" ...Ersetze '" & row.Item("TEXT1") & "' mit '" & row.Item("TEXT2") & "'", False)
|
||||||
|
' result = result.Replace(row.Item("TEXT1"), row.Item("TEXT2"))
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' result = result.Replace(row.Item("TEXT1"), row.Item("TEXT2"))
|
||||||
|
' Case "REG. EXPRESSION"
|
||||||
|
' If LogErrorsOnly = False Then ClassLogger.Add(" ...Nachbearbeitung mit RegEx", False)
|
||||||
|
' Dim RegexList As New List(Of System.Text.RegularExpressions.Regex)
|
||||||
|
' Dim Regex As New System.Text.RegularExpressions.Regex(row.Item("TEXT1"), System.Text.RegularExpressions.RegexOptions.IgnoreCase)
|
||||||
|
' RegexList.Add(Regex)
|
||||||
|
' '
|
||||||
|
' Dim resultRegex = ClassPostprocessing.extractFromStringviaRE(result, RegexList)
|
||||||
|
' If Not IsNothing(resultRegex) Then
|
||||||
|
' If LogErrorsOnly = False Then ClassLogger.Add(" ...Ergebnis des RegEx: " & resultRegex.ToString, False)
|
||||||
|
' result = resultRegex.ToString
|
||||||
|
' Else
|
||||||
|
' ClassLogger.Add("Postprocessing RegEx konnte kein Ergebnis auswerten!", True)
|
||||||
|
' End If
|
||||||
|
' End Select
|
||||||
|
' Next
|
||||||
|
' Return result
|
||||||
|
'Catch ex As Exception
|
||||||
|
' ClassLogger.Add(" - Unvorhergesehener Unexpected error in Get_Nachbearbeitung_Wert - result: " & result & " - Fehler: " & vbNewLine & ex.Message)
|
||||||
|
' MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in Get_Nachbearbeitung_Wert:")
|
||||||
|
' Return result
|
||||||
|
'End Try
|
||||||
|
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
''' <summary>
|
''' <summary>
|
||||||
|
|||||||
@ -444,10 +444,7 @@ Public Class ClassWindream
|
|||||||
|
|
||||||
If indexnamen Is Nothing Then Return False
|
If indexnamen Is Nothing Then Return False
|
||||||
|
|
||||||
For Each index As String In indexnamen
|
Return indexnamen.Contains(indexname)
|
||||||
If index = indexname Then Return True
|
|
||||||
Next
|
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
MsgBox("Beim Prüfen ob ein Index für einen Objekttypen existiert, ist ein Fehler aufgetreten." & vbNewLine & vbNewLine & "Fehlernachricht:" & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Unexpected error inm Prüfen auf Existenz eines Index in einem Objekttyp")
|
MsgBox("Beim Prüfen ob ein Index für einen Objekttypen existiert, ist ein Fehler aufgetreten." & vbNewLine & vbNewLine & "Fehlernachricht:" & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Unexpected error inm Prüfen auf Existenz eines Index in einem Objekttyp")
|
||||||
End Try
|
End Try
|
||||||
|
|||||||
@ -185,6 +185,7 @@
|
|||||||
<Compile Include="AboutBox1.vb">
|
<Compile Include="AboutBox1.vb">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="ClassConstants.vb" />
|
||||||
<Compile Include="ClassControls.vb" />
|
<Compile Include="ClassControls.vb" />
|
||||||
<Compile Include="ClassDatabase.vb" />
|
<Compile Include="ClassDatabase.vb" />
|
||||||
<Compile Include="ClassDragDrop.vb" />
|
<Compile Include="ClassDragDrop.vb" />
|
||||||
|
|||||||
22
Global_Indexer/frmAdministration.Designer.vb
generated
22
Global_Indexer/frmAdministration.Designer.vb
generated
@ -232,6 +232,7 @@ Partial Class frmAdministration
|
|||||||
Me.VWGI_DOCTYPE_GROUPBindingSource = New System.Windows.Forms.BindingSource(Me.components)
|
Me.VWGI_DOCTYPE_GROUPBindingSource = New System.Windows.Forms.BindingSource(Me.components)
|
||||||
Me.XtraTabPage10 = New DevExpress.XtraTab.XtraTabPage()
|
Me.XtraTabPage10 = New DevExpress.XtraTab.XtraTabPage()
|
||||||
Me.GroupBox4 = New System.Windows.Forms.GroupBox()
|
Me.GroupBox4 = New System.Windows.Forms.GroupBox()
|
||||||
|
Me.Label10 = New System.Windows.Forms.Label()
|
||||||
Me.FOLDER_FOR_INDEXTextBox = New System.Windows.Forms.TextBox()
|
Me.FOLDER_FOR_INDEXTextBox = New System.Windows.Forms.TextBox()
|
||||||
Me.Label25 = New System.Windows.Forms.Label()
|
Me.Label25 = New System.Windows.Forms.Label()
|
||||||
Me.btncrFolder_delete = New System.Windows.Forms.Button()
|
Me.btncrFolder_delete = New System.Windows.Forms.Button()
|
||||||
@ -260,7 +261,6 @@ Partial Class frmAdministration
|
|||||||
Me.TBDD_DOKUMENTARTBindingNavigator = New System.Windows.Forms.BindingNavigator(Me.components)
|
Me.TBDD_DOKUMENTARTBindingNavigator = New System.Windows.Forms.BindingNavigator(Me.components)
|
||||||
Me.BindingNavigatorAddNewItem = New System.Windows.Forms.ToolStripButton()
|
Me.BindingNavigatorAddNewItem = New System.Windows.Forms.ToolStripButton()
|
||||||
Me.BindingNavigatorCountItem = New System.Windows.Forms.ToolStripLabel()
|
Me.BindingNavigatorCountItem = New System.Windows.Forms.ToolStripLabel()
|
||||||
Me.BindingNavigatorDeleteItem = New System.Windows.Forms.ToolStripButton()
|
|
||||||
Me.BindingNavigatorMoveFirstItem = New System.Windows.Forms.ToolStripButton()
|
Me.BindingNavigatorMoveFirstItem = New System.Windows.Forms.ToolStripButton()
|
||||||
Me.BindingNavigatorMovePreviousItem = New System.Windows.Forms.ToolStripButton()
|
Me.BindingNavigatorMovePreviousItem = New System.Windows.Forms.ToolStripButton()
|
||||||
Me.BindingNavigatorSeparator = New System.Windows.Forms.ToolStripSeparator()
|
Me.BindingNavigatorSeparator = New System.Windows.Forms.ToolStripSeparator()
|
||||||
@ -269,6 +269,7 @@ Partial Class frmAdministration
|
|||||||
Me.BindingNavigatorMoveNextItem = New System.Windows.Forms.ToolStripButton()
|
Me.BindingNavigatorMoveNextItem = New System.Windows.Forms.ToolStripButton()
|
||||||
Me.BindingNavigatorMoveLastItem = New System.Windows.Forms.ToolStripButton()
|
Me.BindingNavigatorMoveLastItem = New System.Windows.Forms.ToolStripButton()
|
||||||
Me.BindingNavigatorSeparator2 = New System.Windows.Forms.ToolStripSeparator()
|
Me.BindingNavigatorSeparator2 = New System.Windows.Forms.ToolStripSeparator()
|
||||||
|
Me.BindingNavigatorDeleteItem = New System.Windows.Forms.ToolStripButton()
|
||||||
Me.TBDD_DOKUMENTARTBindingNavigatorSaveItem = New System.Windows.Forms.ToolStripButton()
|
Me.TBDD_DOKUMENTARTBindingNavigatorSaveItem = New System.Windows.Forms.ToolStripButton()
|
||||||
Me.ToolStripComboBox1 = New System.Windows.Forms.ToolStripComboBox()
|
Me.ToolStripComboBox1 = New System.Windows.Forms.ToolStripComboBox()
|
||||||
Me.ToolStripButton40 = New System.Windows.Forms.ToolStripButton()
|
Me.ToolStripButton40 = New System.Windows.Forms.ToolStripButton()
|
||||||
@ -1930,6 +1931,7 @@ Partial Class frmAdministration
|
|||||||
'
|
'
|
||||||
'GroupBox4
|
'GroupBox4
|
||||||
'
|
'
|
||||||
|
Me.GroupBox4.Controls.Add(Me.Label10)
|
||||||
Me.GroupBox4.Controls.Add(Me.FOLDER_FOR_INDEXTextBox)
|
Me.GroupBox4.Controls.Add(Me.FOLDER_FOR_INDEXTextBox)
|
||||||
Me.GroupBox4.Controls.Add(Me.Label25)
|
Me.GroupBox4.Controls.Add(Me.Label25)
|
||||||
Me.GroupBox4.Controls.Add(Me.btncrFolder_delete)
|
Me.GroupBox4.Controls.Add(Me.btncrFolder_delete)
|
||||||
@ -1939,6 +1941,11 @@ Partial Class frmAdministration
|
|||||||
Me.GroupBox4.Name = "GroupBox4"
|
Me.GroupBox4.Name = "GroupBox4"
|
||||||
Me.GroupBox4.TabStop = False
|
Me.GroupBox4.TabStop = False
|
||||||
'
|
'
|
||||||
|
'Label10
|
||||||
|
'
|
||||||
|
resources.ApplyResources(Me.Label10, "Label10")
|
||||||
|
Me.Label10.Name = "Label10"
|
||||||
|
'
|
||||||
'FOLDER_FOR_INDEXTextBox
|
'FOLDER_FOR_INDEXTextBox
|
||||||
'
|
'
|
||||||
Me.FOLDER_FOR_INDEXTextBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.TBDD_DOKUMENTARTBindingSource, "FOLDER_FOR_INDEX", True))
|
Me.FOLDER_FOR_INDEXTextBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.TBDD_DOKUMENTARTBindingSource, "FOLDER_FOR_INDEX", True))
|
||||||
@ -2128,12 +2135,6 @@ Partial Class frmAdministration
|
|||||||
Me.BindingNavigatorCountItem.Name = "BindingNavigatorCountItem"
|
Me.BindingNavigatorCountItem.Name = "BindingNavigatorCountItem"
|
||||||
resources.ApplyResources(Me.BindingNavigatorCountItem, "BindingNavigatorCountItem")
|
resources.ApplyResources(Me.BindingNavigatorCountItem, "BindingNavigatorCountItem")
|
||||||
'
|
'
|
||||||
'BindingNavigatorDeleteItem
|
|
||||||
'
|
|
||||||
Me.BindingNavigatorDeleteItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
|
|
||||||
resources.ApplyResources(Me.BindingNavigatorDeleteItem, "BindingNavigatorDeleteItem")
|
|
||||||
Me.BindingNavigatorDeleteItem.Name = "BindingNavigatorDeleteItem"
|
|
||||||
'
|
|
||||||
'BindingNavigatorMoveFirstItem
|
'BindingNavigatorMoveFirstItem
|
||||||
'
|
'
|
||||||
Me.BindingNavigatorMoveFirstItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
|
Me.BindingNavigatorMoveFirstItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
|
||||||
@ -2178,6 +2179,12 @@ Partial Class frmAdministration
|
|||||||
Me.BindingNavigatorSeparator2.Name = "BindingNavigatorSeparator2"
|
Me.BindingNavigatorSeparator2.Name = "BindingNavigatorSeparator2"
|
||||||
resources.ApplyResources(Me.BindingNavigatorSeparator2, "BindingNavigatorSeparator2")
|
resources.ApplyResources(Me.BindingNavigatorSeparator2, "BindingNavigatorSeparator2")
|
||||||
'
|
'
|
||||||
|
'BindingNavigatorDeleteItem
|
||||||
|
'
|
||||||
|
Me.BindingNavigatorDeleteItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
|
||||||
|
resources.ApplyResources(Me.BindingNavigatorDeleteItem, "BindingNavigatorDeleteItem")
|
||||||
|
Me.BindingNavigatorDeleteItem.Name = "BindingNavigatorDeleteItem"
|
||||||
|
'
|
||||||
'TBDD_DOKUMENTARTBindingNavigatorSaveItem
|
'TBDD_DOKUMENTARTBindingNavigatorSaveItem
|
||||||
'
|
'
|
||||||
Me.TBDD_DOKUMENTARTBindingNavigatorSaveItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
|
Me.TBDD_DOKUMENTARTBindingNavigatorSaveItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
|
||||||
@ -3466,4 +3473,5 @@ Partial Class frmAdministration
|
|||||||
Friend WithEvents MULTISELECTCheckBox As CheckBox
|
Friend WithEvents MULTISELECTCheckBox As CheckBox
|
||||||
Friend WithEvents VKT_PREVENT_MULTIPLE_VALUESCheckbox As CheckBox
|
Friend WithEvents VKT_PREVENT_MULTIPLE_VALUESCheckbox As CheckBox
|
||||||
Friend WithEvents VKT_ADD_ITEMCheckbox As CheckBox
|
Friend WithEvents VKT_ADD_ITEMCheckbox As CheckBox
|
||||||
|
Friend WithEvents Label10 As Label
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -412,15 +412,15 @@ Public Class frmAdministration
|
|||||||
If frmloaded = True Then
|
If frmloaded = True Then
|
||||||
If SUGGESTIONCheckBox.CheckState = CheckState.Checked Then
|
If SUGGESTIONCheckBox.CheckState = CheckState.Checked Then
|
||||||
btnSQLView.Visible = True
|
btnSQLView.Visible = True
|
||||||
VKT_ADD_ITEMCheckbox.Enabled = True
|
'VKT_ADD_ITEMCheckbox.Enabled = True
|
||||||
Else
|
Else
|
||||||
btnSQLView.Visible = False
|
btnSQLView.Visible = False
|
||||||
|
|
||||||
If (_indexIsVectorField) Then
|
'If (_indexIsVectorField) Then
|
||||||
VKT_ADD_ITEMCheckbox.Enabled = True
|
' VKT_ADD_ITEMCheckbox.Enabled = True
|
||||||
Else
|
'Else
|
||||||
VKT_ADD_ITEMCheckbox.Enabled = False
|
' VKT_ADD_ITEMCheckbox.Enabled = False
|
||||||
End If
|
'End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|||||||
@ -438,7 +438,7 @@ Public Class frmIndex
|
|||||||
Return ""
|
Return ""
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
Function Get_AutomatischerIndex_SQL(vsqlstatement As String, vconnectionID As Integer, vProvider As String)
|
Function GetAutomaticIndexSQLValue(vsqlstatement As String, vconnectionID As Integer, vProvider As String)
|
||||||
Try
|
Try
|
||||||
Dim connectionString As String
|
Dim connectionString As String
|
||||||
connectionString = ClassFormFunctions.GetConnectionString(vconnectionID)
|
connectionString = ClassFormFunctions.GetConnectionString(vconnectionID)
|
||||||
@ -933,7 +933,7 @@ Public Class frmIndex
|
|||||||
result = True
|
result = True
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
Dim vectorValue = String.Join(";", values)
|
Dim vectorValue = String.Join(ClassConstants.VECTORSEPARATOR, values)
|
||||||
Indexwert_Postprocessing(Replace(cmbMulti.Name, "cmbMulti", ""), vectorValue)
|
Indexwert_Postprocessing(Replace(cmbMulti.Name, "cmbMulti", ""), vectorValue)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@ -997,6 +997,9 @@ Public Class frmIndex
|
|||||||
Indexwert_Postprocessing(Replace(chk.Name, "chk", ""), chk.Checked)
|
Indexwert_Postprocessing(Replace(chk.Name, "chk", ""), chk.Checked)
|
||||||
result = True
|
result = True
|
||||||
End If
|
End If
|
||||||
|
If TypeOf (ctrl) Is Button Then
|
||||||
|
Continue For
|
||||||
|
End If
|
||||||
If ctrl.Name.StartsWith("lbl") = False And result = False Then
|
If ctrl.Name.StartsWith("lbl") = False And result = False Then
|
||||||
ClassLogger.Add("Die Überprüfung der manuellen Indices ist fehlerhaft. Bitte informieren Sie den Systembetreuer", True)
|
ClassLogger.Add("Die Überprüfung der manuellen Indices ist fehlerhaft. Bitte informieren Sie den Systembetreuer", True)
|
||||||
Return False
|
Return False
|
||||||
@ -1344,7 +1347,7 @@ Public Class frmIndex
|
|||||||
If indexType < ClassWindream.WMObjectVariableValueTypeVector Then
|
If indexType < ClassWindream.WMObjectVariableValueTypeVector Then
|
||||||
indexierung_erfolgreich = ClassWindream.DateiIndexieren(CURRENT_NEWFILENAME, indexname, idxvalue)
|
indexierung_erfolgreich = ClassWindream.DateiIndexieren(CURRENT_NEWFILENAME, indexname, idxvalue)
|
||||||
Else
|
Else
|
||||||
Dim indexArray = Split(idxvalue, ";")
|
Dim indexArray = Split(idxvalue, ClassConstants.VECTORSEPARATOR)
|
||||||
indexierung_erfolgreich = ClassWindream.Indexiere(CURRENT_NEWFILENAME.Substring(2), indexname, indexArray)
|
indexierung_erfolgreich = ClassWindream.Indexiere(CURRENT_NEWFILENAME.Substring(2), indexname, indexArray)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@ -1355,7 +1358,7 @@ Public Class frmIndex
|
|||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
If LogErrorsOnly = False Then
|
If LogErrorsOnly = False Then
|
||||||
ClassLogger.Add(" >> No Indexing: indexname: " & indexname, False)
|
ClassLogger.Add(" >> No Indexing: indexname: " & indexname, False)
|
||||||
ClassLogger.Add(" >> No Indexing: is optional? " & optional_Index.ToString, False)
|
ClassLogger.Add(" >> No Indexing: is optional? " & optional_Index.ToString, False)
|
||||||
End If
|
End If
|
||||||
@ -2188,161 +2191,319 @@ Public Class frmIndex
|
|||||||
cmbName.Items.Add(Value)
|
cmbName.Items.Add(Value)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Function GetPlaceholderValue(InputValue As String, FileName As String, UserShortName As String)
|
||||||
|
Dim oResult = Nothing
|
||||||
|
|
||||||
|
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"
|
||||||
|
oResult = Environment.UserName
|
||||||
|
Case "$Usercode"
|
||||||
|
oResult = UserShortName
|
||||||
|
End Select
|
||||||
|
Catch ex As Exception
|
||||||
|
ClassLogger.Add("Error in ReplacePlaceholders: " & ex.Message)
|
||||||
|
oResult = Nothing
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return oResult
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Function StripPlaceholder(Placeholder As String) As String
|
||||||
|
Dim oResult = Placeholder
|
||||||
|
oResult = Regex.Replace(oResult, "^\[%", "")
|
||||||
|
oResult = Regex.Replace(oResult, "\]$", "")
|
||||||
|
Return oResult
|
||||||
|
End Function
|
||||||
|
|
||||||
Function FillIndexe_Autom(dokart_id As Integer)
|
Function FillIndexe_Autom(dokart_id As Integer)
|
||||||
Try
|
Try
|
||||||
Me.VWINDEX_AUTOMTableAdapter.Fill(Me.MyDataset.VWDDINDEX_AUTOM, CURRENT_DOKART_ID)
|
|
||||||
Dim DT_INDEXAUTOM As DataTable = MyDataset.VWDDINDEX_AUTOM
|
|
||||||
If DT_INDEXAUTOM.Rows.Count > 0 Then
|
|
||||||
' MsgBox(DT.Rows.Count.ToString)
|
|
||||||
For Each DR_AUTOINDEX As DataRow In DT_INDEXAUTOM.Rows
|
|
||||||
Dim optionalIndex As Boolean
|
|
||||||
Dim indexname As String = DR_AUTOINDEX.Item("INDEXNAME")
|
|
||||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Build Automatischer Index '" & indexname & "'", False)
|
|
||||||
If DR_AUTOINDEX.Item("SQL_RESULT").ToString <> String.Empty And CBool(DR_AUTOINDEX.Item("SQL_ACTIVE")) = True Then
|
|
||||||
' Regulären Ausdruck zum Auslesen der windream-Indexe definieren
|
|
||||||
Dim preg As String = "\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}"
|
|
||||||
' SQL-String für aktuellen INdex laden
|
|
||||||
Dim SqlString As String = DR_AUTOINDEX.Item("SQL_RESULT")
|
|
||||||
' einen Regulären Ausdruck laden
|
|
||||||
Dim regulärerAusdruck As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex(preg)
|
|
||||||
' die Vorkommen im SQL-String auslesen
|
|
||||||
Dim elemente As System.Text.RegularExpressions.MatchCollection = regulärerAusdruck.Matches(SqlString)
|
|
||||||
' alle Vorkommen der Indexe im SQL-String durchlaufen
|
|
||||||
For Each element As System.Text.RegularExpressions.Match In elemente
|
|
||||||
|
|
||||||
' MsgBox(element.Value.ToUpper)
|
|
||||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Element: '" & element.Value & "'", False)
|
|
||||||
'' wenn es sich nicht um dedizeirte Werte handelt (es sollen ja nur die Indexe ausgelesen werden)
|
|
||||||
'If Not element.Value.ToUpper = "[%SPALTE]" And Not element.Value.ToUpper = "[%VIEW]" Then
|
|
||||||
'die Zeichen [% und ] entfernen (liefert den wirklichen windream-Index)
|
|
||||||
Dim elementOhneSonderzeichen As String = element.Value.Substring(2, element.Value.Length - 3)
|
|
||||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> elementOhneSonderzeichen: '" & elementOhneSonderzeichen & "'", False)
|
|
||||||
optionalIndex = ClassDatabase.Execute_Scalar("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & CURRENT_DOKART_ID & " AND UPPER(NAME) = UPPER('" & elementOhneSonderzeichen & "')", MyConnectionString, True)
|
|
||||||
If elementOhneSonderzeichen.StartsWith("$") Then 'windowsParameter
|
|
||||||
Dim result = ""
|
|
||||||
Try
|
|
||||||
Select Case elementOhneSonderzeichen.ToString.ToUpper
|
|
||||||
Case "$filename_ext".ToUpper
|
|
||||||
result = Path.GetFileName(CURRENT_WORKFILE)
|
|
||||||
Case "$filename".ToUpper
|
|
||||||
result = Path.GetFileNameWithoutExtension(CURRENT_WORKFILE)
|
|
||||||
Case "$extension".ToUpper
|
|
||||||
result = Path.GetExtension(CURRENT_WORKFILE)
|
|
||||||
result = result.Replace(".", "")
|
|
||||||
Case "$FileCreateDate".ToUpper
|
|
||||||
Dim FI As New FileInfo(CURRENT_WORKFILE)
|
|
||||||
Dim CreationDate As Date = FI.CreationTime
|
|
||||||
result = CreationDate.ToShortDateString
|
|
||||||
Case "$FileCreatedWho".ToUpper
|
|
||||||
Dim fs As FileSecurity = File.GetAccessControl(CURRENT_WORKFILE)
|
|
||||||
Dim sid As IdentityReference = fs.GetOwner(GetType(SecurityIdentifier))
|
|
||||||
Dim ntaccount As IdentityReference = sid.Translate(GetType(NTAccount))
|
|
||||||
Dim owner As String = ntaccount.ToString()
|
|
||||||
result = owner
|
|
||||||
Case "$DateDDMMYYY".ToUpper
|
|
||||||
result = System.DateTime.Now.ToShortDateString
|
|
||||||
Case "$Username"
|
|
||||||
result = Environment.UserName
|
|
||||||
Case "$Usercode"
|
|
||||||
result = USER_SHORT_NAME
|
|
||||||
End Select
|
|
||||||
Catch ex As Exception
|
|
||||||
result = "XXX"
|
|
||||||
ClassLogger.Add(" - Unexpected error in FillIndexe_Autom - WindowsFilePatterns - Fehler: " & vbNewLine & ex.Message)
|
|
||||||
MsgBox("Unexpected error in Replacement WindowsFilePatterns: " & vbNewLine & ex.Message & vbNewLine & vbNewLine & "Routine will continue - Please check logfile", MsgBoxStyle.Exclamation, )
|
|
||||||
End Try
|
|
||||||
If result <> "" Then
|
|
||||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> file-related parameter found: '" & elementOhneSonderzeichen & "' - Result: '" & result & "'", False)
|
|
||||||
SqlString = SqlString.Replace(element.Value, result)
|
|
||||||
Else
|
|
||||||
ClassLogger.Add(">> Attention: file-related parameter '" & elementOhneSonderzeichen & "' returned an empty string!", False)
|
|
||||||
End If
|
|
||||||
Else 'ganz normaler manueller Index
|
|
||||||
'den Platzhalter im SQL-String durch den Wert ersetzen
|
|
||||||
Dim manIndexwert = GetManIndex_Value(elementOhneSonderzeichen, "IDX_AUTO", optionalIndex)
|
|
||||||
If Not IsNothing(manIndexwert) Then
|
|
||||||
SqlString = SqlString.Replace(element.Value, manIndexwert)
|
|
||||||
Else
|
|
||||||
ClassLogger.Add(">> Attention: manIndexwert is NOTHING - Funktion: FillIndexe_Autom", False)
|
|
||||||
' Return False
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
Next
|
VWINDEX_AUTOMTableAdapter.Fill(MyDataset.VWDDINDEX_AUTOM, CURRENT_DOKART_ID)
|
||||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Replaced and complete SQL-result: " & SqlString, False)
|
|
||||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Ausführen SQL....", False)
|
|
||||||
Dim automatischerValue As String = ""
|
|
||||||
automatischerValue = Get_AutomatischerIndex_SQL(SqlString, DR_AUTOINDEX.Item("CONNECTION_ID"), DR_AUTOINDEX.Item("SQL_PROVIDER"))
|
|
||||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Ergebnis SQL: '" & automatischerValue & "'", False)
|
|
||||||
If automatischerValue <> String.Empty Then
|
|
||||||
DR_AUTOINDEX.Item("Indexiert") = True
|
|
||||||
DR_AUTOINDEX.Item("Indexwert") = automatischerValue
|
|
||||||
Else
|
|
||||||
If optionalIndex = True Then
|
|
||||||
DR_AUTOINDEX.Item("Indexiert") = True
|
|
||||||
DR_AUTOINDEX.Item("Indexwert") = "EMPTY_OI"
|
|
||||||
' Return True
|
|
||||||
Else
|
|
||||||
ClassLogger.Add(" - ACHTUNG: automatischerValue = String.Empty - Funktion: FillIndexe_Autom", False)
|
|
||||||
ClassLogger.Add(" - SqlString: " & SqlString, False)
|
|
||||||
' Return False
|
|
||||||
End If
|
|
||||||
|
|
||||||
End If
|
Dim oDatatable = MyDataset.VWDDINDEX_AUTOM
|
||||||
Else
|
Dim oRegex As New Regex("\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}")
|
||||||
If Not IsDBNull(DR_AUTOINDEX.Item("VALUE")) Then
|
|
||||||
If DR_AUTOINDEX.Item("VALUE") <> "" Then
|
|
||||||
Dim DEFAULTVALUE As String = DR_AUTOINDEX.Item("VALUE")
|
|
||||||
'Indexierung mit WindowsVariable
|
|
||||||
If DEFAULTVALUE.StartsWith("$") Then
|
|
||||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Indexierung mit einer Windowsvariable: '" & DEFAULTVALUE & "'", False)
|
|
||||||
Select Case DEFAULTVALUE.ToUpper
|
|
||||||
Case "$filename_ext".ToUpper
|
|
||||||
DEFAULTVALUE = Path.GetFileName(CURRENT_WORKFILE)
|
|
||||||
Case "$filename".ToUpper
|
|
||||||
DEFAULTVALUE = Path.GetFileNameWithoutExtension(CURRENT_WORKFILE)
|
|
||||||
Case "$extension".ToUpper
|
|
||||||
DEFAULTVALUE = Path.GetExtension(CURRENT_WORKFILE)
|
|
||||||
Case "$FileCreateDate".ToUpper
|
|
||||||
Dim FI As New FileInfo(CURRENT_WORKFILE)
|
|
||||||
Dim CreationDate As Date = FI.CreationTime
|
|
||||||
DEFAULTVALUE = CreationDate.ToShortDateString
|
|
||||||
Case "$FileCreatedWho".ToUpper
|
|
||||||
Dim fs As FileSecurity = File.GetAccessControl(CURRENT_WORKFILE)
|
|
||||||
Dim sid As IdentityReference = fs.GetOwner(GetType(SecurityIdentifier))
|
|
||||||
Dim ntaccount As IdentityReference = sid.Translate(GetType(NTAccount))
|
|
||||||
Dim owner As String = ntaccount.ToString()
|
|
||||||
DEFAULTVALUE = owner
|
|
||||||
Case "$DateDDMMYYY".ToUpper
|
|
||||||
DEFAULTVALUE = System.DateTime.Now.ToShortDateString
|
|
||||||
Case "$Username"
|
|
||||||
DEFAULTVALUE = Environment.UserName
|
|
||||||
Case "$Usercode"
|
|
||||||
DEFAULTVALUE = USER_SHORT_NAME
|
|
||||||
|
|
||||||
End Select
|
If oDatatable.Rows.Count = 0 Then
|
||||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Ergebnis der Windowsvariable: '" & DEFAULTVALUE & "'", False)
|
|
||||||
Else
|
|
||||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Indexierung mit einem Festen Wert: '" & DEFAULTVALUE & "'", False)
|
|
||||||
End If
|
|
||||||
'Den Wert in der Zwischentabelle speichern
|
|
||||||
DR_AUTOINDEX.Item("Indexiert") = True
|
|
||||||
DR_AUTOINDEX.Item("Indexwert") = DEFAULTVALUE
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
'MsgBox("Noch kein automatischer Index-SQL-String hinterlegt, dennoch wird das Dokument abgelegt!")
|
|
||||||
Return True
|
|
||||||
Else
|
|
||||||
Return True
|
Return True
|
||||||
End If
|
End If
|
||||||
Catch ex As System.Exception
|
|
||||||
ClassLogger.Add(" - Unexpected error in FillIndexe_Autom - Fehler: " & vbNewLine & ex.Message)
|
' 1. Schritt: Einfach-Indexe und Platzhalter ersetzen
|
||||||
MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in FillIndexe_Autom")
|
For Each oAutoIndexRow As DataRow In oDatatable
|
||||||
|
Dim oSqlResult As String = ClassHelper.NotNull(oAutoIndexRow.Item("SQL_RESULT"), "")
|
||||||
|
Dim oSqlActive As Boolean = ClassHelper.NotNull(oAutoIndexRow.Item("SQL_ACTIVE"), False)
|
||||||
|
Dim oSqlConnectionId As Integer = ClassHelper.NotNull(oAutoIndexRow.Item("CONNECTION_ID"), -1)
|
||||||
|
Dim oSqlProvider As String = ClassHelper.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 = oAutoIndexRow.Item("VALUE")
|
||||||
|
|
||||||
|
oPlaceholderResult = GetPlaceholderValue(oValue, CURRENT_WORKFILE, USER_SHORT_NAME)
|
||||||
|
|
||||||
|
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, CURRENT_WORKFILE, USER_SHORT_NAME)
|
||||||
|
|
||||||
|
' Einfachen Platzhalter ersetzen
|
||||||
|
If Not IsNothing(oPlaceholderResult) Then
|
||||||
|
oSqlResult = oSqlResult.Replace(oMatch.Value, oPlaceholderResult)
|
||||||
|
End If
|
||||||
|
|
||||||
|
oOptionalIndex = 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
|
||||||
|
|
||||||
|
' 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)
|
||||||
|
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 = 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
|
||||||
|
Next
|
||||||
|
|
||||||
|
oAutoIndexRow.Item("Indexiert") = True
|
||||||
|
oAutoIndexRow.Item("Indexwert") = String.Join(ClassConstants.VECTORSEPARATOR, oEndResult.ToArray)
|
||||||
|
Next
|
||||||
|
|
||||||
|
Return True
|
||||||
|
Catch ex As Exception
|
||||||
|
MsgBox(ex.Message)
|
||||||
Return False
|
Return False
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
|
|
||||||
|
' 3. Schritt: SQL ausführen
|
||||||
|
' 4. Schritt: Resultat in Datatable schreiben
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'Try
|
||||||
|
' Me.VWINDEX_AUTOMTableAdapter.Fill(Me.MyDataset.VWDDINDEX_AUTOM, CURRENT_DOKART_ID)
|
||||||
|
' Dim DT_INDEXAUTOM As DataTable = MyDataset.VWDDINDEX_AUTOM
|
||||||
|
' If DT_INDEXAUTOM.Rows.Count > 0 Then
|
||||||
|
' ' MsgBox(DT.Rows.Count.ToString)
|
||||||
|
' For Each DR_AUTOINDEX As DataRow In DT_INDEXAUTOM.Rows
|
||||||
|
' Dim optionalIndex As Boolean
|
||||||
|
' Dim indexname As String = DR_AUTOINDEX.Item("INDEXNAME")
|
||||||
|
' If LogErrorsOnly = False Then ClassLogger.Add(" >> Build Automatischer Index '" & indexname & "'", False)
|
||||||
|
' If DR_AUTOINDEX.Item("SQL_RESULT").ToString <> String.Empty And CBool(DR_AUTOINDEX.Item("SQL_ACTIVE")) = True Then
|
||||||
|
' ' Regulären Ausdruck zum Auslesen der windream-Indexe definieren
|
||||||
|
' Dim preg As String = "\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}"
|
||||||
|
' ' SQL-String für aktuellen INdex laden
|
||||||
|
' Dim SqlString As String = DR_AUTOINDEX.Item("SQL_RESULT")
|
||||||
|
' ' einen Regulären Ausdruck laden
|
||||||
|
' Dim regulärerAusdruck As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex(preg)
|
||||||
|
' ' die Vorkommen im SQL-String auslesen
|
||||||
|
' Dim elemente As System.Text.RegularExpressions.MatchCollection = regulärerAusdruck.Matches(SqlString)
|
||||||
|
' ' alle Vorkommen der Indexe im SQL-String durchlaufen
|
||||||
|
' For Each element As System.Text.RegularExpressions.Match In elemente
|
||||||
|
|
||||||
|
' ' MsgBox(element.Value.ToUpper)
|
||||||
|
' If LogErrorsOnly = False Then ClassLogger.Add(" >> Element: '" & element.Value & "'", False)
|
||||||
|
' '' wenn es sich nicht um dedizeirte Werte handelt (es sollen ja nur die Indexe ausgelesen werden)
|
||||||
|
' 'If Not element.Value.ToUpper = "[%SPALTE]" And Not element.Value.ToUpper = "[%VIEW]" Then
|
||||||
|
' 'die Zeichen [% und ] entfernen (liefert den wirklichen windream-Index)
|
||||||
|
' Dim elementOhneSonderzeichen As String = element.Value.Substring(2, element.Value.Length - 3)
|
||||||
|
' If LogErrorsOnly = False Then ClassLogger.Add(" >> elementOhneSonderzeichen: '" & elementOhneSonderzeichen & "'", False)
|
||||||
|
' optionalIndex = ClassDatabase.Execute_Scalar("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & CURRENT_DOKART_ID & " AND UPPER(NAME) = UPPER('" & elementOhneSonderzeichen & "')", MyConnectionString, True)
|
||||||
|
' If elementOhneSonderzeichen.StartsWith("$") Then 'windowsParameter
|
||||||
|
' Dim result = ""
|
||||||
|
' Try
|
||||||
|
' Select Case elementOhneSonderzeichen.ToString.ToUpper
|
||||||
|
' Case "$filename_ext".ToUpper
|
||||||
|
' result = Path.GetFileName(CURRENT_WORKFILE)
|
||||||
|
' Case "$filename".ToUpper
|
||||||
|
' result = Path.GetFileNameWithoutExtension(CURRENT_WORKFILE)
|
||||||
|
' Case "$extension".ToUpper
|
||||||
|
' result = Path.GetExtension(CURRENT_WORKFILE)
|
||||||
|
' result = result.Replace(".", "")
|
||||||
|
' Case "$FileCreateDate".ToUpper
|
||||||
|
' Dim FI As New FileInfo(CURRENT_WORKFILE)
|
||||||
|
' Dim CreationDate As Date = FI.CreationTime
|
||||||
|
' result = CreationDate.ToShortDateString
|
||||||
|
' Case "$FileCreatedWho".ToUpper
|
||||||
|
' Dim fs As FileSecurity = File.GetAccessControl(CURRENT_WORKFILE)
|
||||||
|
' Dim sid As IdentityReference = fs.GetOwner(GetType(SecurityIdentifier))
|
||||||
|
' Dim ntaccount As IdentityReference = sid.Translate(GetType(NTAccount))
|
||||||
|
' Dim owner As String = ntaccount.ToString()
|
||||||
|
' result = owner
|
||||||
|
' Case "$DateDDMMYYY".ToUpper
|
||||||
|
' result = System.DateTime.Now.ToShortDateString
|
||||||
|
' Case "$Username"
|
||||||
|
' result = Environment.UserName
|
||||||
|
' Case "$Usercode"
|
||||||
|
' result = USER_SHORT_NAME
|
||||||
|
' End Select
|
||||||
|
' Catch ex As Exception
|
||||||
|
' result = "XXX"
|
||||||
|
' ClassLogger.Add(" - Unexpected error in FillIndexe_Autom - WindowsFilePatterns - Fehler: " & vbNewLine & ex.Message)
|
||||||
|
' MsgBox("Unexpected error in Replacement WindowsFilePatterns: " & vbNewLine & ex.Message & vbNewLine & vbNewLine & "Routine will continue - Please check logfile", MsgBoxStyle.Exclamation, )
|
||||||
|
' End Try
|
||||||
|
' If result <> "" Then
|
||||||
|
' If LogErrorsOnly = False Then ClassLogger.Add(" >> file-related parameter found: '" & elementOhneSonderzeichen & "' - Result: '" & result & "'", False)
|
||||||
|
' SqlString = SqlString.Replace(element.Value, result)
|
||||||
|
' Else
|
||||||
|
' ClassLogger.Add(">> Attention: file-related parameter '" & elementOhneSonderzeichen & "' returned an empty string!", False)
|
||||||
|
' End If
|
||||||
|
' Else 'ganz normaler manueller Index
|
||||||
|
' 'den Platzhalter im SQL-String durch den Wert ersetzen
|
||||||
|
' Dim manIndexwert = GetManIndex_Value(elementOhneSonderzeichen, "IDX_AUTO", optionalIndex)
|
||||||
|
' If Not IsNothing(manIndexwert) Then
|
||||||
|
' SqlString = SqlString.Replace(element.Value, manIndexwert)
|
||||||
|
' Else
|
||||||
|
' ClassLogger.Add(">> Attention: manIndexwert is NOTHING - Funktion: FillIndexe_Autom", False)
|
||||||
|
' ' Return False
|
||||||
|
' End If
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' Next
|
||||||
|
' If LogErrorsOnly = False Then ClassLogger.Add(" >> Replaced and complete SQL-result: " & SqlString, False)
|
||||||
|
' If LogErrorsOnly = False Then ClassLogger.Add(" >> Ausführen SQL....", False)
|
||||||
|
' Dim automatischerValue As String = ""
|
||||||
|
' automatischerValue = GetAutomaticIndexSQLValue(SqlString, DR_AUTOINDEX.Item("CONNECTION_ID"), DR_AUTOINDEX.Item("SQL_PROVIDER"))
|
||||||
|
' If LogErrorsOnly = False Then ClassLogger.Add(" >> Ergebnis SQL: '" & automatischerValue & "'", False)
|
||||||
|
' If automatischerValue <> String.Empty Then
|
||||||
|
' DR_AUTOINDEX.Item("Indexiert") = True
|
||||||
|
' DR_AUTOINDEX.Item("Indexwert") = automatischerValue
|
||||||
|
' Else
|
||||||
|
' If optionalIndex = True Then
|
||||||
|
' DR_AUTOINDEX.Item("Indexiert") = True
|
||||||
|
' DR_AUTOINDEX.Item("Indexwert") = "EMPTY_OI"
|
||||||
|
' ' Return True
|
||||||
|
' Else
|
||||||
|
' ClassLogger.Add(" - ACHTUNG: automatischerValue = String.Empty - Funktion: FillIndexe_Autom", False)
|
||||||
|
' ClassLogger.Add(" - SqlString: " & SqlString, False)
|
||||||
|
' ' Return False
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' End If
|
||||||
|
' Else
|
||||||
|
' If Not IsDBNull(DR_AUTOINDEX.Item("VALUE")) Then
|
||||||
|
' If DR_AUTOINDEX.Item("VALUE") <> "" Then
|
||||||
|
' Dim DEFAULTVALUE As String = DR_AUTOINDEX.Item("VALUE")
|
||||||
|
' 'Indexierung mit WindowsVariable
|
||||||
|
' If DEFAULTVALUE.StartsWith("$") Then
|
||||||
|
' If LogErrorsOnly = False Then ClassLogger.Add(" >> Indexierung mit einer Windowsvariable: '" & DEFAULTVALUE & "'", False)
|
||||||
|
' Select Case DEFAULTVALUE.ToUpper
|
||||||
|
' Case "$filename_ext".ToUpper
|
||||||
|
' DEFAULTVALUE = Path.GetFileName(CURRENT_WORKFILE)
|
||||||
|
' Case "$filename".ToUpper
|
||||||
|
' DEFAULTVALUE = Path.GetFileNameWithoutExtension(CURRENT_WORKFILE)
|
||||||
|
' Case "$extension".ToUpper
|
||||||
|
' DEFAULTVALUE = Path.GetExtension(CURRENT_WORKFILE)
|
||||||
|
' Case "$FileCreateDate".ToUpper
|
||||||
|
' Dim FI As New FileInfo(CURRENT_WORKFILE)
|
||||||
|
' Dim CreationDate As Date = FI.CreationTime
|
||||||
|
' DEFAULTVALUE = CreationDate.ToShortDateString
|
||||||
|
' Case "$FileCreatedWho".ToUpper
|
||||||
|
' Dim fs As FileSecurity = File.GetAccessControl(CURRENT_WORKFILE)
|
||||||
|
' Dim sid As IdentityReference = fs.GetOwner(GetType(SecurityIdentifier))
|
||||||
|
' Dim ntaccount As IdentityReference = sid.Translate(GetType(NTAccount))
|
||||||
|
' Dim owner As String = ntaccount.ToString()
|
||||||
|
' DEFAULTVALUE = owner
|
||||||
|
' Case "$DateDDMMYYY".ToUpper
|
||||||
|
' DEFAULTVALUE = System.DateTime.Now.ToShortDateString
|
||||||
|
' Case "$Username"
|
||||||
|
' DEFAULTVALUE = Environment.UserName
|
||||||
|
' Case "$Usercode"
|
||||||
|
' DEFAULTVALUE = USER_SHORT_NAME
|
||||||
|
|
||||||
|
' End Select
|
||||||
|
' If LogErrorsOnly = False Then ClassLogger.Add(" >> Ergebnis der Windowsvariable: '" & DEFAULTVALUE & "'", False)
|
||||||
|
' Else
|
||||||
|
' If LogErrorsOnly = False Then ClassLogger.Add(" >> Indexierung mit einem Festen Wert: '" & DEFAULTVALUE & "'", False)
|
||||||
|
' End If
|
||||||
|
' 'Den Wert in der Zwischentabelle speichern
|
||||||
|
' DR_AUTOINDEX.Item("Indexiert") = True
|
||||||
|
' DR_AUTOINDEX.Item("Indexwert") = DEFAULTVALUE
|
||||||
|
' End If
|
||||||
|
' End If
|
||||||
|
' End If
|
||||||
|
' Next
|
||||||
|
' 'MsgBox("Noch kein automatischer Index-SQL-String hinterlegt, dennoch wird das Dokument abgelegt!")
|
||||||
|
' Return True
|
||||||
|
' Else
|
||||||
|
' Return True
|
||||||
|
' End If
|
||||||
|
'Catch ex As System.Exception
|
||||||
|
' ClassLogger.Add(" - Unexpected error in FillIndexe_Autom - Fehler: " & vbNewLine & ex.Message)
|
||||||
|
' MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in FillIndexe_Autom")
|
||||||
|
' Return False
|
||||||
|
'End Try
|
||||||
|
|
||||||
End Function
|
End Function
|
||||||
Private Sub btnVorschau_Click(sender As System.Object, e As System.EventArgs)
|
Private Sub btnVorschau_Click(sender As System.Object, e As System.EventArgs)
|
||||||
PreviewFile()
|
PreviewFile()
|
||||||
@ -2699,7 +2860,7 @@ Public Class frmIndex
|
|||||||
Dim Folder_for_index = ClassDatabase.Execute_Scalar(sql, MyConnectionString, True)
|
Dim Folder_for_index = ClassDatabase.Execute_Scalar(sql, MyConnectionString, True)
|
||||||
If Not IsDBNull(Folder_for_index) Then
|
If Not IsDBNull(Folder_for_index) Then
|
||||||
If Folder_for_index <> String.Empty Then
|
If Folder_for_index <> String.Empty Then
|
||||||
CrFolderForIndex(Folder_for_index)
|
CreateFolderForIndex(Folder_for_index)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@ -2805,7 +2966,7 @@ Public Class frmIndex
|
|||||||
|
|
||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
Private Function CrFolderForIndex(folderindex As String)
|
Private Function CreateFolderForIndex(folderindex As String)
|
||||||
Try
|
Try
|
||||||
Dim RootFolder As String = Path.GetDirectoryName(CURRENT_NEWFILENAME)
|
Dim RootFolder As String = Path.GetDirectoryName(CURRENT_NEWFILENAME)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user