Automatisches Mappen und Arbeiten mit Temporärem Verzeichnis
ConnectionID sicher auf 1
This commit is contained in:
@@ -3,6 +3,7 @@ Imports System.Data.OracleClient
|
|||||||
Imports System.IO
|
Imports System.IO
|
||||||
Imports WINDREAMLib
|
Imports WINDREAMLib
|
||||||
Imports DevExpress.Utils.CommonDialogs
|
Imports DevExpress.Utils.CommonDialogs
|
||||||
|
Imports System.Runtime.InteropServices
|
||||||
|
|
||||||
Public Class ClassAllgemeineFunktionen
|
Public Class ClassAllgemeineFunktionen
|
||||||
Public Shared Function GUI_LANGUAGE_INFO(pTITLE As String)
|
Public Shared Function GUI_LANGUAGE_INFO(pTITLE As String)
|
||||||
@@ -417,4 +418,518 @@ Public Class ClassAllgemeineFunktionen
|
|||||||
' Ergebnis zurückgeben
|
' Ergebnis zurückgeben
|
||||||
Return b64
|
Return b64
|
||||||
End Function
|
End Function
|
||||||
|
#Region "Windows API Deklarationen"
|
||||||
|
<DllImport("mpr.dll", CharSet:=CharSet.Auto)>
|
||||||
|
Private Shared Function WNetAddConnection2(ByRef lpNetResource As NETRESOURCE,
|
||||||
|
ByVal lpPassword As String,
|
||||||
|
ByVal lpUsername As String,
|
||||||
|
ByVal dwFlags As Integer) As Integer
|
||||||
|
End Function
|
||||||
|
|
||||||
|
<DllImport("mpr.dll", CharSet:=CharSet.Auto)>
|
||||||
|
Private Shared Function WNetCancelConnection2(ByVal lpName As String,
|
||||||
|
ByVal dwFlags As Integer,
|
||||||
|
ByVal fForce As Boolean) As Integer
|
||||||
|
End Function
|
||||||
|
|
||||||
|
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)>
|
||||||
|
Private Structure NETRESOURCE
|
||||||
|
Public dwScope As Integer
|
||||||
|
Public dwType As Integer
|
||||||
|
Public dwDisplayType As Integer
|
||||||
|
Public dwUsage As Integer
|
||||||
|
Public lpLocalName As String
|
||||||
|
Public lpRemoteName As String
|
||||||
|
Public lpComment As String
|
||||||
|
Public lpProvider As String
|
||||||
|
End Structure
|
||||||
|
|
||||||
|
Private Const RESOURCETYPE_DISK As Integer = 1
|
||||||
|
Private Const CONNECT_UPDATE_PROFILE As Integer = 1
|
||||||
|
Private Const ERROR_SUCCESS As Integer = 0
|
||||||
|
Private Const ERROR_ALREADY_ASSIGNED As Integer = 85
|
||||||
|
#End Region
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Struktur für Netzlaufwerk-Informationen
|
||||||
|
''' </summary>
|
||||||
|
Public Structure NetworkDriveInfo
|
||||||
|
Public DriveLetter As String
|
||||||
|
Public NetworkPath As String
|
||||||
|
Public DriveType As IO.DriveType
|
||||||
|
Public IsReady As Boolean
|
||||||
|
Public TotalSize As Long
|
||||||
|
Public FreeSpace As Long
|
||||||
|
End Structure
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Ermittelt den nächsten freien Laufwerksbuchstaben (alphabetisch absteigend von Z bis A)
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="blacklist">Liste der nicht erlaubten Laufwerksbuchstaben (z.B. "Y,M,V")</param>
|
||||||
|
''' <returns>Nächster freier Laufwerksbuchstabe mit Doppelpunkt (z.B. "Z:") oder String.Empty wenn keiner frei</returns>
|
||||||
|
Public Shared Function GetNextFreeDriveLetter(Optional blacklist As String = "") As String
|
||||||
|
Try
|
||||||
|
' Blacklist verarbeiten (Großbuchstaben ohne Doppelpunkte)
|
||||||
|
Dim blacklistArray As New List(Of Char)
|
||||||
|
If Not String.IsNullOrEmpty(blacklist) Then
|
||||||
|
For Each item In blacklist.Split(","c)
|
||||||
|
Dim letter = item.Trim().ToUpper().Replace(":", "")
|
||||||
|
If letter.Length = 1 AndAlso Char.IsLetter(letter(0)) Then
|
||||||
|
blacklistArray.Add(letter(0))
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Alle aktuell verwendeten Laufwerksbuchstaben ermitteln
|
||||||
|
Dim usedDrives As New List(Of Char)
|
||||||
|
For Each drive As IO.DriveInfo In IO.DriveInfo.GetDrives()
|
||||||
|
Dim letter As Char = drive.Name(0)
|
||||||
|
usedDrives.Add(Char.ToUpper(letter))
|
||||||
|
Next
|
||||||
|
|
||||||
|
' Alphabetisch absteigend von Z bis A durchgehen
|
||||||
|
For i As Integer = Asc("Z"c) To Asc("A"c) Step -1
|
||||||
|
Dim currentLetter As Char = Chr(i)
|
||||||
|
|
||||||
|
' Prüfen ob Buchstabe verfügbar ist
|
||||||
|
If Not usedDrives.Contains(currentLetter) AndAlso Not blacklistArray.Contains(currentLetter) Then
|
||||||
|
LOGGER.Debug($"Nächster freier Laufwerksbuchstabe gefunden: {currentLetter}:")
|
||||||
|
Return currentLetter & ":"
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
LOGGER.Warn("Kein freier Laufwerksbuchstabe gefunden!")
|
||||||
|
Return String.Empty
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
LOGGER.Error($"Fehler beim Ermitteln des nächsten freien Laufwerksbuchstabens: {ex.Message}")
|
||||||
|
LOGGER.Error(ex)
|
||||||
|
Return String.Empty
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Prüft ob ein Laufwerksbuchstabe verfügbar ist (nicht verwendet und nicht in Blacklist)
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="driveLetter">Zu prüfender Laufwerksbuchstabe</param>
|
||||||
|
''' <param name="blacklist">Liste der nicht erlaubten Laufwerksbuchstaben</param>
|
||||||
|
''' <returns>True wenn verfügbar, False wenn bereits verwendet oder in Blacklist</returns>
|
||||||
|
Public Shared Function IsDriveLetterAvailable(driveLetter As String, Optional blacklist As String = "") As Boolean
|
||||||
|
Try
|
||||||
|
' Formatierung sicherstellen
|
||||||
|
driveLetter = driveLetter.Trim().ToUpper().Replace(":", "")
|
||||||
|
If driveLetter.Length <> 1 OrElse Not Char.IsLetter(driveLetter(0)) Then
|
||||||
|
LOGGER.Warn($"Ungültiger Laufwerksbuchstabe: {driveLetter}")
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim letter As Char = driveLetter(0)
|
||||||
|
|
||||||
|
' Blacklist prüfen
|
||||||
|
If Not String.IsNullOrEmpty(blacklist) Then
|
||||||
|
For Each item In blacklist.Split(","c)
|
||||||
|
Dim blacklistedLetter = item.Trim().ToUpper().Replace(":", "")
|
||||||
|
If blacklistedLetter.Length = 1 AndAlso blacklistedLetter(0) = letter Then
|
||||||
|
LOGGER.Debug($"Laufwerk {letter}: ist in der Blacklist")
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Prüfen ob bereits verwendet
|
||||||
|
For Each drive As IO.DriveInfo In IO.DriveInfo.GetDrives()
|
||||||
|
If Char.ToUpper(drive.Name(0)) = letter Then
|
||||||
|
LOGGER.Debug($"Laufwerk {letter}: ist bereits verwendet")
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
Return True
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
LOGGER.Error($"Fehler beim Prüfen der Laufwerksverfügbarkeit: {ex.Message}")
|
||||||
|
LOGGER.Error(ex)
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Mappt ein Netzlaufwerk mit automatischer Laufwerksbuchstabenwahl oder spezifischem Buchstaben
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="driveLetter">Gewünschter Laufwerksbuchstabe (leer = automatisch den nächsten freien wählen)</param>
|
||||||
|
''' <param name="networkPath">UNC-Pfad des Netzwerkshares</param>
|
||||||
|
''' <param name="blacklist">Komma-getrennte Liste verbotener Laufwerksbuchstaben (z.B. "Y,M,V")</param>
|
||||||
|
''' <param name="userName">Optionaler Benutzername für Authentifizierung</param>
|
||||||
|
''' <param name="password">Optionales Passwort für Authentifizierung</param>
|
||||||
|
''' <param name="persistent">Soll das Mapping persistent sein?</param>
|
||||||
|
''' <returns>Verwendeter Laufwerksbuchstabe bei Erfolg, String.Empty bei Fehler</returns>
|
||||||
|
Public Shared Function MapNetworkDrive(driveLetter As String,
|
||||||
|
networkPath As String,
|
||||||
|
Optional blacklist As String = "",
|
||||||
|
Optional userName As String = Nothing,
|
||||||
|
Optional password As String = Nothing,
|
||||||
|
Optional persistent As Boolean = True) As String
|
||||||
|
Try
|
||||||
|
Dim targetDriveLetter As String = ""
|
||||||
|
|
||||||
|
' Szenario 1: Kein Laufwerksbuchstabe angegeben -> Automatische Auswahl
|
||||||
|
If String.IsNullOrEmpty(driveLetter) Then
|
||||||
|
LOGGER.Info("Kein Laufwerksbuchstabe angegeben - suche nächsten freien Buchstaben...")
|
||||||
|
targetDriveLetter = GetNextFreeDriveLetter(blacklist)
|
||||||
|
|
||||||
|
If String.IsNullOrEmpty(targetDriveLetter) Then
|
||||||
|
LOGGER.Error("Kein freier Laufwerksbuchstabe verfügbar!")
|
||||||
|
Return String.Empty
|
||||||
|
End If
|
||||||
|
|
||||||
|
LOGGER.Info($"Automatisch gewählter Laufwerksbuchstabe: {targetDriveLetter}")
|
||||||
|
Else
|
||||||
|
' Szenario 2: Spezifischer Laufwerksbuchstabe angegeben
|
||||||
|
targetDriveLetter = driveLetter.Trim().ToUpper()
|
||||||
|
If Not targetDriveLetter.EndsWith(":") Then
|
||||||
|
targetDriveLetter &= ":"
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Prüfen ob Laufwerk verfügbar ist
|
||||||
|
If Not IsDriveLetterAvailable(targetDriveLetter, blacklist) Then
|
||||||
|
LOGGER.Error($"Laufwerk {targetDriveLetter} ist nicht verfügbar (bereits verwendet oder in Blacklist)")
|
||||||
|
Return String.Empty
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Laufwerk mappen
|
||||||
|
If MapNetworkDriveInternal(targetDriveLetter, networkPath, userName, password, persistent) Then
|
||||||
|
LOGGER.Info($"✓ Netzlaufwerk {targetDriveLetter} erfolgreich gemappt zu {networkPath}")
|
||||||
|
Return targetDriveLetter
|
||||||
|
Else
|
||||||
|
LOGGER.Error($"✗ Fehler beim Mappen von {targetDriveLetter}")
|
||||||
|
Return String.Empty
|
||||||
|
End If
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
LOGGER.Error($"Fehler in MapNetworkDrive: {ex.Message}")
|
||||||
|
LOGGER.Error(ex)
|
||||||
|
Return String.Empty
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Interne Methode zum tatsächlichen Mappen eines Netzlaufwerks
|
||||||
|
''' </summary>
|
||||||
|
Private Shared Function MapNetworkDriveInternal(driveLetter As String,
|
||||||
|
networkPath As String,
|
||||||
|
userName As String,
|
||||||
|
password As String,
|
||||||
|
persistent As Boolean) As Boolean
|
||||||
|
Try
|
||||||
|
' Erst trennen falls vorhanden (ohne Fehler wenn nicht vorhanden)
|
||||||
|
DisconnectNetworkDrive(driveLetter, True)
|
||||||
|
|
||||||
|
' NETRESOURCE-Struktur vorbereiten
|
||||||
|
Dim netResource As New NETRESOURCE With {
|
||||||
|
.dwType = RESOURCETYPE_DISK,
|
||||||
|
.lpLocalName = driveLetter,
|
||||||
|
.lpRemoteName = networkPath
|
||||||
|
}
|
||||||
|
|
||||||
|
Dim flags As Integer = If(persistent, CONNECT_UPDATE_PROFILE, 0)
|
||||||
|
|
||||||
|
' WICHTIG: Credentials als Nothing übergeben = Verwende aktuelle Windows-Credentials
|
||||||
|
' Wenn der Share öffentlich oder mit aktuellen Credentials erreichbar ist, funktioniert es
|
||||||
|
Dim result As Integer = WNetAddConnection2(netResource, password, userName, flags)
|
||||||
|
|
||||||
|
Select Case result
|
||||||
|
Case ERROR_SUCCESS
|
||||||
|
LOGGER.Debug($"✓ Laufwerk {driveLetter} erfolgreich gemappt")
|
||||||
|
Return True
|
||||||
|
|
||||||
|
Case 1326 ' ERROR_LOGON_FAILURE
|
||||||
|
LOGGER.Error($"❌ Authentifizierungsfehler (1326): Anmeldung fehlgeschlagen für [{networkPath}]")
|
||||||
|
LOGGER.Error($" → Der UNC-Pfad erfordert möglicherweise spezielle Credentials")
|
||||||
|
LOGGER.Error($" → Oder der aktuelle Benutzer hat keine Berechtigung")
|
||||||
|
Return False
|
||||||
|
|
||||||
|
Case 53 ' ERROR_BAD_NETPATH
|
||||||
|
LOGGER.Error($"❌ Netzwerkpfad nicht gefunden (53): [{networkPath}]")
|
||||||
|
Return False
|
||||||
|
|
||||||
|
Case 67 ' ERROR_BAD_NET_NAME
|
||||||
|
LOGGER.Error($"❌ Netzwerkname ungültig (67): [{networkPath}]")
|
||||||
|
Return False
|
||||||
|
|
||||||
|
Case 85 ' ERROR_ALREADY_ASSIGNED
|
||||||
|
LOGGER.Warn($"⚠️ Laufwerk {driveLetter} ist bereits zugewiesen (85)")
|
||||||
|
' Versuche es zu trennen und erneut zu verbinden
|
||||||
|
DisconnectNetworkDrive(driveLetter, force:=True)
|
||||||
|
System.Threading.Thread.Sleep(500) ' Kurze Pause
|
||||||
|
result = WNetAddConnection2(netResource, password, userName, flags)
|
||||||
|
If result = ERROR_SUCCESS Then
|
||||||
|
LOGGER.Info($"✓ Laufwerk {driveLetter} nach erneutem Versuch erfolgreich gemappt")
|
||||||
|
Return True
|
||||||
|
Else
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
|
||||||
|
Case Else
|
||||||
|
LOGGER.Error($"❌ WNetAddConnection2 Error Code: {result}")
|
||||||
|
Return False
|
||||||
|
End Select
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
LOGGER.Error($"Fehler in MapNetworkDriveInternal: {ex.Message}")
|
||||||
|
LOGGER.Error(ex)
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
''' <summary>
|
||||||
|
''' Test-Funktion um UNC-Pfad-Zugriff zu prüfen
|
||||||
|
''' </summary>
|
||||||
|
Public Shared Function TestUNCAccess(uncPath As String) As Boolean
|
||||||
|
Try
|
||||||
|
LOGGER.Info($"🔍 Teste Zugriff auf UNC-Pfad: [{uncPath}]")
|
||||||
|
|
||||||
|
' Teste ob Pfad existiert und erreichbar ist
|
||||||
|
If System.IO.Directory.Exists(uncPath) Then
|
||||||
|
LOGGER.Info($"✓ UNC-Pfad ist direkt erreichbar ohne Mapping")
|
||||||
|
|
||||||
|
' Teste Lese-Berechtigung
|
||||||
|
Try
|
||||||
|
Dim files = System.IO.Directory.GetFiles(uncPath)
|
||||||
|
LOGGER.Info($"✓ Lese-Berechtigung vorhanden ({files.Length} Dateien gefunden)")
|
||||||
|
Return True
|
||||||
|
Catch permEx As UnauthorizedAccessException
|
||||||
|
LOGGER.Error($"❌ Keine Lese-Berechtigung: {permEx.Message}")
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
Else
|
||||||
|
LOGGER.Error($"❌ UNC-Pfad nicht erreichbar oder existiert nicht")
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
LOGGER.Error($"❌ Fehler beim Testen des UNC-Zugriffs: {ex.Message}")
|
||||||
|
LOGGER.Error(ex)
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
''' <summary>
|
||||||
|
''' Trennt ein Netzlaufwerk mit Windows-API
|
||||||
|
''' </summary>
|
||||||
|
Public Shared Function DisconnectNetworkDrive(driveLetter As String, Optional force As Boolean = True) As Boolean
|
||||||
|
Try
|
||||||
|
' Formatierung sicherstellen
|
||||||
|
driveLetter = driveLetter.Trim().ToUpper()
|
||||||
|
If Not driveLetter.EndsWith(":") Then
|
||||||
|
driveLetter &= ":"
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim flags As Integer = CONNECT_UPDATE_PROFILE
|
||||||
|
Dim result As Integer = WNetCancelConnection2(driveLetter, flags, force)
|
||||||
|
|
||||||
|
If result = ERROR_SUCCESS Then
|
||||||
|
LOGGER.Debug($"Netzlaufwerk {driveLetter} erfolgreich getrennt")
|
||||||
|
Return True
|
||||||
|
ElseIf result = ERROR_ALREADY_ASSIGNED Then
|
||||||
|
LOGGER.Debug($"Netzlaufwerk {driveLetter} war nicht verbunden")
|
||||||
|
Return True
|
||||||
|
Else
|
||||||
|
LOGGER.Warn($"Warnung beim Trennen von {driveLetter}: Error Code {result}")
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
LOGGER.Debug($"Fehler beim Trennen von {driveLetter} (ignoriert): {ex.Message}")
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Ermittelt alle gemappten Netzlaufwerke
|
||||||
|
''' </summary>
|
||||||
|
Public Shared Function GetMappedNetworkDrives() As List(Of NetworkDriveInfo)
|
||||||
|
Dim mappedDrives As New List(Of NetworkDriveInfo)
|
||||||
|
|
||||||
|
Try
|
||||||
|
For Each drive As IO.DriveInfo In IO.DriveInfo.GetDrives()
|
||||||
|
If drive.DriveType = IO.DriveType.Network Then
|
||||||
|
Dim driveInfo As New NetworkDriveInfo With {
|
||||||
|
.DriveLetter = drive.Name,
|
||||||
|
.NetworkPath = GetNetworkPath(drive.Name),
|
||||||
|
.DriveType = drive.DriveType,
|
||||||
|
.IsReady = drive.IsReady
|
||||||
|
}
|
||||||
|
|
||||||
|
If drive.IsReady Then
|
||||||
|
Try
|
||||||
|
driveInfo.TotalSize = drive.TotalSize
|
||||||
|
driveInfo.FreeSpace = drive.AvailableFreeSpace
|
||||||
|
Catch ex As Exception
|
||||||
|
LOGGER.Debug($"Konnte Größeninformationen für {drive.Name} nicht ermitteln: {ex.Message}")
|
||||||
|
End Try
|
||||||
|
End If
|
||||||
|
|
||||||
|
mappedDrives.Add(driveInfo)
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
LOGGER.Debug($"Insgesamt {mappedDrives.Count} Netzlaufwerk(e) gefunden")
|
||||||
|
Return mappedDrives
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
LOGGER.Error($"Fehler beim Ermitteln der Netzlaufwerke: {ex.Message}")
|
||||||
|
LOGGER.Error(ex)
|
||||||
|
Return mappedDrives
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Ermittelt den UNC-Pfad eines gemappten Laufwerks
|
||||||
|
''' </summary>
|
||||||
|
Public Shared Function GetNetworkPath(driveLetter As String) As String
|
||||||
|
Try
|
||||||
|
driveLetter = driveLetter.Trim().ToUpper()
|
||||||
|
If Not driveLetter.EndsWith(":") Then
|
||||||
|
driveLetter &= ":"
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim network As Object = CreateObject("WScript.Network")
|
||||||
|
Dim enumDrives As Object = network.EnumNetworkDrives()
|
||||||
|
|
||||||
|
For i As Integer = 0 To enumDrives.Count - 1 Step 2
|
||||||
|
If enumDrives.Item(i).ToString.Equals(driveLetter, StringComparison.OrdinalIgnoreCase) Then
|
||||||
|
Return enumDrives.Item(i + 1).ToString()
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
Return String.Empty
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
LOGGER.Debug($"Fehler beim Ermitteln des Netzwerkpfads für {driveLetter}: {ex.Message}")
|
||||||
|
Return String.Empty
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Prüft ob ein bestimmtes Laufwerk als Netzlaufwerk gemappt ist
|
||||||
|
''' </summary>
|
||||||
|
Public Shared Function IsDriveMapped(driveLetter As String) As Boolean
|
||||||
|
Try
|
||||||
|
driveLetter = driveLetter.Trim().ToUpper()
|
||||||
|
If Not driveLetter.EndsWith(":") Then
|
||||||
|
driveLetter &= ":"
|
||||||
|
End If
|
||||||
|
If Not driveLetter.EndsWith("\") Then
|
||||||
|
driveLetter &= "\"
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim driveInfo As New IO.DriveInfo(driveLetter)
|
||||||
|
Return driveInfo.DriveType = IO.DriveType.Network AndAlso driveInfo.IsReady
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Gibt eine formatierte Übersicht aller gemappten Netzlaufwerke zurück
|
||||||
|
''' </summary>
|
||||||
|
Public Shared Function GetMappedDrivesInfo() As String
|
||||||
|
Dim result As New System.Text.StringBuilder()
|
||||||
|
Dim drives = GetMappedNetworkDrives()
|
||||||
|
|
||||||
|
If drives.Count = 0 Then
|
||||||
|
Return "Keine Netzlaufwerke gefunden."
|
||||||
|
End If
|
||||||
|
|
||||||
|
result.AppendLine($"Gemappte Netzlaufwerke ({drives.Count}):")
|
||||||
|
result.AppendLine(New String("-"c, 60))
|
||||||
|
|
||||||
|
For Each drive In drives
|
||||||
|
result.AppendLine($"Laufwerk: {drive.DriveLetter}")
|
||||||
|
result.AppendLine($" Pfad: {drive.NetworkPath}")
|
||||||
|
result.AppendLine($" Status: {If(drive.IsReady, "Verfügbar", "Nicht verfügbar")}")
|
||||||
|
|
||||||
|
If drive.IsReady AndAlso drive.TotalSize > 0 Then
|
||||||
|
Dim totalGB As Double = drive.TotalSize / (1024.0 ^ 3)
|
||||||
|
Dim freeGB As Double = drive.FreeSpace / (1024.0 ^ 3)
|
||||||
|
result.AppendLine($" Größe: {totalGB:N2} GB (Frei: {freeGB:N2} GB)")
|
||||||
|
End If
|
||||||
|
|
||||||
|
result.AppendLine()
|
||||||
|
Next
|
||||||
|
|
||||||
|
Return result.ToString()
|
||||||
|
End Function
|
||||||
|
''' <summary>
|
||||||
|
''' Mappt ein spezifisches Laufwerk (z.B. "V") mit Blacklist-Prüfung
|
||||||
|
''' </summary>
|
||||||
|
Public Function MapSpecificDrive(driveLetter As String, blacklist As String, networkPath As String) As Boolean
|
||||||
|
Try
|
||||||
|
' Formatierung sicherstellen
|
||||||
|
driveLetter = driveLetter.Trim().ToUpper().Replace(":", "")
|
||||||
|
|
||||||
|
If String.IsNullOrEmpty(driveLetter) OrElse driveLetter.Length <> 1 Then
|
||||||
|
LOGGER.Warn($"⚠️ Ungültiger Laufwerksbuchstabe: [{driveLetter}]")
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim driveWithColon As String = driveLetter & ":"
|
||||||
|
|
||||||
|
' Prüfen ob Laufwerk verfügbar ist
|
||||||
|
If Not IsDriveLetterAvailable(driveWithColon, blacklist) Then
|
||||||
|
LOGGER.Warn($"⚠️ Laufwerk {driveWithColon} ist nicht verfügbar (bereits verwendet oder in Blacklist)")
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
|
||||||
|
' UNC-Pfad vorbereiten (ohne abschließenden Backslash)
|
||||||
|
Dim uncPath As String = networkPath.TrimEnd("\"c)
|
||||||
|
|
||||||
|
' Laufwerk mappen (OHNE Credentials, persistent=False für temporäres Mapping)
|
||||||
|
Dim result = MapNetworkDrive(driveWithColon, uncPath, blacklist, userName:=Nothing, password:=Nothing, persistent:=False)
|
||||||
|
|
||||||
|
If Not String.IsNullOrEmpty(result) Then
|
||||||
|
LOGGER.Debug($"✓ Laufwerk {driveWithColon} erfolgreich gemappt zu [{uncPath}]")
|
||||||
|
Return True
|
||||||
|
Else
|
||||||
|
LOGGER.Error($"❌ Fehler beim Mappen von {driveWithColon}")
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
LOGGER.Error($"Fehler in MapSpecificDrive: {ex.Message}")
|
||||||
|
LOGGER.Error(ex)
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Mappt automatisch den nächsten freien Laufwerksbuchstaben (Z→A)
|
||||||
|
''' </summary>
|
||||||
|
Public Function MapDriveAutomatic(blacklist As String, networkPath As String) As String
|
||||||
|
Try
|
||||||
|
' UNC-Pfad vorbereiten (ohne abschließenden Backslash)
|
||||||
|
Dim uncPath As String = networkPath.TrimEnd("\"c)
|
||||||
|
|
||||||
|
LOGGER.Debug($"🔍 Suche automatisch freien Laufwerksbuchstaben...")
|
||||||
|
LOGGER.Debug($" Blacklist: [{blacklist}]")
|
||||||
|
LOGGER.Debug($" Netzwerkpfad: [{uncPath}]")
|
||||||
|
|
||||||
|
' Automatisches Mapping (leer = automatische Auswahl, persistent=False)
|
||||||
|
Dim result = MapNetworkDrive("", uncPath, blacklist, userName:=Nothing, password:=Nothing, persistent:=False)
|
||||||
|
|
||||||
|
If Not String.IsNullOrEmpty(result) Then
|
||||||
|
LOGGER.Debug($"✓ Automatisch gewähltes Laufwerk: {result}")
|
||||||
|
Return result
|
||||||
|
Else
|
||||||
|
LOGGER.Error($"❌ Kein freier Laufwerksbuchstabe verfügbar")
|
||||||
|
Return String.Empty
|
||||||
|
End If
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
LOGGER.Error($"Fehler in MapDriveAutomatic: {ex.Message}")
|
||||||
|
LOGGER.Error(ex)
|
||||||
|
Return String.Empty
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
311
app/TaskFlow/ClassDocumentPathHandler.vb
Normal file
311
app/TaskFlow/ClassDocumentPathHandler.vb
Normal file
@@ -0,0 +1,311 @@
|
|||||||
|
Imports System.IO
|
||||||
|
Imports DigitalData.Modules.Logging
|
||||||
|
''' <summary>
|
||||||
|
''' Zentrale Klasse für Dokumentenpfad-Verwaltung mit optionalem Laufwerks-Mapping und Temp-Kopie
|
||||||
|
''' </summary>
|
||||||
|
Public Class ClassDocumentPathHandler
|
||||||
|
|
||||||
|
Private ReadOnly _logger As Logger
|
||||||
|
Private _mappedDrive As String = ""
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Initialisiert den DocumentPathHandler
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="logger">Logger-Instanz</param>
|
||||||
|
Public Sub New(logger As Logger)
|
||||||
|
_logger = logger
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Verarbeitet einen Dokumentenpfad: Optional Mapping, dann Temp-Kopie
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="sourcePath">Quell-Pfad der Datei (UNC oder lokal)</param>
|
||||||
|
''' <param name="options">Optionen für die Verarbeitung</param>
|
||||||
|
''' <returns>DocumentPathResult mit finalem Pfad und Mapping-Info</returns>
|
||||||
|
Public Function ProcessDocumentPath(sourcePath As String, options As DocumentPathOptions) As DocumentPathResult
|
||||||
|
Dim result As New DocumentPathResult With {
|
||||||
|
.SourcePath = sourcePath,
|
||||||
|
.FinalPath = sourcePath,
|
||||||
|
.Success = False,
|
||||||
|
.WasMapped = False,
|
||||||
|
.WasCopiedToTemp = False
|
||||||
|
}
|
||||||
|
|
||||||
|
Try
|
||||||
|
' Validierung
|
||||||
|
If String.IsNullOrEmpty(sourcePath) Then
|
||||||
|
result.ErrorMessage = "Quell-Pfad ist leer"
|
||||||
|
_logger.Error("❌ ProcessDocumentPath: Quell-Pfad ist leer")
|
||||||
|
Return result
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim workingPath As String = sourcePath
|
||||||
|
|
||||||
|
' ========== SCHRITT 1: OPTIONALES LAUFWERKS-MAPPING ==========
|
||||||
|
If options.EnableMapping AndAlso Not String.IsNullOrEmpty(options.WMSuffix) Then
|
||||||
|
Dim mappingResult = TryMapNetworkDrive(sourcePath, options)
|
||||||
|
If mappingResult.Success Then
|
||||||
|
workingPath = mappingResult.MappedPath
|
||||||
|
_mappedDrive = mappingResult.DriveLetter
|
||||||
|
result.WasMapped = True
|
||||||
|
result.MappedDrive = _mappedDrive
|
||||||
|
_logger.Info($"✓ Laufwerk gemappt: {_mappedDrive}")
|
||||||
|
Else
|
||||||
|
_logger.Warn("⚠️ Laufwerks-Mapping fehlgeschlagen - verwende Original-UNC-Pfad")
|
||||||
|
workingPath = sourcePath
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
' ========== SCHRITT 2: PRÜFEN OB DATEI EXISTIERT ==========
|
||||||
|
If Not File.Exists(workingPath) Then
|
||||||
|
result.ErrorMessage = $"Datei nicht gefunden: [{workingPath}]"
|
||||||
|
_logger.Error($"❌ {result.ErrorMessage}")
|
||||||
|
|
||||||
|
' Cleanup bei Fehler
|
||||||
|
If result.WasMapped Then
|
||||||
|
UnmapDrive()
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return result
|
||||||
|
End If
|
||||||
|
|
||||||
|
' ========== SCHRITT 3: OPTIONALE TEMP-KOPIE ==========
|
||||||
|
If options.CopyToTemp Then
|
||||||
|
Dim tempResult = CopyToTempFolder(workingPath, options.TempFolder)
|
||||||
|
If tempResult.Success Then
|
||||||
|
result.FinalPath = tempResult.TempPath
|
||||||
|
result.WasCopiedToTemp = True
|
||||||
|
result.TempPath = tempResult.TempPath
|
||||||
|
_logger.Info($"✓ Datei in Temp kopiert: [{Path.GetFileName(tempResult.TempPath)}]")
|
||||||
|
|
||||||
|
' Laufwerk unmappen nach erfolgreicher Kopie
|
||||||
|
If result.WasMapped AndAlso options.UnmapAfterCopy Then
|
||||||
|
UnmapDrive()
|
||||||
|
result.WasMapped = False ' Wurde bereits getrennt
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
_logger.Warn($"⚠️ Temp-Kopie fehlgeschlagen: {tempResult.ErrorMessage}")
|
||||||
|
result.FinalPath = workingPath
|
||||||
|
|
||||||
|
' Cleanup bei Fehler
|
||||||
|
If result.WasMapped Then
|
||||||
|
UnmapDrive()
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
result.FinalPath = workingPath
|
||||||
|
_logger.Debug($"📄 Verwende Pfad ohne Temp-Kopie: [{workingPath}]")
|
||||||
|
End If
|
||||||
|
|
||||||
|
result.Success = True
|
||||||
|
Return result
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
result.ErrorMessage = $"Unerwarteter Fehler: {ex.Message}"
|
||||||
|
_logger.Error($"❌ ProcessDocumentPath: {ex.Message}")
|
||||||
|
_logger.Error(ex)
|
||||||
|
|
||||||
|
' Cleanup bei Exception
|
||||||
|
If result.WasMapped Then
|
||||||
|
UnmapDrive()
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return result
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Versucht ein Netzlaufwerk zu mappen
|
||||||
|
''' </summary>
|
||||||
|
Private Function TryMapNetworkDrive(sourcePath As String, options As DocumentPathOptions) As MappingResult
|
||||||
|
Dim result As New MappingResult With {.Success = False}
|
||||||
|
|
||||||
|
Try
|
||||||
|
' Prüfen ob Pfad mit WMSUFFIX beginnt
|
||||||
|
If Not sourcePath.StartsWith(options.WMSuffix, StringComparison.OrdinalIgnoreCase) Then
|
||||||
|
_logger.Debug($"📄 Pfad beginnt nicht mit WMSUFFIX - kein Mapping erforderlich")
|
||||||
|
Return result
|
||||||
|
End If
|
||||||
|
|
||||||
|
_logger.Debug($"📂 WMSUFFIX erkannt - starte Laufwerks-Mapping")
|
||||||
|
|
||||||
|
' Laufwerk mappen
|
||||||
|
Dim mappedDrive As String = ""
|
||||||
|
Dim allgFunk As New ClassAllgemeineFunktionen()
|
||||||
|
|
||||||
|
If Not String.IsNullOrEmpty(options.SpecificDrive) AndAlso options.SpecificDrive.Length = 1 Then
|
||||||
|
' Spezifisches Laufwerk
|
||||||
|
If allgFunk.MapSpecificDrive(options.SpecificDrive, options.DriveBlacklist, options.WMSuffix) Then
|
||||||
|
mappedDrive = options.SpecificDrive & ":"
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
' Automatisches Mapping
|
||||||
|
mappedDrive = allgFunk.MapDriveAutomatic(options.DriveBlacklist, options.WMSuffix)
|
||||||
|
End If
|
||||||
|
|
||||||
|
If String.IsNullOrEmpty(mappedDrive) Then
|
||||||
|
_logger.Warn("⚠️ Kein Laufwerk gemappt")
|
||||||
|
Return result
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Pfad umschreiben
|
||||||
|
Dim relativePath As String = sourcePath.Substring(options.WMSuffix.Length)
|
||||||
|
If relativePath.StartsWith("\") Then
|
||||||
|
relativePath = relativePath.Substring(1)
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim mappedPath As String = mappedDrive.TrimEnd(":"c, "\"c) & ":\" & relativePath
|
||||||
|
|
||||||
|
_logger.Debug($"📄 Original: [{sourcePath}]")
|
||||||
|
_logger.Debug($"📄 Gemappt: [{mappedPath}]")
|
||||||
|
|
||||||
|
result.Success = True
|
||||||
|
result.DriveLetter = mappedDrive
|
||||||
|
result.MappedPath = mappedPath
|
||||||
|
Return result
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
_logger.Error($"Fehler beim Mapping: {ex.Message}")
|
||||||
|
_logger.Error(ex)
|
||||||
|
Return result
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Kopiert Datei in Temp-Ordner mit eindeutigem Zeitstempel
|
||||||
|
''' </summary>
|
||||||
|
Private Function CopyToTempFolder(sourcePath As String, tempFolder As String) As TempCopyResult
|
||||||
|
Dim result As New TempCopyResult With {.Success = False}
|
||||||
|
|
||||||
|
Try
|
||||||
|
' Temp-Ordner validieren
|
||||||
|
If String.IsNullOrEmpty(tempFolder) Then
|
||||||
|
result.ErrorMessage = "Temp-Ordner nicht gesetzt"
|
||||||
|
_logger.Warn("⚠️ TEMP_DOCUMENT_FOLDER ist nicht gesetzt")
|
||||||
|
|
||||||
|
If Not frmValidator.InitializeTempFolder() Then
|
||||||
|
result.ErrorMessage = "Temp-Ordner konnte nicht initialisiert werden"
|
||||||
|
Return result
|
||||||
|
End If
|
||||||
|
|
||||||
|
tempFolder = TEMP_DOCUMENT_FOLDER
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Not Directory.Exists(tempFolder) Then
|
||||||
|
result.ErrorMessage = $"Temp-Ordner existiert nicht: [{tempFolder}]"
|
||||||
|
_logger.Error($"❌ {result.ErrorMessage}")
|
||||||
|
Return result
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Eindeutigen Dateinamen generieren
|
||||||
|
Dim originalFileName As String = Path.GetFileName(sourcePath)
|
||||||
|
Dim fileNameWithoutExt As String = Path.GetFileNameWithoutExtension(originalFileName)
|
||||||
|
Dim extension As String = Path.GetExtension(originalFileName)
|
||||||
|
Dim timestamp As String = DateTime.Now.ToString("yyyyMMdd_HHmmss_fff")
|
||||||
|
Dim uniqueFileName As String = $"{fileNameWithoutExt}_{timestamp}{extension}"
|
||||||
|
Dim targetPath As String = Path.Combine(tempFolder, uniqueFileName)
|
||||||
|
|
||||||
|
_logger.Debug($"📄 Kopiere nach Temp:")
|
||||||
|
_logger.Debug($" Von: [{sourcePath}]")
|
||||||
|
_logger.Debug($" Nach: [{targetPath}]")
|
||||||
|
|
||||||
|
' Datei kopieren
|
||||||
|
File.Copy(sourcePath, targetPath, overwrite:=True)
|
||||||
|
|
||||||
|
result.Success = True
|
||||||
|
result.TempPath = targetPath
|
||||||
|
result.TempFileName = uniqueFileName
|
||||||
|
Return result
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
result.ErrorMessage = $"Fehler beim Kopieren: {ex.Message}"
|
||||||
|
_logger.Error($"❌ {result.ErrorMessage}")
|
||||||
|
_logger.Error(ex)
|
||||||
|
Return result
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Trennt das gemappte Laufwerk
|
||||||
|
''' </summary>
|
||||||
|
Public Sub UnmapDrive()
|
||||||
|
If Not String.IsNullOrEmpty(_mappedDrive) Then
|
||||||
|
Try
|
||||||
|
If ClassAllgemeineFunktionen.DisconnectNetworkDrive(_mappedDrive, force:=True) Then
|
||||||
|
_logger.Info($"🔌 Laufwerk {_mappedDrive} getrennt")
|
||||||
|
Else
|
||||||
|
_logger.Warn($"⚠️ Warnung beim Trennen von {_mappedDrive}")
|
||||||
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
_logger.Debug($"Fehler beim Trennen von {_mappedDrive}: {ex.Message}")
|
||||||
|
Finally
|
||||||
|
_mappedDrive = ""
|
||||||
|
End Try
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Cleanup-Methode (z.B. beim Schließen des Forms)
|
||||||
|
''' </summary>
|
||||||
|
Public Sub Cleanup()
|
||||||
|
UnmapDrive()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
#Region "Nested Classes für Optionen und Ergebnisse"
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Optionen für die Dokumentenpfad-Verarbeitung
|
||||||
|
''' </summary>
|
||||||
|
Public Class DocumentPathOptions
|
||||||
|
''' <summary>Soll Laufwerks-Mapping versucht werden?</summary>
|
||||||
|
Public Property EnableMapping As Boolean = False
|
||||||
|
|
||||||
|
''' <summary>WMSUFFIX für Mapping-Erkennung (z.B. "\\windream\objects")</summary>
|
||||||
|
Public Property WMSuffix As String = ""
|
||||||
|
|
||||||
|
''' <summary>Spezifischer Laufwerksbuchstabe (z.B. "V") oder leer für automatisch</summary>
|
||||||
|
Public Property SpecificDrive As String = ""
|
||||||
|
|
||||||
|
''' <summary>Blacklist für Laufwerksbuchstaben (z.B. "Y,M,V")</summary>
|
||||||
|
Public Property DriveBlacklist As String = ""
|
||||||
|
|
||||||
|
''' <summary>Soll Datei in Temp kopiert werden?</summary>
|
||||||
|
Public Property CopyToTemp As Boolean = False
|
||||||
|
|
||||||
|
''' <summary>Temp-Ordner-Pfad</summary>
|
||||||
|
Public Property TempFolder As String = ""
|
||||||
|
|
||||||
|
''' <summary>Laufwerk nach erfolgreicher Temp-Kopie unmappen?</summary>
|
||||||
|
Public Property UnmapAfterCopy As Boolean = True
|
||||||
|
End Class
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Ergebnis der Dokumentenpfad-Verarbeitung
|
||||||
|
''' </summary>
|
||||||
|
Public Class DocumentPathResult
|
||||||
|
Public Property Success As Boolean
|
||||||
|
Public Property SourcePath As String
|
||||||
|
Public Property FinalPath As String
|
||||||
|
Public Property ErrorMessage As String
|
||||||
|
Public Property WasMapped As Boolean
|
||||||
|
Public Property MappedDrive As String
|
||||||
|
Public Property WasCopiedToTemp As Boolean
|
||||||
|
Public Property TempPath As String
|
||||||
|
End Class
|
||||||
|
|
||||||
|
Private Class MappingResult
|
||||||
|
Public Property Success As Boolean
|
||||||
|
Public Property DriveLetter As String
|
||||||
|
Public Property MappedPath As String
|
||||||
|
End Class
|
||||||
|
|
||||||
|
Private Class TempCopyResult
|
||||||
|
Public Property Success As Boolean
|
||||||
|
Public Property TempPath As String
|
||||||
|
Public Property TempFileName As String
|
||||||
|
Public Property ErrorMessage As String
|
||||||
|
End Class
|
||||||
|
|
||||||
|
#End Region
|
||||||
|
|
||||||
|
End Class
|
||||||
@@ -483,6 +483,14 @@ Public Class ClassInit
|
|||||||
'BASEDATA_DT_TBDD_CONNECTION = DataASorDB.GetDatatable("DD_ECM", oSql, "TBDD_CONNECTION", "")
|
'BASEDATA_DT_TBDD_CONNECTION = DataASorDB.GetDatatable("DD_ECM", oSql, "TBDD_CONNECTION", "")
|
||||||
BASEDATA_DT_TBDD_CONNECTION = DatabaseFallback.GetDatatable("TBDD_CONNECTION", New GetDatatableOptions(oSql, DatabaseType.ECM))
|
BASEDATA_DT_TBDD_CONNECTION = DatabaseFallback.GetDatatable("TBDD_CONNECTION", New GetDatatableOptions(oSql, DatabaseType.ECM))
|
||||||
|
|
||||||
|
oStep = "TBDD_CATALOG"
|
||||||
|
oSql = "select CAT_TITLE,CAT_STRING from TBDD_CATALOG"
|
||||||
|
BASEDATA_DT_TBDD_CATALOG = DatabaseFallback.GetDatatable("TBDD_CATALOG", New GetDatatableOptions(oSql, DatabaseType.ECM))
|
||||||
|
|
||||||
|
For Each oROW As DataRow In BASEDATA_DT_TBDD_CATALOG.Rows
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
oStep = "TBDD_3RD_PARTY_MODULES"
|
oStep = "TBDD_3RD_PARTY_MODULES"
|
||||||
oSql = "Select * FROM TBDD_3RD_PARTY_MODULES WHERE ACTIVE = 1"
|
oSql = "Select * FROM TBDD_3RD_PARTY_MODULES WHERE ACTIVE = 1"
|
||||||
Dim oTBDD_3RD_PARTY_MODULES As DataTable
|
Dim oTBDD_3RD_PARTY_MODULES As DataTable
|
||||||
|
|||||||
@@ -95,9 +95,7 @@ Public Class ClassParamRefresh
|
|||||||
Else
|
Else
|
||||||
Dim Database_IDB As MSSQLServer = Nothing
|
Dim Database_IDB As MSSQLServer = Nothing
|
||||||
Dim CON_ID = oMode.Replace("PM.IDB_CONID!", "")
|
Dim CON_ID = oMode.Replace("PM.IDB_CONID!", "")
|
||||||
|
|
||||||
Dim oConString = DatabaseFallback.GetConnectionString(CON_ID)
|
Dim oConString = DatabaseFallback.GetConnectionString(CON_ID)
|
||||||
|
|
||||||
CONNECTION_STRING_IDB = oConString
|
CONNECTION_STRING_IDB = oConString
|
||||||
Database_IDB = New MSSQLServer(LOGCONFIG, CONNECTION_STRING_IDB)
|
Database_IDB = New MSSQLServer(LOGCONFIG, CONNECTION_STRING_IDB)
|
||||||
If Database_IDB.DBInitialized = True Then
|
If Database_IDB.DBInitialized = True Then
|
||||||
@@ -172,7 +170,6 @@ Public Class ClassParamRefresh
|
|||||||
LOGGER.Debug($"MON_EDITED_COLUMN: {oLEDITEDCOL}")
|
LOGGER.Debug($"MON_EDITED_COLUMN: {oLEDITEDCOL}")
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
|
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
ElseIf oMode.StartsWith("PM.MON_COL_ADDED_WHEN") Then
|
ElseIf oMode.StartsWith("PM.MON_COL_ADDED_WHEN") Then
|
||||||
Dim oLEDITEDCOL = oMode.Replace("PM.MON_COL_ADDED_WHEN=", "")
|
Dim oLEDITEDCOL = oMode.Replace("PM.MON_COL_ADDED_WHEN=", "")
|
||||||
@@ -181,7 +178,6 @@ Public Class ClassParamRefresh
|
|||||||
LOGGER.Debug($"MON_COL_ADDED_WHEN: {oLEDITEDCOL}")
|
LOGGER.Debug($"MON_COL_ADDED_WHEN: {oLEDITEDCOL}")
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
|
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
ElseIf oMode.StartsWith("PM.USE_APPSERVER") Then
|
ElseIf oMode.StartsWith("PM.USE_APPSERVER") Then
|
||||||
Dim oUSE_APPSERVER = oMode.Replace("PM.USE_APPSERVER=", "")
|
Dim oUSE_APPSERVER = oMode.Replace("PM.USE_APPSERVER=", "")
|
||||||
@@ -189,7 +185,27 @@ Public Class ClassParamRefresh
|
|||||||
USE_APPSERVER = CBool(oUSE_APPSERVER)
|
USE_APPSERVER = CBool(oUSE_APPSERVER)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
USE_APPSERVER = False
|
USE_APPSERVER = False
|
||||||
|
End Try
|
||||||
|
ElseIf oMode.StartsWith("PM.COPYWM2TEMP") Then
|
||||||
|
Dim oCOPYWM2TEMP = oMode.Replace("PM.COPYWM2TEMP=", "")
|
||||||
|
Try
|
||||||
|
COPY_WMFILE_2TEMP = CBool(oCOPYWM2TEMP)
|
||||||
|
Catch ex As Exception
|
||||||
|
COPY_WMFILE_2TEMP = False
|
||||||
|
End Try
|
||||||
|
ElseIf oMode.StartsWith("PM.MAP_SHARE_DRIVE") Then
|
||||||
|
Dim oMAP_SHARE_DRIVE = oMode.Replace("PM.MAP_SHARE_DRIVE=", "")
|
||||||
|
Try
|
||||||
|
MAP_SHARE_DRIVE = oMAP_SHARE_DRIVE
|
||||||
|
Catch ex As Exception
|
||||||
|
oMAP_SHARE_DRIVE = String.Empty
|
||||||
|
End Try
|
||||||
|
ElseIf oMode.StartsWith("PM.MAP_BLACKLIST") Then
|
||||||
|
Dim oMAP_BLACKLIST = oMode.Replace("PM.MAP_BLACKLIST=", "")
|
||||||
|
Try
|
||||||
|
MAP_BLACKLIST = oMAP_BLACKLIST
|
||||||
|
Catch ex As Exception
|
||||||
|
MAP_BLACKLIST = String.Empty
|
||||||
End Try
|
End Try
|
||||||
ElseIf oMode.StartsWith("PM.SEARCH1") Then
|
ElseIf oMode.StartsWith("PM.SEARCH1") Then
|
||||||
Dim oSearch1 = oMode.Replace("PM.SEARCH1=", "")
|
Dim oSearch1 = oMode.Replace("PM.SEARCH1=", "")
|
||||||
@@ -197,7 +213,6 @@ Public Class ClassParamRefresh
|
|||||||
SEARCH1 = oSearch1
|
SEARCH1 = oSearch1
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
SEARCH1 = ""
|
SEARCH1 = ""
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
ElseIf oMode.StartsWith("PM.SEARCH2") Then
|
ElseIf oMode.StartsWith("PM.SEARCH2") Then
|
||||||
Dim oSearch2 = oMode.Replace("PM.SEARCH2=", "")
|
Dim oSearch2 = oMode.Replace("PM.SEARCH2=", "")
|
||||||
@@ -205,7 +220,6 @@ Public Class ClassParamRefresh
|
|||||||
SEARCH2 = oSearch2
|
SEARCH2 = oSearch2
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
SEARCH2 = ""
|
SEARCH2 = ""
|
||||||
|
|
||||||
End Try
|
End Try
|
||||||
ElseIf oMode.StartsWith("PM.TRAFFICLIGHT_ICON") Then
|
ElseIf oMode.StartsWith("PM.TRAFFICLIGHT_ICON") Then
|
||||||
Dim oParam = oMode.Replace("PM.TRAFFICLIGHT_ICON=", "")
|
Dim oParam = oMode.Replace("PM.TRAFFICLIGHT_ICON=", "")
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
Public Property CONNECTION_STRING_ECM As String = ""
|
Public Property CONNECTION_STRING_ECM As String = ""
|
||||||
Public Property CONNECTION_STRING_IDB As String = ""
|
Public Property CONNECTION_STRING_IDB As String = ""
|
||||||
Public Property IDB_ACTIVE As Boolean = False
|
Public Property IDB_ACTIVE As Boolean = False
|
||||||
|
Public Property COPY_WMFILE_2TEMP As Boolean = False
|
||||||
|
Public Property MAP_SHARE_DRIVE As String = String.Empty
|
||||||
|
Public Property MAP_BLACKLIST As String = String.Empty
|
||||||
Public Property EDMIAppServerActive As Boolean = False
|
Public Property EDMIAppServerActive As Boolean = False
|
||||||
|
|
||||||
Public Property OPERATION_MODE_FS As String = "PURE_WM"
|
Public Property OPERATION_MODE_FS As String = "PURE_WM"
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ Module ModuleRuntimeVariables
|
|||||||
' Diese Werte müssen später zur Laufzeit geladen werden
|
' Diese Werte müssen später zur Laufzeit geladen werden
|
||||||
Public Property ActiveWorkflowType As Integer
|
Public Property ActiveWorkflowType As Integer
|
||||||
Public Property BASEDATA_DT_TBDD_CONNECTION As DataTable
|
Public Property BASEDATA_DT_TBDD_CONNECTION As DataTable
|
||||||
|
Public Property BASEDATA_DT_TBDD_CATALOG As DataTable
|
||||||
Public Property BASEDATA_DT_TBDD_SQL_COMMANDS As DataTable
|
Public Property BASEDATA_DT_TBDD_SQL_COMMANDS As DataTable
|
||||||
Public Property BASEDATA_DT_CONFIG As DataTable
|
Public Property BASEDATA_DT_CONFIG As DataTable
|
||||||
Public Property BASEDATA_DTGRID_GROUPS As DataTable
|
Public Property BASEDATA_DTGRID_GROUPS As DataTable
|
||||||
@@ -82,6 +83,10 @@ Module ModuleRuntimeVariables
|
|||||||
Public Property USER_USERNAME_ORG As String = ""
|
Public Property USER_USERNAME_ORG As String = ""
|
||||||
Public Property USER_GHOST_MODE_ACTIVE As Boolean = False
|
Public Property USER_GHOST_MODE_ACTIVE As Boolean = False
|
||||||
Public Property USER_GHOST_MODE_USRNAME As String = ""
|
Public Property USER_GHOST_MODE_USRNAME As String = ""
|
||||||
|
''' <summary>
|
||||||
|
''' Temporärer Ordner für Dokumentkopien (wenn COPY_WMFILE_2TEMP = True)
|
||||||
|
''' </summary>
|
||||||
|
Public TEMP_DOCUMENT_FOLDER As String = String.Empty
|
||||||
Public Class UserInheritanceConfirmation
|
Public Class UserInheritanceConfirmation
|
||||||
Public Property ColumnName As String = ""
|
Public Property ColumnName As String = ""
|
||||||
Public Property Count As Integer
|
Public Property Count As Integer
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ Public Class frmAnnotations
|
|||||||
|
|
||||||
Try
|
Try
|
||||||
Me.Cursor = Cursors.WaitCursor
|
Me.Cursor = Cursors.WaitCursor
|
||||||
ClassAnnotation.Annotate_PDF(txttitle.Text, txtcontent.Text, txtSeitenzahl.Text, True)
|
' ClassAnnotation.Annotate_PDF(txttitle.Text, txtcontent.Text, txtSeitenzahl.Text, True)
|
||||||
Me.Cursor = Cursors.Default
|
Me.Cursor = Cursors.Default
|
||||||
Me.Close()
|
Me.Close()
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
|
|||||||
@@ -140,6 +140,7 @@ Public Class frmValidator
|
|||||||
Private _overlayHandle As Object = Nothing ' ← NEU: Klassenvariable
|
Private _overlayHandle As Object = Nothing ' ← NEU: Klassenvariable
|
||||||
Private _overlayRefCount As Integer = 0 ' ← NEU: Zähler für verschachtelte Calls
|
Private _overlayRefCount As Integer = 0 ' ← NEU: Zähler für verschachtelte Calls
|
||||||
Private _overlayLock As New Object() ' ← NEU: Thread-Safe Lock
|
Private _overlayLock As New Object() ' ← NEU: Thread-Safe Lock
|
||||||
|
Private _documentPathHandler As ClassDocumentPathHandler
|
||||||
|
|
||||||
|
|
||||||
Private Class Translation_Strings
|
Private Class Translation_Strings
|
||||||
@@ -307,6 +308,7 @@ Public Class frmValidator
|
|||||||
DD_Documentloader = New Loader(LOGCONFIG, OperationMode, Environment.Service.Client, Environment.User)
|
DD_Documentloader = New Loader(LOGCONFIG, OperationMode, Environment.Service.Client, Environment.User)
|
||||||
ControlCreator = New ClassControlCreator(LOGCONFIG)
|
ControlCreator = New ClassControlCreator(LOGCONFIG)
|
||||||
Validator = New Validator(LOGCONFIG)
|
Validator = New Validator(LOGCONFIG)
|
||||||
|
_documentPathHandler = New ClassDocumentPathHandler(MyValidationLogger)
|
||||||
|
|
||||||
Override = False
|
Override = False
|
||||||
SplitContainer1.Panel2Collapsed = True
|
SplitContainer1.Panel2Collapsed = True
|
||||||
@@ -328,6 +330,18 @@ Public Class frmValidator
|
|||||||
MyValidationLogger.Info($"[PERF frmValidation_Load] Nach Initialisierung: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
|
MyValidationLogger.Info($"[PERF frmValidation_Load] Nach Initialisierung: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
|
||||||
perfLastCheck = DateTime.Now
|
perfLastCheck = DateTime.Now
|
||||||
End If
|
End If
|
||||||
|
If COPY_WMFILE_2TEMP = True Then
|
||||||
|
If String.IsNullOrEmpty(TEMP_DOCUMENT_FOLDER) OrElse Not System.IO.Directory.Exists(TEMP_DOCUMENT_FOLDER) Then
|
||||||
|
MyValidationLogger.Warn("⚠️ TEMP_DOCUMENT_FOLDER nicht initialisiert → Versuche erneut zu erstellen")
|
||||||
|
If Not InitializeTempFolder() Then
|
||||||
|
MyValidationLogger.Error("❌ Temp-Ordner konnte nicht erstellt werden!")
|
||||||
|
' Optional: Fallback oder Fehlerbehandlung
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
MyValidationLogger.Debug($"✓ Temp-Ordner verfügbar: [{TEMP_DOCUMENT_FOLDER}]")
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
MyValidationLogger.Warn($"⚠️ Error in frmValidation_load1: {ex.Message}")
|
MyValidationLogger.Warn($"⚠️ Error in frmValidation_load1: {ex.Message}")
|
||||||
@@ -680,6 +694,35 @@ Public Class frmValidator
|
|||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
Private _isClosingGuard As Boolean = False
|
Private _isClosingGuard As Boolean = False
|
||||||
|
Public Shared Function InitializeTempFolder() As Boolean
|
||||||
|
Try
|
||||||
|
If COPY_WMFILE_2TEMP = True Then
|
||||||
|
' Basis-Temp-Pfad ermitteln
|
||||||
|
Dim baseTempPath As String = System.IO.Path.GetTempPath()
|
||||||
|
|
||||||
|
' Application-spezifischen Ordner erstellen (z.B. "TaskFlow_Temp")
|
||||||
|
TEMP_DOCUMENT_FOLDER = System.IO.Path.Combine(baseTempPath, "DD_VALIDATOR_Documents")
|
||||||
|
|
||||||
|
' Ordner erstellen, falls nicht vorhanden
|
||||||
|
If Not System.IO.Directory.Exists(TEMP_DOCUMENT_FOLDER) Then
|
||||||
|
System.IO.Directory.CreateDirectory(TEMP_DOCUMENT_FOLDER)
|
||||||
|
LOGGER.Info($"Temporärer Dokumentordner erstellt: [{TEMP_DOCUMENT_FOLDER}]")
|
||||||
|
Else
|
||||||
|
LOGGER.Debug($"Temporärer Dokumentordner existiert bereits: [{TEMP_DOCUMENT_FOLDER}]")
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return True
|
||||||
|
Else
|
||||||
|
LOGGER.Debug("COPY_WMFILE_2TEMP = False → Kein Temp-Ordner nötig")
|
||||||
|
Return True
|
||||||
|
End If
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
LOGGER.Error($"Fehler beim Erstellen des Temp-Ordners: {ex.Message}")
|
||||||
|
LOGGER.Error(ex)
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
Private Sub DetachAllGridEvents(parent As Control)
|
Private Sub DetachAllGridEvents(parent As Control)
|
||||||
For Each ctrl As Control In parent.Controls
|
For Each ctrl As Control In parent.Controls
|
||||||
If TypeOf ctrl Is GridControl Then
|
If TypeOf ctrl Is GridControl Then
|
||||||
@@ -754,7 +797,6 @@ Public Class frmValidator
|
|||||||
|
|
||||||
_FormClosing = True
|
_FormClosing = True
|
||||||
|
|
||||||
' ========== FIX 5: Sichere Prüfung für frmMessages ==========
|
|
||||||
If Not Me.IsDisposed AndAlso Application.OpenForms().OfType(Of frmValidator_Messages).Any Then
|
If Not Me.IsDisposed AndAlso Application.OpenForms().OfType(Of frmValidator_Messages).Any Then
|
||||||
If Not IsNothing(frmMessages) AndAlso Not frmMessages.IsDisposed Then
|
If Not IsNothing(frmMessages) AndAlso Not frmMessages.IsDisposed Then
|
||||||
Try
|
Try
|
||||||
@@ -764,14 +806,12 @@ Public Class frmValidator
|
|||||||
End Try
|
End Try
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
' ========== ENDE FIX 5 ==========
|
|
||||||
|
|
||||||
If LOG_HOTSPOTS Then
|
If LOG_HOTSPOTS Then
|
||||||
MyValidationLogger.Info($"[PERF frmValidation_FormClosing] nach Messages-Close: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
|
MyValidationLogger.Info($"[PERF frmValidation_FormClosing] nach Messages-Close: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
|
||||||
perfLastCheck = DateTime.Now
|
perfLastCheck = DateTime.Now
|
||||||
End If
|
End If
|
||||||
|
|
||||||
' ========== FIX 6: Settings nur bei nicht-disposed Form ==========
|
|
||||||
If Not Me.IsDisposed Then
|
If Not Me.IsDisposed Then
|
||||||
Try
|
Try
|
||||||
' Position und Größe speichern
|
' Position und Größe speichern
|
||||||
@@ -784,14 +824,12 @@ Public Class frmValidator
|
|||||||
MyValidationLogger.Error(ex)
|
MyValidationLogger.Error(ex)
|
||||||
End Try
|
End Try
|
||||||
End If
|
End If
|
||||||
' ========== ENDE FIX 6 ==========
|
|
||||||
|
|
||||||
If LOG_HOTSPOTS Then
|
If LOG_HOTSPOTS Then
|
||||||
MyValidationLogger.Info($"[PERF frmValidation_FormClosing] nach Settings.Save: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
|
MyValidationLogger.Info($"[PERF frmValidation_FormClosing] nach Settings.Save: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
|
||||||
perfLastCheck = DateTime.Now
|
perfLastCheck = DateTime.Now
|
||||||
End If
|
End If
|
||||||
|
|
||||||
' ========== FIX 7: Inactivity Timer ==========
|
|
||||||
If INACTIVITY_DURATION <> 0 Then
|
If INACTIVITY_DURATION <> 0 Then
|
||||||
Try
|
Try
|
||||||
frmMain.Timer_Inactivity_Reset_Disable("FormClosing")
|
frmMain.Timer_Inactivity_Reset_Disable("FormClosing")
|
||||||
@@ -799,14 +837,12 @@ Public Class frmValidator
|
|||||||
MyValidationLogger.Warn($"⚠️ [FormClosing] Timer_Inactivity failed: {ex.Message}")
|
MyValidationLogger.Warn($"⚠️ [FormClosing] Timer_Inactivity failed: {ex.Message}")
|
||||||
End Try
|
End Try
|
||||||
End If
|
End If
|
||||||
' ========== ENDE FIX 7 ==========
|
|
||||||
|
|
||||||
If LOG_HOTSPOTS Then
|
If LOG_HOTSPOTS Then
|
||||||
MyValidationLogger.Info($"[PERF frmValidation_FormClosing] nach Timer-Reset: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
|
MyValidationLogger.Info($"[PERF frmValidation_FormClosing] nach Timer-Reset: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
|
||||||
perfLastCheck = DateTime.Now
|
perfLastCheck = DateTime.Now
|
||||||
End If
|
End If
|
||||||
|
|
||||||
' ========== FIX 8: DB Cleanup ==========
|
|
||||||
Try
|
Try
|
||||||
Dim oSQL As String
|
Dim oSQL As String
|
||||||
If CURRENT_DOC_GUID <> 0 Then
|
If CURRENT_DOC_GUID <> 0 Then
|
||||||
@@ -821,7 +857,6 @@ Public Class frmValidator
|
|||||||
MyValidationLogger.Error(ex)
|
MyValidationLogger.Error(ex)
|
||||||
MsgBox("Error in delete jumped files:" & vbcrlf & ex.Message, MsgBoxStyle.Critical)
|
MsgBox("Error in delete jumped files:" & vbcrlf & ex.Message, MsgBoxStyle.Critical)
|
||||||
End Try
|
End Try
|
||||||
' ========== ENDE FIX 8 ==========
|
|
||||||
|
|
||||||
If LOG_HOTSPOTS Then
|
If LOG_HOTSPOTS Then
|
||||||
MyValidationLogger.Info($"[PERF frmValidation_FormClosing] nach DB-Cleanup: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
|
MyValidationLogger.Info($"[PERF frmValidation_FormClosing] nach DB-Cleanup: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
|
||||||
@@ -835,7 +870,6 @@ Public Class frmValidator
|
|||||||
perfLastCheck = DateTime.Now
|
perfLastCheck = DateTime.Now
|
||||||
End If
|
End If
|
||||||
|
|
||||||
' ========== FIX 9: DocumentViewer cleanup ==========
|
|
||||||
Try
|
Try
|
||||||
If Not IsNothing(DocumentViewer1) AndAlso Not DocumentViewer1.IsDisposed Then
|
If Not IsNothing(DocumentViewer1) AndAlso Not DocumentViewer1.IsDisposed Then
|
||||||
DocumentViewer1.CloseDocument()
|
DocumentViewer1.CloseDocument()
|
||||||
@@ -844,14 +878,13 @@ Public Class frmValidator
|
|||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
MyValidationLogger.Warn($"⚠️ Unexpected error in DocumentViewerValidator.Done: {ex.Message}")
|
MyValidationLogger.Warn($"⚠️ Unexpected error in DocumentViewerValidator.Done: {ex.Message}")
|
||||||
End Try
|
End Try
|
||||||
' ========== ENDE FIX 9 ==========
|
|
||||||
|
|
||||||
If LOG_HOTSPOTS Then
|
If LOG_HOTSPOTS Then
|
||||||
MyValidationLogger.Info($"[PERF frmValidation_FormClosing] nach DocumentViewer.Done: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
|
MyValidationLogger.Info($"[PERF frmValidation_FormClosing] nach DocumentViewer.Done: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
|
||||||
perfLastCheck = DateTime.Now
|
perfLastCheck = DateTime.Now
|
||||||
End If
|
End If
|
||||||
|
|
||||||
' ========== FIX 10: ValidatorSearch cleanup ==========
|
|
||||||
Try
|
Try
|
||||||
If _frmValidatorSearch IsNot Nothing AndAlso Not _frmValidatorSearch.IsDisposed Then
|
If _frmValidatorSearch IsNot Nothing AndAlso Not _frmValidatorSearch.IsDisposed Then
|
||||||
_frmValidatorSearch.Close()
|
_frmValidatorSearch.Close()
|
||||||
@@ -859,7 +892,7 @@ Public Class frmValidator
|
|||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
MyValidationLogger.Error(ex)
|
MyValidationLogger.Error(ex)
|
||||||
End Try
|
End Try
|
||||||
' ========== ENDE FIX 10 ==========
|
|
||||||
|
|
||||||
If LOG_HOTSPOTS Then
|
If LOG_HOTSPOTS Then
|
||||||
MyValidationLogger.Info($"[PERF frmValidation_FormClosing] nach ValidatorSearch.Close: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
|
MyValidationLogger.Info($"[PERF frmValidation_FormClosing] nach ValidatorSearch.Close: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
|
||||||
@@ -869,6 +902,11 @@ Public Class frmValidator
|
|||||||
If LOG_HOTSPOTS Then
|
If LOG_HOTSPOTS Then
|
||||||
MyValidationLogger.Info($"[PERF frmValidation_FormClosing] GESAMT: {(DateTime.Now - perfStart).TotalMilliseconds}ms")
|
MyValidationLogger.Info($"[PERF frmValidation_FormClosing] GESAMT: {(DateTime.Now - perfStart).TotalMilliseconds}ms")
|
||||||
End If
|
End If
|
||||||
|
' Cleanup DocumentPathHandler
|
||||||
|
If _documentPathHandler IsNot Nothing Then
|
||||||
|
_documentPathHandler.Cleanup()
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
Finally
|
Finally
|
||||||
' WICHTIG: Guard wird NICHT zurückgesetzt, da die Form nun wirklich schließt.
|
' WICHTIG: Guard wird NICHT zurückgesetzt, da die Form nun wirklich schließt.
|
||||||
@@ -880,7 +918,52 @@ Public Class frmValidator
|
|||||||
If Not IsNothing(DT_AdditionalSearches_Resultset_Docs) Then
|
If Not IsNothing(DT_AdditionalSearches_Resultset_Docs) Then
|
||||||
DT_AdditionalSearches_Resultset_Docs.Clear()
|
DT_AdditionalSearches_Resultset_Docs.Clear()
|
||||||
End If
|
End If
|
||||||
|
End Sub
|
||||||
|
Private Sub CleanupTempFolder()
|
||||||
|
Try
|
||||||
|
If String.IsNullOrEmpty(TEMP_DOCUMENT_FOLDER) Then
|
||||||
|
MyValidationLogger.Debug("TEMP_DOCUMENT_FOLDER ist nicht gesetzt → Kein Cleanup erforderlich")
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Not System.IO.Directory.Exists(TEMP_DOCUMENT_FOLDER) Then
|
||||||
|
MyValidationLogger.Debug($"Temp-Ordner [{TEMP_DOCUMENT_FOLDER}] existiert nicht → Kein Cleanup erforderlich")
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Alle Dateien im Ordner ermitteln
|
||||||
|
Dim files As String() = System.IO.Directory.GetFiles(TEMP_DOCUMENT_FOLDER)
|
||||||
|
|
||||||
|
If files.Length = 0 Then
|
||||||
|
MyValidationLogger.Debug($"Temp-Ordner [{TEMP_DOCUMENT_FOLDER}] ist bereits leer")
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Alle Dateien löschen
|
||||||
|
Dim deletedCount As Integer = 0
|
||||||
|
Dim errorCount As Integer = 0
|
||||||
|
|
||||||
|
For Each filePath As String In files
|
||||||
|
Try
|
||||||
|
System.IO.File.Delete(filePath)
|
||||||
|
deletedCount += 1
|
||||||
|
MyValidationLogger.Debug($"Datei gelöscht: [{System.IO.Path.GetFileName(filePath)}]")
|
||||||
|
Catch fileEx As Exception
|
||||||
|
errorCount += 1
|
||||||
|
MyValidationLogger.Warn($"⚠️ Datei konnte nicht gelöscht werden: [{System.IO.Path.GetFileName(filePath)}] - {fileEx.Message}")
|
||||||
|
End Try
|
||||||
|
Next
|
||||||
|
|
||||||
|
If errorCount = 0 Then
|
||||||
|
MyValidationLogger.Debug($"✓ Temp-Ordner bereinigt: {deletedCount} Datei(en) gelöscht")
|
||||||
|
Else
|
||||||
|
MyValidationLogger.Warn($"⚠️ Temp-Ordner teilweise bereinigt: {deletedCount} gelöscht, {errorCount} Fehler")
|
||||||
|
End If
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
MyValidationLogger.Error($"❌ Fehler beim Bereinigen des Temp-Ordners: {ex.Message}")
|
||||||
|
MyValidationLogger.Error(ex)
|
||||||
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Function Test_Additional_Data_Searches_Exist() As Boolean
|
Public Function Test_Additional_Data_Searches_Exist() As Boolean
|
||||||
@@ -1054,9 +1137,11 @@ Public Class frmValidator
|
|||||||
Continue For
|
Continue For
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If IsDBNull(row.Item("CONNECTION_ID")) Then
|
Dim oConnectionId As Integer = 1
|
||||||
MyValidationLogger.Info($"No CONNECTION_ID for SQL-Data - oGUID: {oGUID}")
|
If Not IsDBNull(row.Item("CONNECTION_ID")) Then
|
||||||
Continue For
|
oConnectionId = row.Item("CONNECTION_ID")
|
||||||
|
Else
|
||||||
|
MyValidationLogger.Warn($"CONNECTION_ID ist NULL für Control [{name}]. Verwende Default-Wert 1.")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If IsDBNull(row.Item("SQL_UEBERPRUEFUNG")) Then
|
If IsDBNull(row.Item("SQL_UEBERPRUEFUNG")) Then
|
||||||
@@ -1064,7 +1149,6 @@ Public Class frmValidator
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
Dim oSQLStatement As String = row.Item("SQL_UEBERPRUEFUNG")
|
Dim oSQLStatement As String = row.Item("SQL_UEBERPRUEFUNG")
|
||||||
Dim oConnectionId As Integer = row.Item("CONNECTION_ID")
|
|
||||||
|
|
||||||
If String.IsNullOrWhiteSpace(oSQLStatement) Then
|
If String.IsNullOrWhiteSpace(oSQLStatement) Then
|
||||||
Continue For
|
Continue For
|
||||||
@@ -1351,12 +1435,13 @@ Public Class frmValidator
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
MyValidationLogger.Debug("In add_ComboBox - GUID: " & oControlID)
|
MyValidationLogger.Debug("In add_ComboBox - GUID: " & oControlID)
|
||||||
Dim oCONID As Integer
|
Dim oCONID = 1
|
||||||
Try
|
If IsDBNull(oControlRow.Item("CONNECTION_ID")) Then
|
||||||
oCONID = PreventNulletc(oControlRow.Item("CONNECTION_ID"), "Integer")
|
MyValidationLogger.Warn($"⚠️ CONNECTION_ID is NULL for Control [{oControlInfo}]. Using default value 1.")
|
||||||
Catch ex As Exception
|
Else
|
||||||
oCONID = 0
|
oCONID = oControlRow.Item("CONNECTION_ID")
|
||||||
End Try
|
End If
|
||||||
|
|
||||||
|
|
||||||
If oCONID >= 0 Then
|
If oCONID >= 0 Then
|
||||||
Dim oCommandSQL_UBPF
|
Dim oCommandSQL_UBPF
|
||||||
@@ -1746,7 +1831,12 @@ Public Class frmValidator
|
|||||||
Try
|
Try
|
||||||
Dim oControlName = oRow.Item("NAME").ToString
|
Dim oControlName = oRow.Item("NAME").ToString
|
||||||
Dim oSqlStatement = oRow.Item("SQL_UEBERPRUEFUNG")
|
Dim oSqlStatement = oRow.Item("SQL_UEBERPRUEFUNG")
|
||||||
Dim oConnectionId = oRow.Item("CONNECTION_ID")
|
Dim oConnectionId = 1
|
||||||
|
If Not IsDBNull(oRow.Item("CONNECTION_ID")) Then
|
||||||
|
oConnectionId = oRow.Item("CONNECTION_ID")
|
||||||
|
Else
|
||||||
|
MyValidationLogger.Warn($"⚠️ CONNECTION_ID is DBNull for control {oControlName} - Defaulting to 1")
|
||||||
|
End If
|
||||||
|
|
||||||
If Not IsDBNull(oSqlStatement) And Not IsDBNull(oConnectionId) Then
|
If Not IsDBNull(oSqlStatement) And Not IsDBNull(oConnectionId) Then
|
||||||
oSqlStatement = clsPatterns.ReplaceAllValues(oSqlStatement, PanelValidatorControl, True)
|
oSqlStatement = clsPatterns.ReplaceAllValues(oSqlStatement, PanelValidatorControl, True)
|
||||||
@@ -1949,12 +2039,18 @@ Public Class frmValidator
|
|||||||
For Each ROW As DataRow In DTFilteredRows.Rows
|
For Each ROW As DataRow In DTFilteredRows.Rows
|
||||||
Try
|
Try
|
||||||
Dim displayboxname = ROW.Item("NAME").ToString
|
Dim displayboxname = ROW.Item("NAME").ToString
|
||||||
If Not IsDBNull(ROW.Item("CONNECTION_ID")) And Not IsDBNull(ROW.Item("SQL_UEBERPRUEFUNG")) Then
|
Dim oConnectionID = 1
|
||||||
|
If Not IsDBNull(ROW.Item("CONNECTION_ID")) Then
|
||||||
|
oConnectionID = ROW.Item("CONNECTION_ID")
|
||||||
|
Else
|
||||||
|
MyValidationLogger.Warn($"⚠️ CONNECTION_ID is DBNull for control {displayboxname} - Defaulting to 1")
|
||||||
|
End If
|
||||||
|
If Not IsDBNull(ROW.Item("SQL_UEBERPRUEFUNG")) Then
|
||||||
Dim sql_Statement = ROW.Item("SQL_UEBERPRUEFUNG")
|
Dim sql_Statement = ROW.Item("SQL_UEBERPRUEFUNG")
|
||||||
Dim cellvalue = dgv.Rows(dgv.Rows.Count - 2).Cells(0).Value.ToString()
|
Dim cellvalue = dgv.Rows(dgv.Rows.Count - 2).Cells(0).Value.ToString()
|
||||||
sql_Statement = sql_Statement.ToString.Replace(dgv.Name, cellvalue)
|
sql_Statement = sql_Statement.ToString.Replace(dgv.Name, cellvalue)
|
||||||
|
|
||||||
Dim resultDT As DataTable = GetCachedDatatable(sql_Statement, ROW.Item("CONNECTION_ID"))
|
Dim resultDT As DataTable = GetCachedDatatable(sql_Statement, oConnectionID)
|
||||||
|
|
||||||
If resultDT.Rows.Count >= 1 Then
|
If resultDT.Rows.Count >= 1 Then
|
||||||
For Each row1 As DataRow In resultDT.Rows
|
For Each row1 As DataRow In resultDT.Rows
|
||||||
@@ -1970,6 +2066,8 @@ Public Class frmValidator
|
|||||||
Else
|
Else
|
||||||
PanelValidatorControl.Controls(displayboxname).Text = "NO RESULT"
|
PanelValidatorControl.Controls(displayboxname).Text = "NO RESULT"
|
||||||
End If
|
End If
|
||||||
|
Else
|
||||||
|
MyValidationLogger.Warn($"⚠️ SQL_UEBERPRUEFUNG is DBNull for control {displayboxname} - Cannot execute validation query")
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
MyValidationLogger.Error(ex)
|
MyValidationLogger.Error(ex)
|
||||||
@@ -2376,11 +2474,18 @@ Public Class frmValidator
|
|||||||
Dim oControlname2Set = oRow.Item("NAME")
|
Dim oControlname2Set = oRow.Item("NAME")
|
||||||
MyValidationLogger.Debug($"[SetControlValues_FromControl] Working on SetControlValue for {oControlname2Set} ...")
|
MyValidationLogger.Debug($"[SetControlValues_FromControl] Working on SetControlValue for {oControlname2Set} ...")
|
||||||
|
|
||||||
Dim oConnectionId = oRow.ItemEx("CONNECTION_ID", 0)
|
Dim oConnectionId = 1
|
||||||
|
|
||||||
|
If Not IsDBNull(oRow.Item("CONNECTION_ID")) Then
|
||||||
|
oConnectionId = oRow.Item("CONNECTION_ID")
|
||||||
|
Else
|
||||||
|
MyValidationLogger.Warn($"⚠️ CONNECTION_ID is DBNull for control {oControlName} - Defaulting to 1")
|
||||||
|
End If
|
||||||
|
|
||||||
Dim oControlDataSql = oRow.ItemEx("SET_CONTROL_DATA", String.Empty)
|
Dim oControlDataSql = oRow.ItemEx("SET_CONTROL_DATA", String.Empty)
|
||||||
|
|
||||||
If oConnectionId = -1 Or oControlDataSql = String.Empty Then
|
If oControlDataSql = String.Empty Then
|
||||||
MyValidationLogger.Debug("[SetControlValues_FromControl] Error: Check CONN ID and SQL on NULL VALUES!")
|
MyValidationLogger.Warn($"⚠️ [SetControlValues_FromControl] SET_CONTROL_DATA is empty for control [{oControlName}].")
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -2741,9 +2846,14 @@ Public Class frmValidator
|
|||||||
MyValidationLogger.Info($"..but _dependingControl_in_action = True ==> Exit Sub!")
|
MyValidationLogger.Info($"..but _dependingControl_in_action = True ==> Exit Sub!")
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
Dim oConnectionId = 1
|
||||||
If IsDBNull(oRowDependingControl.Item("CONNECTION_ID")) OrElse IsDBNull(oRowDependingControl.Item("SQL_UEBERPRUEFUNG")) Then
|
If Not IsDBNull(oRowDependingControl.Item("CONNECTION_ID")) Then
|
||||||
MyValidationLogger.Debug($"Error: Check CoNN ID and SQL on NULL VALUES!")
|
oConnectionId = oRowDependingControl.Item("CONNECTION_ID")
|
||||||
|
Else
|
||||||
|
MyValidationLogger.Warn($"⚠️ CONNECTION_ID is DBNULL for Control [{oDEPENDING_CtrlName}] (GUID: {oDEPENDING_GUID}) - using default connection ID 1")
|
||||||
|
End If
|
||||||
|
If IsDBNull(oRowDependingControl.Item("SQL_UEBERPRUEFUNG")) Then
|
||||||
|
MyValidationLogger.Warn($"⚠️ SQL_UEBERPRUEFUNG is DBNull for control {oDEPENDING_CtrlName}..")
|
||||||
Continue For
|
Continue For
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -2751,7 +2861,7 @@ Public Class frmValidator
|
|||||||
oSqlCommand = clsPatterns.ReplaceAllValues(oSqlCommand, PanelValidatorControl, True)
|
oSqlCommand = clsPatterns.ReplaceAllValues(oSqlCommand, PanelValidatorControl, True)
|
||||||
_DependingControl_In_Action = True
|
_DependingControl_In_Action = True
|
||||||
|
|
||||||
Dim oDTDEPENDING_RESULT As DataTable = GetCachedDatatable(oSqlCommand, oRowDependingControl.Item("CONNECTION_ID"))
|
Dim oDTDEPENDING_RESULT As DataTable = GetCachedDatatable(oSqlCommand, oConnectionId)
|
||||||
|
|
||||||
If oDTDEPENDING_RESULT Is Nothing Then
|
If oDTDEPENDING_RESULT Is Nothing Then
|
||||||
MyValidationLogger.Warn($"⚠️ Datatable for Depending Controls was nothing! Check the SQL [{oSqlCommand}]")
|
MyValidationLogger.Warn($"⚠️ Datatable for Depending Controls was nothing! Check the SQL [{oSqlCommand}]")
|
||||||
@@ -2860,15 +2970,20 @@ Public Class frmValidator
|
|||||||
MyValidationLogger.Debug($"..but _dependingControl_in_action = True ==> Exit Sub!")
|
MyValidationLogger.Debug($"..but _dependingControl_in_action = True ==> Exit Sub!")
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
If Not IsDBNull(oRowDependingControl.Item("CONNECTION_ID")) And Not IsDBNull(oRowDependingControl.Item("SQL_UEBERPRUEFUNG")) Then
|
Dim oConnectionId = 1
|
||||||
|
If Not IsDBNull(oRowDependingControl.Item("CONNECTION_ID")) Then
|
||||||
|
oConnectionId = oRowDependingControl.Item("CONNECTION_ID")
|
||||||
|
Else
|
||||||
|
MyValidationLogger.Warn($"⚠️ CONNECTION_ID is DBNULL for Control [{oDEPENDING_CtrlName}] (GUID: {oDEPENDING_GUID}) - using default connection ID 1")
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Not IsDBNull(oRowDependingControl.Item("SQL_UEBERPRUEFUNG")) Then
|
||||||
Dim oSqlCommand = IIf(IsDBNull(oRowDependingControl.Item("SQL_UEBERPRUEFUNG")), "", oRowDependingControl.Item("SQL_UEBERPRUEFUNG"))
|
Dim oSqlCommand = IIf(IsDBNull(oRowDependingControl.Item("SQL_UEBERPRUEFUNG")), "", oRowDependingControl.Item("SQL_UEBERPRUEFUNG"))
|
||||||
oSqlCommand = clsPatterns.ReplaceAllValues(oSqlCommand, PanelValidatorControl, True)
|
oSqlCommand = clsPatterns.ReplaceAllValues(oSqlCommand, PanelValidatorControl, True)
|
||||||
_DependingControl_In_Action = True
|
_DependingControl_In_Action = True
|
||||||
MyValidationLogger.Debug($"_DependingControl_In_Action: Control {oDEPENDING_CtrlName} ...")
|
MyValidationLogger.Debug($"_DependingControl_In_Action: Control {oDEPENDING_CtrlName} ...")
|
||||||
'Dim oDTDEPENDING_RESULT As DataTable = DatabaseFallback.GetDatatable(New GetDatatableOptions(oSqlCommand, DatabaseType.ECM) With {
|
|
||||||
' .ConnectionId = oRowDependingControl.Item("CONNECTION_ID")
|
Dim oDTDEPENDING_RESULT As DataTable = GetCachedDatatable(oSqlCommand, oConnectionId)
|
||||||
'})
|
|
||||||
Dim oDTDEPENDING_RESULT As DataTable = GetCachedDatatable(oSqlCommand, oRowDependingControl.Item("CONNECTION_ID"))
|
|
||||||
Try
|
Try
|
||||||
Dim oFound As Boolean = False
|
Dim oFound As Boolean = False
|
||||||
'Dim oDependingLookup As LookupControl3 = pnldesigner.Controls.Find(oDEPENDING_CtrlName, False).FirstOrDefault()
|
'Dim oDependingLookup As LookupControl3 = pnldesigner.Controls.Find(oDEPENDING_CtrlName, False).FirstOrDefault()
|
||||||
@@ -2950,7 +3065,7 @@ Public Class frmValidator
|
|||||||
End Try
|
End Try
|
||||||
|
|
||||||
Else
|
Else
|
||||||
MyValidationLogger.Debug($"Error: Check CoNN ID and SQL on NULL VALUES!")
|
MyValidationLogger.Warn($"⚠️ SQL_UEBERPRUEFUNG is DBNull for control {oDEPENDING_CtrlName}..")
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
End Sub
|
End Sub
|
||||||
@@ -2973,7 +3088,12 @@ Public Class frmValidator
|
|||||||
If oSQLColumnDatatable.Rows.Count > 0 Then
|
If oSQLColumnDatatable.Rows.Count > 0 Then
|
||||||
For Each oRow As DataRow In oSQLColumnDatatable.Rows
|
For Each oRow As DataRow In oSQLColumnDatatable.Rows
|
||||||
Dim oDEPENDING_CONTROL_ID = oRow.Item("CONTROL_ID")
|
Dim oDEPENDING_CONTROL_ID = oRow.Item("CONTROL_ID")
|
||||||
Dim oCONNID = oRow.Item("CONNECTION_ID")
|
Dim oCONNID = 1
|
||||||
|
If Not IsDBNull(oRow.Item("CONNECTION_ID")) Then
|
||||||
|
oCONNID = oRow.Item("CONNECTION_ID")
|
||||||
|
Else
|
||||||
|
MyValidationLogger.Warn($"⚠️ CONNECTION_ID is DBNULL for CONTROL_ID [{oDEPENDING_CONTROL_ID}] - using default connection ID 1")
|
||||||
|
End If
|
||||||
Dim oDEPENDING_COLUMN = oRow.Item("SPALTENNAME")
|
Dim oDEPENDING_COLUMN = oRow.Item("SPALTENNAME")
|
||||||
Dim oSqlCommand = oRow.Item("SQL_COMMAND")
|
Dim oSqlCommand = oRow.Item("SQL_COMMAND")
|
||||||
Dim oAdvancedLookup = oRow.Item("ADVANCED_LOOKUP")
|
Dim oAdvancedLookup = oRow.Item("ADVANCED_LOOKUP")
|
||||||
@@ -3015,7 +3135,12 @@ Public Class frmValidator
|
|||||||
If oSQLColumnDatatable.Rows.Count > 0 Then
|
If oSQLColumnDatatable.Rows.Count > 0 Then
|
||||||
For Each oRow As DataRow In oSQLColumnDatatable.Rows
|
For Each oRow As DataRow In oSQLColumnDatatable.Rows
|
||||||
Dim oDEPENDING_CONTROL_ID = oRow.Item("CONTROL_ID")
|
Dim oDEPENDING_CONTROL_ID = oRow.Item("CONTROL_ID")
|
||||||
Dim oCONNID = oRow.Item("CONNECTION_ID")
|
Dim oCONNID = 1
|
||||||
|
If Not IsDBNull(oRow.Item("CONNECTION_ID")) Then
|
||||||
|
oCONNID = oRow.Item("CONNECTION_ID")
|
||||||
|
Else
|
||||||
|
MyValidationLogger.Warn($"⚠️ CONNECTION_ID is DBNULL for CONTROL_ID [{oDEPENDING_CONTROL_ID}] - using default connection ID 1")
|
||||||
|
End If
|
||||||
Dim oDEPENDING_COLUMN = oRow.Item("SPALTENNAME")
|
Dim oDEPENDING_COLUMN = oRow.Item("SPALTENNAME")
|
||||||
Dim oSqlCommand = oRow.Item("SQL_COMMAND")
|
Dim oSqlCommand = oRow.Item("SQL_COMMAND")
|
||||||
Dim oAdvancedLookup = oRow.Item("ADVANCED_LOOKUP")
|
Dim oAdvancedLookup = oRow.Item("ADVANCED_LOOKUP")
|
||||||
@@ -3084,7 +3209,13 @@ Public Class frmValidator
|
|||||||
Try
|
Try
|
||||||
Dim displayboxname = ROW.Item(0).ToString
|
Dim displayboxname = ROW.Item(0).ToString
|
||||||
_Step = 1
|
_Step = 1
|
||||||
If Not IsDBNull(ROW.Item("CONNECTION_ID")) And Not IsDBNull(ROW.Item("SQL_UEBERPRUEFUNG")) Then
|
Dim oConnectionId = 1
|
||||||
|
If Not IsDBNull(ROW.Item("CONNECTION_ID")) Then
|
||||||
|
oConnectionId = ROW.Item("CONNECTION_ID")
|
||||||
|
Else
|
||||||
|
MyValidationLogger.Warn($"⚠️ CONNECTION_ID is DBNULL for control [{displayboxname}] - using default connection ID 1")
|
||||||
|
End If
|
||||||
|
If Not IsDBNull(ROW.Item("SQL_UEBERPRUEFUNG")) Then
|
||||||
_Step = 2
|
_Step = 2
|
||||||
Dim sql_Statement = IIf(IsDBNull(ROW.Item("SQL_UEBERPRUEFUNG")), "", ROW.Item("SQL_UEBERPRUEFUNG"))
|
Dim sql_Statement = IIf(IsDBNull(ROW.Item("SQL_UEBERPRUEFUNG")), "", ROW.Item("SQL_UEBERPRUEFUNG"))
|
||||||
|
|
||||||
@@ -3096,6 +3227,8 @@ Public Class frmValidator
|
|||||||
Depending_Control_Set_Result(displayboxname, sql_Statement, ROW.Item(1))
|
Depending_Control_Set_Result(displayboxname, sql_Statement, ROW.Item(1))
|
||||||
_Step = 5
|
_Step = 5
|
||||||
_DependingControl_In_Action = False
|
_DependingControl_In_Action = False
|
||||||
|
Else
|
||||||
|
MyValidationLogger.Warn($"⚠️ SQL_UEBERPRUEFUNG is DBNull for control [{displayboxname}]..")
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
MyValidationLogger.Error(ex)
|
MyValidationLogger.Error(ex)
|
||||||
@@ -3171,11 +3304,11 @@ Public Class frmValidator
|
|||||||
|
|
||||||
Dim oENABLE_GUID As Integer = CInt(oRowEnablingControl.Item("GUID"))
|
Dim oENABLE_GUID As Integer = CInt(oRowEnablingControl.Item("GUID"))
|
||||||
Dim oENABLE_CtrlName = oRowEnablingControl.Item("NAME")
|
Dim oENABLE_CtrlName = oRowEnablingControl.Item("NAME")
|
||||||
Dim oConnectionId As Integer = oRowEnablingControl.ItemEx("CONNECTION_ID", 0)
|
Dim oConnectionId As Integer = oRowEnablingControl.ItemEx("CONNECTION_ID", 1)
|
||||||
Dim oSqlCommand As String = oRowEnablingControl.ItemEx("SQL_ENABLE", String.Empty)
|
Dim oSqlCommand As String = oRowEnablingControl.ItemEx("SQL_ENABLE", String.Empty)
|
||||||
|
|
||||||
If String.IsNullOrEmpty(oSqlCommand) Then
|
If String.IsNullOrEmpty(oSqlCommand) Then
|
||||||
MyValidationLogger.Debug($"[SKIP] Control [{oENABLE_CtrlName}]: Ungültige CONNECTION_ID oder SQL_ENABLE")
|
MyValidationLogger.Debug($"[SKIP] Control [{oENABLE_CtrlName}]: Ungültiges SQL_ENABLE")
|
||||||
Continue For
|
Continue For
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -3285,7 +3418,7 @@ Public Class frmValidator
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
MyValidationLogger.Debug($"Found Control [{oENABLE_CtrlName}] (ID: {oENABLE_GUID}) on panel which needs to be checked")
|
MyValidationLogger.Debug($"Found Control [{oENABLE_CtrlName}] (ID: {oENABLE_GUID}) on panel which needs to be checked")
|
||||||
Dim oConnectionId As Integer = oRowEnablingControl.ItemEx("CONNECTION_ID", 0)
|
Dim oConnectionId As Integer = oRowEnablingControl.ItemEx("CONNECTION_ID", 1)
|
||||||
Dim oSqlCommand = oRowEnablingControl.ItemEx("SQL_ENABLE_ON_LOAD", String.Empty)
|
Dim oSqlCommand = oRowEnablingControl.ItemEx("SQL_ENABLE_ON_LOAD", String.Empty)
|
||||||
|
|
||||||
If String.IsNullOrWhiteSpace(oSqlCommand) Then
|
If String.IsNullOrWhiteSpace(oSqlCommand) Then
|
||||||
@@ -3538,7 +3671,13 @@ Public Class frmValidator
|
|||||||
Return True
|
Return True
|
||||||
End If
|
End If
|
||||||
If check.ToString.Length > 0 And Not {"@@DISPLAY_ONLY", "DD PM-ONLY FOR DISPLAY"}.Contains(dr.Item("INDEX_NAME")) Then
|
If check.ToString.Length > 0 And Not {"@@DISPLAY_ONLY", "DD PM-ONLY FOR DISPLAY"}.Contains(dr.Item("INDEX_NAME")) Then
|
||||||
Dim cs As String = DatabaseFallback.GetConnectionString(dr.Item("CONNECTION_ID"))
|
Dim oConnectionId = 1
|
||||||
|
If Not IsDBNull(dr.Item("CONNECTION_ID")) Then
|
||||||
|
oConnectionId = dr.Item("CONNECTION_ID")
|
||||||
|
Else
|
||||||
|
MyValidationLogger.Warn($"⚠️ CONNECTION_ID is DBNULL for control [{control.Name}] - using default connection ID 1")
|
||||||
|
End If
|
||||||
|
Dim cs As String = DatabaseFallback.GetConnectionString(oConnectionId)
|
||||||
|
|
||||||
If allgFunk.CheckValue_Exists(dr.Item("SQL_UEBERPRUEFUNG"), "@Eingabe", control.Text, dr.Item("TYP"), cs, CURRENT_ProfilGUID) = True Then
|
If allgFunk.CheckValue_Exists(dr.Item("SQL_UEBERPRUEFUNG"), "@Eingabe", control.Text, dr.Item("TYP"), cs, CURRENT_ProfilGUID) = True Then
|
||||||
Return True
|
Return True
|
||||||
@@ -3652,9 +3791,9 @@ Public Class frmValidator
|
|||||||
|
|
||||||
If WM_AHWF_docPath <> String.Empty Then
|
If WM_AHWF_docPath <> String.Empty Then
|
||||||
oWMOwnPath = WM_AHWF_docPath
|
oWMOwnPath = WM_AHWF_docPath
|
||||||
WMDocPathWindows = oWMOwnPath
|
DocPathWindows = oWMOwnPath
|
||||||
Else
|
Else
|
||||||
oWMOwnPath = WMDocPathWindows.Replace(WMSUFFIX, "")
|
oWMOwnPath = DocPathWindows.Replace(WMSUFFIX, "")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Try
|
Try
|
||||||
@@ -3702,7 +3841,7 @@ Public Class frmValidator
|
|||||||
Return True
|
Return True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim oResult As String
|
Dim oFilePath_from_DB As String
|
||||||
|
|
||||||
WMDocPathWindows = String.Empty
|
WMDocPathWindows = String.Empty
|
||||||
If OPERATION_MODE_FS <> ClassConstants.OpModeFS_ZF Then
|
If OPERATION_MODE_FS <> ClassConstants.OpModeFS_ZF Then
|
||||||
@@ -3714,34 +3853,58 @@ Public Class frmValidator
|
|||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim path0 = ObjectEx.NotNull(oDT.Rows(0).Item("PATH0"), String.Empty).ToString
|
Dim oPath0 = ObjectEx.NotNull(oDT.Rows(0).Item("PATH0"), String.Empty).ToString
|
||||||
Dim path1 = ObjectEx.NotNull(oDT.Rows(0).Item("PATH1"), String.Empty).ToString
|
Dim oPath1 = ObjectEx.NotNull(oDT.Rows(0).Item("PATH1"), String.Empty).ToString
|
||||||
|
|
||||||
MyValidationLogger.Debug($"First Checking file [{path0}] exists?...")
|
MyValidationLogger.Debug($"First Checking file [{oPath0}] exists?...")
|
||||||
|
|
||||||
If path0 <> String.Empty AndAlso File.Exists(path0) Then
|
If oPath0 <> String.Empty AndAlso File.Exists(oPath0) Then
|
||||||
oResult = path0
|
oFilePath_from_DB = oPath0
|
||||||
Else
|
Else
|
||||||
MyValidationLogger.Info($"Getting filepath with standard 1 ...")
|
MyValidationLogger.Info($"Getting filepath with standard 1 ...")
|
||||||
MyValidationLogger.Debug($"Second Checking file [{path1}] exists?...")
|
MyValidationLogger.Debug($"Second Checking file [{oPath1}] exists?...")
|
||||||
If path1 <> String.Empty AndAlso File.Exists(path1) Then
|
If oPath1 <> String.Empty AndAlso File.Exists(oPath1) Then
|
||||||
oResult = path1
|
oFilePath_from_DB = oPath1
|
||||||
Else
|
Else
|
||||||
MyValidationLogger.Info($"Second FileExists also returned false [{path1}]!")
|
MyValidationLogger.Info($"Second FileExists also returned false [{oPath1}]!")
|
||||||
DocPathWindows = path1
|
DocPathWindows = oPath1
|
||||||
MyValidationLogger.Warn($"⚠️ GetDocPathWindows: File [{path1}] not existing!")
|
MyValidationLogger.Warn($"⚠️ GetDocPathWindows: File [{oPath1}] not existing!")
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
DocPathWindows = oResult
|
|
||||||
Else
|
Else
|
||||||
oResult = ClassConstants.OpModeFS_ZF
|
oFilePath_from_DB = ClassConstants.OpModeFS_ZF
|
||||||
MyValidationLogger.Debug($"GetDocPathWindows: Filestore is {ClassConstants.OpModeFS_ZF}")
|
MyValidationLogger.Debug($"GetDocPathWindows: Filestore is {ClassConstants.OpModeFS_ZF}")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
WMDocPathWindows = oResult
|
If COPY_WMFILE_2TEMP = True Then
|
||||||
CURRENT_DOC_PATH = WMDocPathWindows
|
' Optionen konfigurieren
|
||||||
|
Dim options As New ClassDocumentPathHandler.DocumentPathOptions With {
|
||||||
|
.EnableMapping = True,
|
||||||
|
.WMSuffix = WMSUFFIX,
|
||||||
|
.SpecificDrive = If(Len(MAP_SHARE_DRIVE) = 1, MAP_SHARE_DRIVE, ""),
|
||||||
|
.DriveBlacklist = MAP_BLACKLIST,
|
||||||
|
.CopyToTemp = True,
|
||||||
|
.TempFolder = TEMP_DOCUMENT_FOLDER,
|
||||||
|
.UnmapAfterCopy = True
|
||||||
|
}
|
||||||
|
|
||||||
|
' Verarbeiten
|
||||||
|
Dim result = _documentPathHandler.ProcessDocumentPath(oFilePath_from_DB, options)
|
||||||
|
|
||||||
|
If result.Success Then
|
||||||
|
DocPathWindows = result.FinalPath
|
||||||
|
WMDocPathWindows = oFilePath_from_DB
|
||||||
|
MyValidationLogger.Info($"✓ Dokument verarbeitet: [{Path.GetFileName(result.FinalPath)}]")
|
||||||
|
Else
|
||||||
|
MyValidationLogger.Error($"❌ Fehler: {result.ErrorMessage}")
|
||||||
|
DocPathWindows = oFilePath_from_DB
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
DocPathWindows = oFilePath_from_DB
|
||||||
|
MyValidationLogger.Info($"📄 Verwende Originalpfad: [{oFilePath_from_DB}]")
|
||||||
|
End If
|
||||||
MyValidationLogger.Info($"GetWMDocPathWindows CURRENT_DOC_PATH: {CURRENT_DOC_PATH}")
|
MyValidationLogger.Info($"GetWMDocPathWindows CURRENT_DOC_PATH: {CURRENT_DOC_PATH}")
|
||||||
Return True
|
Return True
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
@@ -3754,6 +3917,24 @@ Public Class frmValidator
|
|||||||
|
|
||||||
|
|
||||||
End Function
|
End Function
|
||||||
|
Private Sub CleanupCurrentTempFile()
|
||||||
|
Try
|
||||||
|
' Prüfen ob DocPathWindows eine Temp-Datei ist
|
||||||
|
If COPY_WMFILE_2TEMP = True AndAlso
|
||||||
|
Not String.IsNullOrEmpty(DocPathWindows) AndAlso
|
||||||
|
Not String.IsNullOrEmpty(TEMP_DOCUMENT_FOLDER) AndAlso
|
||||||
|
DocPathWindows.StartsWith(TEMP_DOCUMENT_FOLDER, StringComparison.OrdinalIgnoreCase) Then
|
||||||
|
|
||||||
|
If System.IO.File.Exists(DocPathWindows) Then
|
||||||
|
System.IO.File.Delete(DocPathWindows)
|
||||||
|
MyValidationLogger.Debug($"🗑️ Temp-Datei gelöscht: [{System.IO.Path.GetFileName(DocPathWindows)}]")
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
MyValidationLogger.Warn($"⚠️ Temp-Datei konnte nicht gelöscht werden: {ex.Message}")
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
Sub Load_IDB_DOC_DATA()
|
Sub Load_IDB_DOC_DATA()
|
||||||
Try
|
Try
|
||||||
Dim oSQl As String = IDB_DOC_DATA_SQL
|
Dim oSQl As String = IDB_DOC_DATA_SQL
|
||||||
@@ -3801,7 +3982,10 @@ Public Class frmValidator
|
|||||||
OverrideAll = False
|
OverrideAll = False
|
||||||
_Indexe_Loaded = False
|
_Indexe_Loaded = False
|
||||||
MyValidationLogger.Debug("In Load_Next_Document")
|
MyValidationLogger.Debug("In Load_Next_Document")
|
||||||
|
' Alte Temp-Datei aufräumen (falls vorhanden)
|
||||||
|
If Not first Then
|
||||||
|
CleanupCurrentTempFile()
|
||||||
|
End If
|
||||||
Dim layoutSuspended As Boolean = False
|
Dim layoutSuspended As Boolean = False
|
||||||
Try
|
Try
|
||||||
If first = True Then
|
If first = True Then
|
||||||
@@ -3903,7 +4087,7 @@ Public Class frmValidator
|
|||||||
|
|
||||||
|
|
||||||
If oErrMsgMissingInput = "" Then
|
If oErrMsgMissingInput = "" Then
|
||||||
If WMDocPathWindows <> String.Empty Or OPERATION_MODE_FS = ClassConstants.OpModeFS_ZF Then
|
If DocPathWindows <> String.Empty Or OPERATION_MODE_FS = ClassConstants.OpModeFS_ZF Then
|
||||||
LoadDocument_DDViewer()
|
LoadDocument_DDViewer()
|
||||||
If Current_Document.Extension <> "pdf" Then
|
If Current_Document.Extension <> "pdf" Then
|
||||||
bbtniAnnotation.Visibility = BarItemVisibility.Never
|
bbtniAnnotation.Visibility = BarItemVisibility.Never
|
||||||
@@ -4316,7 +4500,7 @@ Public Class frmValidator
|
|||||||
Try
|
Try
|
||||||
Dim oDocument As DocumentResultList.Document = Nothing
|
Dim oDocument As DocumentResultList.Document = Nothing
|
||||||
' Load DocumentInfo
|
' Load DocumentInfo
|
||||||
oDocument = DD_Documentloader.Load(CURRENT_DOC_ID, WMDocPathWindows)
|
oDocument = DD_Documentloader.Load(CURRENT_DOC_ID, DocPathWindows)
|
||||||
If oDocument Is Nothing Then
|
If oDocument Is Nothing Then
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
@@ -4685,7 +4869,11 @@ Public Class frmValidator
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
Sub FillIndexValues(first As Boolean, Optional SingleAttribute As String = "")
|
Sub FillIndexValues(first As Boolean, Optional SingleAttribute As String = "")
|
||||||
' ========== PERFORMANCE-LOGGING ==========
|
If _SetControlValue_In_Action AndAlso Not String.IsNullOrWhiteSpace(SingleAttribute) Then
|
||||||
|
MyValidationLogger.Debug("FillIndexValues", $"Übersprungen: SetControlValue läuft für [{SingleAttribute}]")
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
Dim perfStart As DateTime = DateTime.MinValue
|
Dim perfStart As DateTime = DateTime.MinValue
|
||||||
Dim perfLastCheck As DateTime = DateTime.MinValue
|
Dim perfLastCheck As DateTime = DateTime.MinValue
|
||||||
If LOG_HOTSPOTS Then
|
If LOG_HOTSPOTS Then
|
||||||
@@ -5513,7 +5701,12 @@ Public Class frmValidator
|
|||||||
Dim oDEPENDING_CTRL_ID = CInt(oRow.Item("CONTROL_ID"))
|
Dim oDEPENDING_CTRL_ID = CInt(oRow.Item("CONTROL_ID"))
|
||||||
Dim oDEPENDING_COLUMN = oRow.Item("SPALTENNAME")
|
Dim oDEPENDING_COLUMN = oRow.Item("SPALTENNAME")
|
||||||
Dim oSqlCommand = oRow.Item("SQL_COMMAND")
|
Dim oSqlCommand = oRow.Item("SQL_COMMAND")
|
||||||
Dim oCONNID = oRow.Item("CONNECTION_ID")
|
Dim oCONNID = 1
|
||||||
|
If Not IsNullOrEmpty(oRow.Item("CONN_ID")) Then
|
||||||
|
oCONNID = CInt(oRow.Item("CONN_ID"))
|
||||||
|
Else
|
||||||
|
MyValidationLogger.Warn($"⚠️ CONN_ID is null or empty for CONTROL_ID {oDEPENDING_CTRL_ID} - defaulting to 1")
|
||||||
|
End If
|
||||||
Dim oAdvancedLookup = oRow.Item("ADVANCED_LOOKUP")
|
Dim oAdvancedLookup = oRow.Item("ADVANCED_LOOKUP")
|
||||||
oSqlCommand = clsPatterns.ReplaceAllValues(oSqlCommand, PanelValidatorControl, True)
|
oSqlCommand = clsPatterns.ReplaceAllValues(oSqlCommand, PanelValidatorControl, True)
|
||||||
|
|
||||||
@@ -5746,13 +5939,13 @@ Public Class frmValidator
|
|||||||
Else
|
Else
|
||||||
RibbonPageGroupCustom.Visible = False
|
RibbonPageGroupCustom.Visible = False
|
||||||
End If
|
End If
|
||||||
If Not (IsNothing(WMDocPathWindows) And ActiveWorkflowType = ConstAHWorkflow_BlindFile) Then
|
If Not (IsNothing(DocPathWindows) And ActiveWorkflowType = ConstAHWorkflow_BlindFile) Then
|
||||||
If ButtonExport2Folder_Caption <> "" And WMDocPathWindows <> "" Then
|
If ButtonExport2Folder_Caption <> "" And DocPathWindows <> "" Then
|
||||||
MyValidationLogger.Debug("Enabling Export2File, Caption set")
|
MyValidationLogger.Debug("Enabling Export2File, Caption set")
|
||||||
MyValidationLogger.Debug("Button Caption: [{0}]", ButtonExport2Folder_Caption)
|
MyValidationLogger.Debug("Button Caption: [{0}]", ButtonExport2Folder_Caption)
|
||||||
MyValidationLogger.Debug("Export root folder: [{0}]", ButtonExport2Folder_RootFolder)
|
MyValidationLogger.Debug("Export root folder: [{0}]", ButtonExport2Folder_RootFolder)
|
||||||
|
|
||||||
If File.Exists(WMDocPathWindows) Then
|
If File.Exists(DocPathWindows) Then
|
||||||
MyValidationLogger.Debug("File exists, Showing Export Button")
|
MyValidationLogger.Debug("File exists, Showing Export Button")
|
||||||
|
|
||||||
barbtnitmExport.Caption = ButtonExport2Folder_Caption
|
barbtnitmExport.Caption = ButtonExport2Folder_Caption
|
||||||
@@ -6056,7 +6249,12 @@ Public Class frmValidator
|
|||||||
MyValidationLogger.Debug("Indexing wih dynamic sql...")
|
MyValidationLogger.Debug("Indexing wih dynamic sql...")
|
||||||
Dim oGUID = oFinalIndexRow.Item("GUID")
|
Dim oGUID = oFinalIndexRow.Item("GUID")
|
||||||
Dim oSQLCommand = oFinalIndexRow.Item("SQL_COMMAND")
|
Dim oSQLCommand = oFinalIndexRow.Item("SQL_COMMAND")
|
||||||
Dim oConnectionID = oFinalIndexRow.Item("CONNECTION_ID")
|
Dim oConnectionID = 1
|
||||||
|
If Not IsNullOrEmpty(oFinalIndexRow.Item("CONN_ID")) Then
|
||||||
|
oConnectionID = CInt(oFinalIndexRow.Item("CONN_ID"))
|
||||||
|
Else
|
||||||
|
MyValidationLogger.Warn($"⚠️ CONN_ID is null or empty for final indexing of index {oFinalIndex} - defaulting to 1")
|
||||||
|
End If
|
||||||
oSQLCommand = clsPatterns.ReplaceAllValues(oSQLCommand, PanelValidatorControl, True)
|
oSQLCommand = clsPatterns.ReplaceAllValues(oSQLCommand, PanelValidatorControl, True)
|
||||||
If IsNothing(oSQLCommand) Then
|
If IsNothing(oSQLCommand) Then
|
||||||
errormessage = "Error while replacing Values in final indexing - Check the log"
|
errormessage = "Error while replacing Values in final indexing - Check the log"
|
||||||
@@ -6305,7 +6503,7 @@ Public Class frmValidator
|
|||||||
If Not IsNothing(DT_ENTRY) Then
|
If Not IsNothing(DT_ENTRY) Then
|
||||||
If DT_ENTRY.Rows.Count = 1 Then
|
If DT_ENTRY.Rows.Count = 1 Then
|
||||||
Dim AnnotationString = DT_ENTRY.Rows(0).Item("WORKED_WHEN") & " " & DT_ENTRY.Rows(0).Item("WORKED_BY") & ": " & DT_ENTRY.Rows(0).Item("STATUS_COMMENT")
|
Dim AnnotationString = DT_ENTRY.Rows(0).Item("WORKED_WHEN") & " " & DT_ENTRY.Rows(0).Item("WORKED_BY") & ": " & DT_ENTRY.Rows(0).Item("STATUS_COMMENT")
|
||||||
ClassAnnotation.Annotate_PDF("Workflow-State:", AnnotationString, 0, False)
|
'ClassAnnotation.Annotate_PDF("Workflow-State:", AnnotationString, 0, False)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@@ -6319,7 +6517,7 @@ Public Class frmValidator
|
|||||||
For Each rw As DataRow In DT_ENTRIES.Rows
|
For Each rw As DataRow In DT_ENTRIES.Rows
|
||||||
AnnotationString = AnnotationString & rw.Item("WORKED_WHEN") & " " & rw.Item("WORKED_BY") & ": " & rw.Item("STATUS_COMMENT") & vbcrlf
|
AnnotationString = AnnotationString & rw.Item("WORKED_WHEN") & " " & rw.Item("WORKED_BY") & ": " & rw.Item("STATUS_COMMENT") & vbcrlf
|
||||||
Next
|
Next
|
||||||
ClassAnnotation.Annotate_PDF("Workflow History:", AnnotationString, 0, False, 10, 40)
|
'ClassAnnotation.Annotate_PDF("Workflow History:", AnnotationString, 0, False, 10, 40)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@@ -6333,7 +6531,7 @@ Public Class frmValidator
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
If Move2Folder <> "" And (OPERATION_MODE_FS = ClassConstants.OpModeFS_PWM Or OPERATION_MODE_FS = ClassConstants.OpModeFS_IDBWM) Then
|
If Move2Folder <> "" And (OPERATION_MODE_FS = ClassConstants.OpModeFS_PWM Or OPERATION_MODE_FS = ClassConstants.OpModeFS_IDBWM) Then
|
||||||
idxerr_message = allgFunk.Move2Folder(WMDocPathWindows, Move2Folder, CURRENT_ProfilGUID, WINDREAM_ALLG)
|
idxerr_message = allgFunk.Move2Folder(DocPathWindows, Move2Folder, CURRENT_ProfilGUID, WINDREAM_ALLG)
|
||||||
If idxerr_message <> "" Then
|
If idxerr_message <> "" Then
|
||||||
errormessage = "Fehler bei Move2Folder:" & vbcrlf & idxerr_message
|
errormessage = "Fehler bei Move2Folder:" & vbcrlf & idxerr_message
|
||||||
My.Settings.Save()
|
My.Settings.Save()
|
||||||
@@ -7751,7 +7949,7 @@ Public Class frmValidator
|
|||||||
MyValidationLogger.Debug("Skipping document....(Datei_ueberspringen)")
|
MyValidationLogger.Debug("Skipping document....(Datei_ueberspringen)")
|
||||||
Dim oPRoc = String.Format("EXEC PRTF_PROFILE_FILES_WORK {0},{1},{2},{3}", CURRENT_DOC_ID, CURRENT_ProfilGUID, USER_ID, "FreeFile")
|
Dim oPRoc = String.Format("EXEC PRTF_PROFILE_FILES_WORK {0},{1},{2},{3}", CURRENT_DOC_ID, CURRENT_ProfilGUID, USER_ID, "FreeFile")
|
||||||
Dim oSQL = oPRoc & vbCrLf &
|
Dim oSQL = oPRoc & vbCrLf &
|
||||||
$"EXECUTE PRPM_FILES_NOT_INDEXED '{USER_USERNAME}',{CURRENT_ProfilGUID},'{WMDocPathWindows}',{CURRENT_DOC_GUID};"
|
$"EXECUTE PRPM_FILES_NOT_INDEXED '{USER_USERNAME}',{CURRENT_ProfilGUID},'{DocPathWindows}',{CURRENT_DOC_GUID};"
|
||||||
If LOG_HOTSPOTS Then
|
If LOG_HOTSPOTS Then
|
||||||
' ========== DIAGNOSE: Vor DB-Execute ==========
|
' ========== DIAGNOSE: Vor DB-Execute ==========
|
||||||
MyValidationLogger.Info($"[INFO] Führe DB-UPDATE aus...")
|
MyValidationLogger.Info($"[INFO] Führe DB-UPDATE aus...")
|
||||||
@@ -7870,11 +8068,11 @@ Public Class frmValidator
|
|||||||
Catch exul As Exception
|
Catch exul As Exception
|
||||||
MyValidationLogger.Warn($"⚠️ Could not unlock WMFile - ERROR: [{exul.Message}] - now teh system.io.Delete...")
|
MyValidationLogger.Warn($"⚠️ Could not unlock WMFile - ERROR: [{exul.Message}] - now teh system.io.Delete...")
|
||||||
End Try
|
End Try
|
||||||
|
File.Delete(WMDocPathWindows)
|
||||||
|
MyValidationLogger.Info("Deleting of file via system.io [" & WMDocPathWindows & "] successfull!")
|
||||||
WMDocPathWindows = ""
|
WMDocPathWindows = ""
|
||||||
CURRENT_DOC_PATH = ""
|
CURRENT_DOC_PATH = ""
|
||||||
CURRENT_WMFILE = Nothing
|
CURRENT_WMFILE = Nothing
|
||||||
File.Delete(WMDocPathWindows)
|
|
||||||
MyValidationLogger.Info("Deleting of file via system.io [" & WMDocPathWindows & "] successfull!")
|
|
||||||
Return True
|
Return True
|
||||||
Catch ex1 As Exception
|
Catch ex1 As Exception
|
||||||
MyValidationLogger.Warn($"⚠️ Could not delete via System.IO - ERROR: [{ex1.Message}] {vbcrlf} Trying system.io...")
|
MyValidationLogger.Warn($"⚠️ Could not delete via System.IO - ERROR: [{ex1.Message}] {vbcrlf} Trying system.io...")
|
||||||
@@ -7922,7 +8120,7 @@ Public Class frmValidator
|
|||||||
Public hProcess As IntPtr
|
Public hProcess As IntPtr
|
||||||
End Structure
|
End Structure
|
||||||
Private Sub frmValidation_ResizeEnd(sender As Object, e As EventArgs) Handles Me.ResizeEnd
|
Private Sub frmValidation_ResizeEnd(sender As Object, e As EventArgs) Handles Me.ResizeEnd
|
||||||
If WMDocPathWindows Is Nothing = False Then
|
If DocPathWindows Is Nothing = False Then
|
||||||
My.Settings.frmValidatorSize = Me.Size
|
My.Settings.frmValidatorSize = Me.Size
|
||||||
My.Settings.Save()
|
My.Settings.Save()
|
||||||
End If
|
End If
|
||||||
@@ -8008,18 +8206,18 @@ Public Class frmValidator
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub BarButtonItem4_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItem4.ItemClick
|
Private Sub BarButtonItem4_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItem4.ItemClick
|
||||||
If WMDocPathWindows <> "" Then
|
If DocPathWindows <> "" Then
|
||||||
Try
|
Try
|
||||||
Cursor = Cursors.WaitCursor
|
Cursor = Cursors.WaitCursor
|
||||||
Dim oShellExecuteInfo As New SHELLEXECUTEINFO
|
Dim oShellExecuteInfo As New SHELLEXECUTEINFO
|
||||||
oShellExecuteInfo.cbSize = Marshal.SizeOf(oShellExecuteInfo)
|
oShellExecuteInfo.cbSize = Marshal.SizeOf(oShellExecuteInfo)
|
||||||
oShellExecuteInfo.lpVerb = "properties"
|
oShellExecuteInfo.lpVerb = "properties"
|
||||||
oShellExecuteInfo.lpFile = WMDocPathWindows
|
oShellExecuteInfo.lpFile = DocPathWindows
|
||||||
oShellExecuteInfo.nShow = SW_SHOW
|
oShellExecuteInfo.nShow = SW_SHOW
|
||||||
oShellExecuteInfo.fMask = SEE_MASK_INVOKEIDLIST
|
oShellExecuteInfo.fMask = SEE_MASK_INVOKEIDLIST
|
||||||
If Not ShellExecuteEx(oShellExecuteInfo) Then
|
If Not ShellExecuteEx(oShellExecuteInfo) Then
|
||||||
Dim ex As New System.ComponentModel.Win32Exception(System.Runtime.InteropServices.Marshal.GetLastWin32Error())
|
Dim ex As New System.ComponentModel.Win32Exception(System.Runtime.InteropServices.Marshal.GetLastWin32Error())
|
||||||
MsgBox("error in Datei-Eigenschaften öffnen:" & vbcrlf & ex.Message, MsgBoxStyle.Critical)
|
MsgBox("error in Datei-Eigenschaften öffnen:" & vbCrLf & ex.Message, MsgBoxStyle.Critical)
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
End Try
|
End Try
|
||||||
@@ -8222,7 +8420,7 @@ Public Class frmValidator
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub barbtnitmExport_ItemClick(sender As Object, e As ItemClickEventArgs) Handles barbtnitmExport.ItemClick
|
Private Sub barbtnitmExport_ItemClick(sender As Object, e As ItemClickEventArgs) Handles barbtnitmExport.ItemClick
|
||||||
If File.Exists(WMDocPathWindows) = False Then
|
If File.Exists(DocPathWindows) = False Then
|
||||||
MsgBox("Workflow-Document seems not to exist. Check Your log.", MsgBoxStyle.Exclamation, ADDITIONAL_TITLE)
|
MsgBox("Workflow-Document seems not to exist. Check Your log.", MsgBoxStyle.Exclamation, ADDITIONAL_TITLE)
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
@@ -8239,8 +8437,8 @@ Public Class frmValidator
|
|||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
oFilenameOnly = Path.GetFileName(WMDocPathWindows)
|
oFilenameOnly = Path.GetFileName(DocPathWindows)
|
||||||
oExtension = Path.GetExtension(WMDocPathWindows)
|
oExtension = Path.GetExtension(DocPathWindows)
|
||||||
oSQLGetFilename = $"DECLARE @Filename Varchar(512) " & vbcrlf &
|
oSQLGetFilename = $"DECLARE @Filename Varchar(512) " & vbcrlf &
|
||||||
$"EXEC dbo.PRPM_GETFILENAME_EXPORT {CURRENT_DOC_ID}, 1, @Outputfilename = @Filename OUTPUT;" & vbcrlf &
|
$"EXEC dbo.PRPM_GETFILENAME_EXPORT {CURRENT_DOC_ID}, 1, @Outputfilename = @Filename OUTPUT;" & vbcrlf &
|
||||||
"SELECT @Filename"
|
"SELECT @Filename"
|
||||||
@@ -8260,28 +8458,28 @@ Public Class frmValidator
|
|||||||
Dim oTempFullFilename = oTempPath + "\" + oExportFilename & oExtension
|
Dim oTempFullFilename = oTempPath + "\" + oExportFilename & oExtension
|
||||||
|
|
||||||
Dim oConverter As New PDFConverter(LOGCONFIG)
|
Dim oConverter As New PDFConverter(LOGCONFIG)
|
||||||
If oConverter.ConvertPDFADocumentToPDFDocument(WMDocPathWindows, oTempFullFilename) = False Then
|
If oConverter.ConvertPDFADocumentToPDFDocument(DocPathWindows, oTempFullFilename) = False Then
|
||||||
MyValidationLogger.Warn("⚠️ File [{0}] could not be converted to plain PDF!", WMDocPathWindows)
|
MyValidationLogger.Warn("⚠️ File [{0}] could not be converted to plain PDF!", DocPathWindows)
|
||||||
oFile2Export = WMDocPathWindows
|
oFile2Export = DocPathWindows
|
||||||
Else
|
Else
|
||||||
MyValidationLogger.Info("File [{0}] successfully converted to plain PDF!", oTempFullFilename)
|
MyValidationLogger.Info("File [{0}] successfully converted to plain PDF!", oTempFullFilename)
|
||||||
MyValidationLogger.Info("File [{0}] successfully converted to plain PDF!", WMDocPathWindows)
|
MyValidationLogger.Info("File [{0}] successfully converted to plain PDF!", DocPathWindows)
|
||||||
oFile2Export = oTempFullFilename
|
oFile2Export = oTempFullFilename
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
MyValidationLogger.Warn("⚠️ No converting as File [{0}] not ending with pdf [{1}]", WMDocPathWindows, oExtension.ToLower)
|
MyValidationLogger.Warn("⚠️ No converting as File [{0}] not ending with pdf [{1}]", DocPathWindows, oExtension.ToLower)
|
||||||
oFile2Export = WMDocPathWindows
|
oFile2Export = DocPathWindows
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
MyValidationLogger.Warn("⚠️ No converting as barbtnitmExport.Tag.ToString <> Convert to PDF")
|
MyValidationLogger.Warn("⚠️ No converting as barbtnitmExport.Tag.ToString <> Convert to PDF")
|
||||||
oFile2Export = WMDocPathWindows
|
oFile2Export = DocPathWindows
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
oFile2Export = WMDocPathWindows
|
oFile2Export = DocPathWindows
|
||||||
End If
|
End If
|
||||||
MyValidationLogger.Info("Final export path is: [{0}]", oFile2Export)
|
MyValidationLogger.Info("Final export path is: [{0}]", oFile2Export)
|
||||||
File.Copy(oFile2Export, oTargetPath)
|
File.Copy(oFile2Export, oTargetPath)
|
||||||
MyValidationLogger.Info($"File {WMDocPathWindows} exported successfully!")
|
MyValidationLogger.Info($"File {oFile2Export} exported successfully!")
|
||||||
oCount += 1
|
oCount += 1
|
||||||
Else
|
Else
|
||||||
MsgBox("Error encountered while extracting Export-Filename!" & vbcrlf & "Please inform Admin-Team!", MsgBoxStyle.Critical, ADDITIONAL_TITLE)
|
MsgBox("Error encountered while extracting Export-Filename!" & vbcrlf & "Please inform Admin-Team!", MsgBoxStyle.Critical, ADDITIONAL_TITLE)
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ Public Class frmValidatorSearch
|
|||||||
Private Documentloader As Loader
|
Private Documentloader As Loader
|
||||||
Private Property OperationMode As OperationMode
|
Private Property OperationMode As OperationMode
|
||||||
Private ReadOnly Environment As Environment
|
Private ReadOnly Environment As Environment
|
||||||
|
Private _documentPathHandler As ClassDocumentPathHandler
|
||||||
|
|
||||||
Public Sub New(pfrmValidator As frmValidator, pEnvironment As Environment)
|
Public Sub New(pfrmValidator As frmValidator, pEnvironment As Environment)
|
||||||
|
|
||||||
@@ -463,7 +464,8 @@ Public Class frmValidatorSearch
|
|||||||
If My.Settings.frmValSearchSplitterDistance > 20 Then
|
If My.Settings.frmValSearchSplitterDistance > 20 Then
|
||||||
SplitContainerSearches.SplitterDistance = My.Settings.frmValSearchSplitterDistance
|
SplitContainerSearches.SplitterDistance = My.Settings.frmValSearchSplitterDistance
|
||||||
End If
|
End If
|
||||||
|
' DocumentPathHandler initialisieren
|
||||||
|
_documentPathHandler = New ClassDocumentPathHandler(LOGGER)
|
||||||
|
|
||||||
ToolStripDropDownButtonFile.Visible = False
|
ToolStripDropDownButtonFile.Visible = False
|
||||||
End Sub
|
End Sub
|
||||||
@@ -589,20 +591,33 @@ Public Class frmValidatorSearch
|
|||||||
|
|
||||||
If Not IsNothing(DocumentViewer1) Then
|
If Not IsNothing(DocumentViewer1) Then
|
||||||
Dim oFileName = $"{clsWMDocGrid.SELECTED_DOC_ID}.{oDocument.Extension}"
|
Dim oFileName = $"{clsWMDocGrid.SELECTED_DOC_ID}.{oDocument.Extension}"
|
||||||
If Not IsNothing(oDocument.Contents) Then
|
If Not IsNothing(DocumentViewer1) AndAlso Not IsNothing(oDocument.Contents) Then
|
||||||
DocumentViewer1.LoadFile_FromPath(clsWMDocGrid.SELECTED_DOC_PATH) ',oFileName, New MemoryStream(oDocument.Contents))
|
' Optionen konfigurieren
|
||||||
|
Dim options As New ClassDocumentPathHandler.DocumentPathOptions With {
|
||||||
|
.EnableMapping = False,
|
||||||
|
.CopyToTemp = COPY_WMFILE_2TEMP,
|
||||||
|
.TempFolder = TEMP_DOCUMENT_FOLDER,
|
||||||
|
.UnmapAfterCopy = False
|
||||||
|
}
|
||||||
|
|
||||||
|
' Verarbeiten
|
||||||
|
Dim result = _documentPathHandler.ProcessDocumentPath(clsWMDocGrid.SELECTED_DOC_PATH, options)
|
||||||
|
|
||||||
|
If result.Success Then
|
||||||
|
DocumentViewer1.LoadFile_FromPath(result.FinalPath)
|
||||||
LastDocID = clsWMDocGrid.SELECTED_DOC_ID
|
LastDocID = clsWMDocGrid.SELECTED_DOC_ID
|
||||||
DocumentViewer1.RightViewOnly(USER_RIGHT_VIEW_ONLY)
|
DocumentViewer1.RightViewOnly(USER_RIGHT_VIEW_ONLY)
|
||||||
If USER_RIGHT_VIEW_ONLY = True Then
|
LOGGER.Info($"✓ [ValidatorSearch] Dokument geladen: [{Path.GetFileName(result.FinalPath)}]")
|
||||||
ToolStripDropDownButtonFile.Visible = False
|
|
||||||
Else
|
Else
|
||||||
ToolStripDropDownButtonFile.Visible = True
|
LOGGER.Error($"❌ [ValidatorSearch] {result.ErrorMessage}")
|
||||||
|
statlbl.Text = $"Fehler: {result.ErrorMessage}"
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
statlbl.Text = "odocument.content is nothing, Check Your log"
|
statlbl.Text = "odocument.content is nothing, Check Your log"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Else
|
Else
|
||||||
|
|||||||
1364
app/TaskFlow/logtaskflow.txt
Normal file
1364
app/TaskFlow/logtaskflow.txt
Normal file
File diff suppressed because it is too large
Load Diff
@@ -462,6 +462,7 @@
|
|||||||
<Compile Include="ClassConfig.vb" />
|
<Compile Include="ClassConfig.vb" />
|
||||||
<Compile Include="ClassConstants.vb" />
|
<Compile Include="ClassConstants.vb" />
|
||||||
<Compile Include="ClassControlCreator.vb" />
|
<Compile Include="ClassControlCreator.vb" />
|
||||||
|
<Compile Include="ClassDocumentPathHandler.vb" />
|
||||||
<Compile Include="ClassDragDrop.vb" />
|
<Compile Include="ClassDragDrop.vb" />
|
||||||
<Compile Include="ClassFinalIndex.vb" />
|
<Compile Include="ClassFinalIndex.vb" />
|
||||||
<Compile Include="ClassFinalizeDoc.vb" />
|
<Compile Include="ClassFinalizeDoc.vb" />
|
||||||
@@ -1256,6 +1257,7 @@
|
|||||||
<None Include="Resources\PM_mit_slogan.JPG" />
|
<None Include="Resources\PM_mit_slogan.JPG" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Content Include="logtaskflow.txt" />
|
||||||
<Content Include="taskFLOW-TEST-Debug.txt" />
|
<Content Include="taskFLOW-TEST-Debug.txt" />
|
||||||
<None Include="Changelog.md" />
|
<None Include="Changelog.md" />
|
||||||
<Content Include="DataColumnExpression.txt" />
|
<Content Include="DataColumnExpression.txt" />
|
||||||
|
|||||||
Reference in New Issue
Block a user