3.4.4.0
This commit is contained in:
@@ -232,22 +232,6 @@ Public Class ClassHelper
|
||||
LOGGER.Warn("Error in Open_Folder: " & ex.Message & vbNewLine & " - Path: " & RESULT_DOC_PATH & " - DocID: " & DocID)
|
||||
End Try
|
||||
End Sub
|
||||
Public Shared Sub OPEN_DOCVIEW(Doc_Path As String, DocID As Integer)
|
||||
Try
|
||||
Dim DocView
|
||||
DocView = Nothing
|
||||
DocView = CreateObject("WMPViewXNG.Viewer")
|
||||
' open the viewer
|
||||
Dim viewer_string = Doc_Path.Substring(2)
|
||||
DocView.ViewFile(viewer_string)
|
||||
CURRENT_DOCVIEW_PATH = viewer_string
|
||||
CURRENT_DOCVIEW = DocView
|
||||
Catch ex As Exception
|
||||
MsgBox("Unexpected Error in DocView Open:" & vbNewLine & ex.Message & vbNewLine & Doc_Path & vbNewLine & "DocID: " & DocID, MsgBoxStyle.Critical)
|
||||
LOGGER.Warn("Error in DocView Open: " & ex.Message & vbNewLine & " - Path: " & Doc_Path & " - DocID: " & DocID)
|
||||
File_SYSOPEN(Doc_Path, DocID, 0)
|
||||
End Try
|
||||
End Sub
|
||||
Private Shared Sub File_SYSOPEN(RESULT_DOC_PATH As Object, DocID As String, pParentID As Integer)
|
||||
Try
|
||||
If RESULT_DOC_PATH <> Nothing Then
|
||||
@@ -270,51 +254,155 @@ Public Class ClassHelper
|
||||
End Sub
|
||||
Private Shared Sub BWFileHandler_DoWork()
|
||||
Try
|
||||
Dim oOverrideRunPath As String = ""
|
||||
Dim oExtension As String = Path.GetExtension(BW_DocPath).ToLower()
|
||||
|
||||
' Prüfen, ob eine spezielle Anwendung für die Dateierweiterung definiert ist
|
||||
For Each oROW As DataRow In CURRENT_TBFILE_EXTENSION_OVERRIDE.Rows
|
||||
If oExtension.Replace(".", "") = oROW.Item("FILE_EXTENSION").ToString().ToLower() Then
|
||||
LOGGER.Debug($"Specific file extension override for [{oExtension}] found.")
|
||||
oOverrideRunPath = oROW.Item("PROCESS").ToString()
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim oMyProcess As Process = Nothing
|
||||
Dim oSql As String = ""
|
||||
|
||||
Dim oMyProcess = New Process()
|
||||
Dim oExtension
|
||||
Dim oSql
|
||||
Try
|
||||
'Dim oPSI As New ProcessStartInfo(BW_DocPath)
|
||||
oMyProcess.StartInfo.FileName = BW_DocPath
|
||||
oMyProcess.StartInfo.UseShellExecute = True
|
||||
oMyProcess.StartInfo.RedirectStandardOutput = False
|
||||
oMyProcess.Start()
|
||||
Dim ProcID = oMyProcess.GetCurrentProcess.Id
|
||||
' ###### Startinfo vorbereiten ######
|
||||
Dim startInfo As New ProcessStartInfo()
|
||||
|
||||
If oOverrideRunPath <> "" Then
|
||||
startInfo.FileName = oOverrideRunPath
|
||||
startInfo.Arguments = $"""{BW_DocPath}"""
|
||||
LOGGER.Debug($"Opening document [{BW_DocPath}] using override application [{oOverrideRunPath}].")
|
||||
Else
|
||||
startInfo.FileName = BW_DocPath
|
||||
LOGGER.Debug($"Opening document [{BW_DocPath}] with system default application.")
|
||||
End If
|
||||
|
||||
startInfo.UseShellExecute = True
|
||||
startInfo.RedirectStandardOutput = False
|
||||
If oOverrideRunPath <> "" Then
|
||||
oMyProcess = Process.Start(startInfo)
|
||||
Else
|
||||
oMyProcess = Process.Start(BW_DocPath)
|
||||
End If
|
||||
' ###### Prozess starten ######
|
||||
|
||||
|
||||
' ID des gestarteten Prozesses holen (nicht den eigenen!)
|
||||
Dim ProcID As Integer = oMyProcess.Id
|
||||
LOGGER.Debug($"Started process ID {ProcID} for document [{BW_DocPath}].")
|
||||
|
||||
' Warten, bis der Benutzer das Dokument geschlossen hat
|
||||
oMyProcess.WaitForExit()
|
||||
oExtension = Path.GetExtension(BW_DocPath).ToLower
|
||||
LOGGER.Debug($"Checking oExtension [{oExtension}]...")
|
||||
|
||||
' Nachbearbeitung, wenn Format bearbeitbar ist
|
||||
oExtension = Path.GetExtension(BW_DocPath).ToLower()
|
||||
LOGGER.Debug($"Checking if file extension [{oExtension}] may change during edit...")
|
||||
|
||||
If FILE_FORMATS_CHANGE_DURING_EDIT.Contains(oExtension) Then
|
||||
oSql = $"SELECT * FROM VWOF_DOCID_HANDLE WHERE dwParentID = {BW_ParentID} and [Filename] = '{BW_Filename}'"
|
||||
oSql = $"SELECT * FROM VWOF_DOCID_HANDLE WHERE dwParentID = {BW_ParentID} AND [Filename] = '{BW_Filename}'"
|
||||
Dim oDTNEWDoc As DataTable = MYDB_ECM.GetDatatable(oSql)
|
||||
|
||||
If Not IsNothing(oDTNEWDoc) Then
|
||||
If oDTNEWDoc.Rows.Count = 1 Then
|
||||
|
||||
Dim oInsert = $"INSERT INTO TBPMO_DOC_ID_CHANGED (USER_ID,PROCESS_ID,VERSION_ID,OLD_DOC_ID,NEW_DOC_ID, DOC_PATH) VALUES (
|
||||
{USER_GUID},'{ProcID.ToString}',{oDTNEWDoc.Rows(0).Item("dwVersionID")},{BW_DocID},{oDTNEWDoc.Rows(0).Item("NewDocID")}, '{BW_DocPath}')"
|
||||
MYDB_ECM.ExecuteNonQuery(oInsert)
|
||||
End If
|
||||
If oDTNEWDoc IsNot Nothing AndAlso oDTNEWDoc.Rows.Count = 1 Then
|
||||
Dim oInsert = $"INSERT INTO TBPMO_DOC_ID_CHANGED (USER_ID,PROCESS_ID,VERSION_ID,OLD_DOC_ID,NEW_DOC_ID,DOC_PATH) VALUES (" &
|
||||
$"{USER_GUID},'{ProcID}',{oDTNEWDoc.Rows(0).Item("dwVersionID")},{BW_DocID},{oDTNEWDoc.Rows(0).Item("NewDocID")},'{BW_DocPath}')"
|
||||
|
||||
|
||||
End If
|
||||
MYDB_ECM.ExecuteNonQuery(oInsert)
|
||||
LOGGER.Debug("Document change recorded in TBPMO_DOC_ID_CHANGED.")
|
||||
Else
|
||||
LOGGER.Debug("No matching document change detected.")
|
||||
End If
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
LOGGER.Warn("Error in Process1.Start(): " & ex.Message & vbNewLine & " - Path: " & BW_DocPath & " - DocID: " & BW_DocID)
|
||||
MsgBox("Error in OpenFile: " & ex.Message & vbNewLine & " - Path: " & BW_DocPath & " - DocID: " & BW_DocID, MsgBoxStyle.Exclamation)
|
||||
Exit Sub
|
||||
' Fehler im Prozessstart oder während des Wartens
|
||||
LOGGER.Warn("Error in Process.Start(): " & ex.Message & vbNewLine & " - Path: " & BW_DocPath & " - DocID: " & BW_DocID)
|
||||
MsgBox("Error in OpenFile: " & ex.Message & vbNewLine &
|
||||
"Path: " & BW_DocPath & vbNewLine & "DocID: " & BW_DocID,
|
||||
MsgBoxStyle.Exclamation, "Open File Error")
|
||||
End Try
|
||||
|
||||
Catch ex As Exception
|
||||
LOGGER.Warn("Error in Process.Start(): " & ex.Message & vbNewLine & " - Path: " & BW_DocPath & " - DocID: " & BW_DocID)
|
||||
' Fehler im gesamten Worker (z. B. Path nicht vorhanden)
|
||||
LOGGER.Warn("General error in BWFileHandler_DoWork: " & ex.Message & vbNewLine &
|
||||
" - Path: " & BW_DocPath & " - DocID: " & BW_DocID)
|
||||
|
||||
' Letzter Versuch: Öffne mit Standardprogramm
|
||||
Try
|
||||
Process.Start(BW_DocPath)
|
||||
LOGGER.Debug("Fallback: Document opened with default application.")
|
||||
Catch ex1 As Exception
|
||||
LOGGER.Warn("Error in Process.Start(1): " & ex1.Message & vbNewLine & " - Path: " & BW_DocPath & " - DocID: " & BW_DocID)
|
||||
LOGGER.Warn("Fallback error in Process.Start(): " & ex1.Message & vbNewLine &
|
||||
" - Path: " & BW_DocPath & " - DocID: " & BW_DocID)
|
||||
End Try
|
||||
End Try
|
||||
End Sub
|
||||
'Private Shared Sub BWFileHandler_DoWork()
|
||||
' Try
|
||||
' Dim oOverrideRunPath As String = ""
|
||||
' Dim oExtension = Path.GetExtension(BW_DocPath).ToLower
|
||||
' For Each oROW As DataRow In CURRENT_TBFILE_EXTENSION_OVERRIDE.Rows
|
||||
' If oExtension.Replace(".", "") = oROW.Item("FILE_EXTENSION") Then
|
||||
' LOGGER.Debug($"Specific fileextension override for extension [{oExtension}] found! ")
|
||||
' oOverrideRunPath = oROW.Item("PROCESS")
|
||||
' End If
|
||||
' Next
|
||||
' Dim oMyProcess = New Process()
|
||||
' Dim oSql
|
||||
' Try
|
||||
' '######
|
||||
' Dim startInfo As New ProcessStartInfo()
|
||||
' If oOverrideRunPath <> "" Then
|
||||
' startInfo.FileName = oOverrideRunPath
|
||||
' startInfo.Arguments = """" & BW_DocPath & """"
|
||||
' startInfo.UseShellExecute = True
|
||||
' startInfo.RedirectStandardOutput = False
|
||||
' Else
|
||||
' startInfo.FileName = BW_DocPath
|
||||
' startInfo.UseShellExecute = True
|
||||
' startInfo.RedirectStandardOutput = False
|
||||
' End If
|
||||
' '#####
|
||||
' oMyProcess.Start(startInfo)
|
||||
' Dim myViewerProcessID = oMyProcess.Id
|
||||
' oMyProcess.WaitForExit()
|
||||
' oExtension = Path.GetExtension(BW_DocPath).ToLower
|
||||
' LOGGER.Debug($"Checking oExtension [{oExtension}]...")
|
||||
' If FILE_FORMATS_CHANGE_DURING_EDIT.Contains(oExtension) Then
|
||||
' oSql = $"SELECT * FROM VWOF_DOCID_HANDLE WHERE dwParentID = {BW_ParentID} and [Filename] = '{BW_Filename}'"
|
||||
' Dim oDTNEWDoc As DataTable = MYDB_ECM.GetDatatable(oSql)
|
||||
|
||||
' If Not IsNothing(oDTNEWDoc) Then
|
||||
' If oDTNEWDoc.Rows.Count = 1 Then
|
||||
|
||||
' Dim oInsert = $"INSERT INTO TBPMO_DOC_ID_CHANGED (USER_ID,PROCESS_ID,VERSION_ID,OLD_DOC_ID,NEW_DOC_ID, DOC_PATH) VALUES (
|
||||
' {USER_GUID},'{myViewerProcessID.ToString}',{oDTNEWDoc.Rows(0).Item("dwVersionID")},{BW_DocID},{oDTNEWDoc.Rows(0).Item("NewDocID")}, '{BW_DocPath}')"
|
||||
' MYDB_ECM.ExecuteNonQuery(oInsert)
|
||||
' End If
|
||||
|
||||
|
||||
' End If
|
||||
' End If
|
||||
|
||||
' Catch ex As Exception
|
||||
' LOGGER.Warn("Error in Process1.Start(): " & ex.Message & vbNewLine & " - Path: " & BW_DocPath & " - DocID: " & BW_DocID)
|
||||
' MsgBox("Error in OpenFile: " & ex.Message & vbNewLine & " - Path: " & BW_DocPath & " - DocID: " & BW_DocID, MsgBoxStyle.Exclamation)
|
||||
' Exit Sub
|
||||
' End Try
|
||||
|
||||
' Catch ex As Exception
|
||||
' LOGGER.Warn("Error in Process.Start(): " & ex.Message & vbNewLine & " - Path: " & BW_DocPath & " - DocID: " & BW_DocID)
|
||||
' Try
|
||||
' Process.Start(BW_DocPath)
|
||||
' Catch ex1 As Exception
|
||||
' LOGGER.Warn("Error in Process.Start(1): " & ex1.Message & vbNewLine & " - Path: " & BW_DocPath & " - DocID: " & BW_DocID)
|
||||
' End Try
|
||||
' End Try
|
||||
'End Sub
|
||||
Private Shared Sub FOLDER_OPEN(PATH As Object, DocID As String)
|
||||
Try
|
||||
If PATH <> Nothing Then
|
||||
|
||||
Reference in New Issue
Block a user