Fix Sql Connection missing in Depending Controls, clean up Filesystem module use
This commit is contained in:
@@ -3,16 +3,14 @@ Imports System.Text.RegularExpressions
|
||||
Imports System.Text
|
||||
Imports System.Security.AccessControl
|
||||
Imports System.Security.Principal
|
||||
Imports System.DirectoryServices
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Language
|
||||
Imports DigitalData.Controls.LookupGrid
|
||||
Imports DigitalData.GUIs.GlobalIndexer
|
||||
Imports DevExpress.XtraEditors.Controls
|
||||
Imports Limilabs.Mail
|
||||
Imports Limilabs.Mail.Headers
|
||||
Imports DevExpress.XtraEditors
|
||||
Imports DigitalData.GUIs.Common
|
||||
Imports DigitalData.Modules.Base
|
||||
|
||||
Public Class frmIndex
|
||||
#Region "+++++ Variablen ++++++"
|
||||
@@ -49,6 +47,7 @@ Public Class frmIndex
|
||||
|
||||
Private ReadOnly _Logger As Logger
|
||||
Private ReadOnly _FormHelper As FormHelper
|
||||
Private ReadOnly _PostProcessing As ClassPostprocessing
|
||||
|
||||
#End Region
|
||||
|
||||
@@ -83,6 +82,7 @@ Public Class frmIndex
|
||||
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
|
||||
_Logger = LOGCONFIG.GetLogger()
|
||||
_FormHelper = New FormHelper(LOGCONFIG, Me)
|
||||
_PostProcessing = New ClassPostprocessing(LOGCONFIG)
|
||||
|
||||
Localizer.Active = New LookupGridLocalizer()
|
||||
End Sub
|
||||
@@ -524,7 +524,7 @@ Public Class frmIndex
|
||||
Dim DTNB As DataTable = DATABASE_ECM.GetDatatable("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 = ClassPostprocessing.Get_Nachbearbeitung_Wert(wert_in, DTNB)
|
||||
value_post = _PostProcessing.Get_Nachbearbeitung_Wert(wert_in, DTNB)
|
||||
DR.Item("Indexwert") = wert_in
|
||||
DR.Item("Indexwert_File") = value_post
|
||||
End If
|
||||
@@ -534,7 +534,7 @@ Public Class frmIndex
|
||||
DTNB = DATABASE_ECM.GetDatatable("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 = ClassPostprocessing.Get_Nachbearbeitung_Wert(wert_in, DTNB)
|
||||
value_post = _PostProcessing.Get_Nachbearbeitung_Wert(wert_in, DTNB)
|
||||
DR.Item("Indexwert") = value_post
|
||||
End If
|
||||
End If
|
||||
@@ -551,7 +551,6 @@ Public Class frmIndex
|
||||
Try
|
||||
_Logger.Debug("#### Name_Generieren ####")
|
||||
Dim sql As String = "select VERSION_DELIMITER, FILE_DELIMITER FROM TBDD_MODULES WHERE GUID = 1"
|
||||
Dim oFilesystem As New DigitalData.Modules.Filesystem.File(LOGCONFIG)
|
||||
Dim DT1 As DataTable = DATABASE_ECM.GetDatatable(sql)
|
||||
For Each row As DataRow In DT1.Rows
|
||||
FILE_DELIMITER = row.Item("FILE_DELIMITER")
|
||||
@@ -725,7 +724,7 @@ Public Class frmIndex
|
||||
End Select
|
||||
Next
|
||||
|
||||
CURRENT_NEWFILENAME = oFilesystem.GetCleanFilename(NewFileString)
|
||||
CURRENT_NEWFILENAME = FILESYSTEM.GetCleanFilename(NewFileString)
|
||||
'CURRENT_NEWFILENAME = ClassFilehandle.CleanFilename(NewFileString, "")
|
||||
CURRENT_NEWFILENAME = Path.Combine(oRAWZielordner, CURRENT_NEWFILENAME)
|
||||
|
||||
@@ -1903,7 +1902,7 @@ Public Class frmIndex
|
||||
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 = Utils.NotNull(oRow.Item("CONNECTION_ID"), 0)
|
||||
Dim oConnectionId = oRow.ItemEx("CONNECTION_ID", 0)
|
||||
Dim oSQLSuggestion = oRow.Item("SUGGESTION")
|
||||
Dim oSQLResult = oRow.Item("SQL_RESULT")
|
||||
|
||||
@@ -2030,9 +2029,9 @@ Public Class frmIndex
|
||||
LOGGER.Debug("Found [{0}] depending controls for [{1}]", oDatatable.Rows.Count, Control.Name)
|
||||
|
||||
For Each oRow As DataRow In oDatatable.Rows
|
||||
Dim oControlName As String = Utils.NotNull(oRow.Item("NAME"), "")
|
||||
Dim oConnectionId As Integer = Utils.NotNull(oRow.Item("CONNECTION_ID"), -1)
|
||||
Dim oControlSql As String = Utils.NotNull(oRow.Item("SQL_RESULT"), "")
|
||||
Dim oControlName As String = oRow.ItemEx("NAME", "")
|
||||
Dim oConnectionId As Integer = oRow.ItemEx("CONNECTION_ID", -1)
|
||||
Dim oControlSql As String = oRow.ItemEx("SQL_RESULT", "")
|
||||
|
||||
If oConnectionId = -1 Or oControlSql = String.Empty Then
|
||||
LOGGER.Warn("Missing SQL Query or ConnectionId for Control [{0}]! Continuing.", oControlName)
|
||||
@@ -2059,8 +2058,7 @@ Public Class frmIndex
|
||||
End If
|
||||
|
||||
Dim oConnectionString = DATABASE_ECM.Get_ConnectionStringforID(SqlConnectionId)
|
||||
'Dim oDatatable As DataTable = ClassDatabase.Return_Datatable_CS(SqlCommand, oConnectionString)
|
||||
Dim oDatatable As DataTable = DATABASE_ECM.GetDatatable(SqlCommand)
|
||||
Dim oDatatable As DataTable = DATABASE_ECM.GetDatatableWithConnection(SqlCommand, oConnectionString)
|
||||
Dim oFoundControl As Control = Nothing
|
||||
|
||||
For Each oControl As Control In pnlIndex.Controls
|
||||
@@ -2088,7 +2086,7 @@ Public Class frmIndex
|
||||
End If
|
||||
|
||||
Select Case oFoundControl.GetType.Name
|
||||
Case GetType(DevExpress.XtraEditors.TextEdit).Name
|
||||
Case GetType(TextEdit).Name
|
||||
If oDatatable.Rows.Count > 0 Then
|
||||
Dim oFirstRow As DataRow = oDatatable.Rows.Item(0)
|
||||
|
||||
@@ -2096,7 +2094,7 @@ Public Class frmIndex
|
||||
Dim oValue = oFirstRow.Item(0).ToString()
|
||||
|
||||
LOGGER.Debug("Setting Value for TextEdit [{0}]: [{1}]", oFoundControl.Name, oValue)
|
||||
DirectCast(oFoundControl, DevExpress.XtraEditors.TextEdit).Text = oValue
|
||||
DirectCast(oFoundControl, TextEdit).Text = oValue
|
||||
End If
|
||||
End If
|
||||
Case GetType(LookupControl3).Name
|
||||
@@ -2177,19 +2175,19 @@ Public Class frmIndex
|
||||
End If
|
||||
|
||||
' 1. Schritt: Einfach-Indexe und Platzhalter ersetzen
|
||||
For Each oAutoIndexRow As DataRow In oDatatable
|
||||
_Logger.Info("Working on AutomaticIndex: " & oAutoIndexRow.Item("INDEXNAME") & "...")
|
||||
Dim oSqlResult As String = Utils.NotNull(oAutoIndexRow.Item("SQL_RESULT"), "")
|
||||
Dim oSqlActive As Boolean = Utils.NotNull(oAutoIndexRow.Item("SQL_ACTIVE"), False)
|
||||
Dim oSqlConnectionId As Integer = Utils.NotNull(oAutoIndexRow.Item("CONNECTION_ID"), -1)
|
||||
Dim oSqlProvider As String = Utils.NotNull(oAutoIndexRow.Item("SQL_PROVIDER"), "")
|
||||
For Each oRow As DataRow In oDatatable
|
||||
_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 = Utils.NotNull(oAutoIndexRow.Item("VALUE"), "")
|
||||
Dim oValue As String = oRow.ItemEx("VALUE", "")
|
||||
|
||||
oPlaceholderResult = GetPlaceholderValue(oValue, CURRENT_WORKFILE, USER_SHORTNAME)
|
||||
|
||||
@@ -2197,8 +2195,8 @@ Public Class frmIndex
|
||||
oValue = oPlaceholderResult
|
||||
End If
|
||||
|
||||
oAutoIndexRow.Item("Indexiert") = True
|
||||
oAutoIndexRow.Item("Indexwert") = oValue
|
||||
oRow.Item("Indexiert") = True
|
||||
oRow.Item("Indexwert") = oValue
|
||||
|
||||
Continue For
|
||||
End If
|
||||
@@ -2271,14 +2269,14 @@ Public Class frmIndex
|
||||
If oIsFirstMatch Then
|
||||
Exit For
|
||||
End If
|
||||
oAutoIndexRow.Item("Indexiert") = True
|
||||
oAutoIndexRow.Item("Indexwert") = String.Join(ClassConstants.VECTORSEPARATOR, oEndResult.ToArray)
|
||||
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)
|
||||
oAutoIndexRow.Item("Indexiert") = True
|
||||
oAutoIndexRow.Item("Indexwert") = oResult
|
||||
oRow.Item("Indexiert") = True
|
||||
oRow.Item("Indexwert") = oResult
|
||||
|
||||
End If
|
||||
Next
|
||||
@@ -2548,8 +2546,7 @@ Public Class frmIndex
|
||||
Private Function CreateFolderForIndex(DynamicFolderConfig As String)
|
||||
Try
|
||||
Dim oRootFolder As String = Path.GetDirectoryName(CURRENT_NEWFILENAME)
|
||||
Dim oFilesystem As New DigitalData.Modules.Filesystem.File(LOGCONFIG)
|
||||
|
||||
'Dim oFilesystem As New Filesystem(LOGCONFIG)
|
||||
|
||||
If DynamicFolderConfig <> String.Empty Then
|
||||
'######
|
||||
@@ -2577,7 +2574,7 @@ Public Class frmIndex
|
||||
oManIndexValue = CDate(oManIndexValue).ToString("yyyyMMdd")
|
||||
End If
|
||||
|
||||
oManIndexValue = oFilesystem.GetCleanPath(oManIndexValue)
|
||||
oManIndexValue = FILESYSTEM.GetCleanPath(oManIndexValue)
|
||||
'oManIndexValue = ClassFilehandle.CleanFilename(oManIndexValue, "")
|
||||
DynamicFolderConfig = DynamicFolderConfig.Replace(oMatch.ToString, oManIndexValue)
|
||||
|
||||
@@ -2599,7 +2596,7 @@ Public Class frmIndex
|
||||
_Logger.Info("Ergebnis/Wert für neuen Ordner: '" & oAutoIndexName & "'")
|
||||
If Not oAutoIndexValue = String.Empty Then
|
||||
|
||||
oAutoIndexValue = oFilesystem.GetCleanPath(oAutoIndexValue)
|
||||
oAutoIndexValue = FILESYSTEM.GetCleanPath(oAutoIndexValue)
|
||||
'oAutoIndexValue = ClassFilehandle.CleanFilename(oAutoIndexValue, "")
|
||||
If oAutoIndexValue = "EMPTY_OI" Then
|
||||
DynamicFolderConfig = DynamicFolderConfig.Replace(oMatch.ToString, "")
|
||||
@@ -2804,11 +2801,11 @@ Public Class frmIndex
|
||||
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 filerow As DataRow In DTFiles2Work.Rows
|
||||
CURRENT_WORKFILE_GUID = filerow.Item("GUID")
|
||||
CURRENT_WORKFILE = filerow.Item("FILENAME2WORK")
|
||||
CURRENT_WORKFILE_HASH = Utils.NotNull(filerow.Item("FILE_HASH"), "")
|
||||
DropType = filerow.Item("HANDLE_TYPE")
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user