MS
This commit is contained in:
@@ -4,13 +4,17 @@ Imports DD_LIB_Standards
|
||||
Public Class ClassHelper
|
||||
Public Shared Function FORMAT_WM_PATH(WMpath As String)
|
||||
Try
|
||||
Dim ochanged As Boolean = False
|
||||
If WMpath.StartsWith("W:") Then
|
||||
WMpath = WMpath.Replace("W:", "\\windream\Objects")
|
||||
ochanged = True
|
||||
ElseIf WMpath.StartsWith("\") Then
|
||||
If WMpath.StartsWith("\\windream\Objects") = False Then
|
||||
WMpath = "\\windream\Objects" & WMpath
|
||||
ochanged = True
|
||||
End If
|
||||
End If
|
||||
If LogErrorsOnly = False And ochanged = True Then ClassLogger.Add(" >> WMpath is: " & WMpath, False)
|
||||
Return WMpath
|
||||
Catch ex As Exception
|
||||
Return WMpath
|
||||
@@ -154,7 +158,7 @@ Public Class ClassHelper
|
||||
Public Shared Sub File_open(RESULT_DOC_PATH As Object, DocID As String)
|
||||
Try
|
||||
RESULT_DOC_PATH = FORMAT_WM_PATH(RESULT_DOC_PATH)
|
||||
|
||||
CURRENT_OFFICE_FILE_CHANGED = False
|
||||
If RESULT_DOC_PATH <> Nothing Then
|
||||
If USER_GENERAL_VIEWER = "NONE" Then
|
||||
Dim EXT = Path.GetExtension(RESULT_DOC_PATH)
|
||||
@@ -216,19 +220,54 @@ Public Class ClassHelper
|
||||
Private Shared Sub File_SYSOPEN(RESULT_DOC_PATH As Object, DocID As String)
|
||||
Try
|
||||
If RESULT_DOC_PATH <> Nothing Then
|
||||
If System.IO.File.Exists(RESULT_DOC_PATH) = True Then
|
||||
Process.Start(RESULT_DOC_PATH)
|
||||
Else
|
||||
If clsWD_GET.WDFile_exists(RESULT_DOC_PATH, clsDatabase.DB_PROXY_INITIALIZED, ClassProxy.MyLinkedServer, True) = False Then
|
||||
MSGBOX_Handler("ERROR", "File not found (1):", "File '" & RESULT_DOC_PATH & "' not existing or Windream-Malfunction...." & vbNewLine &
|
||||
" - Maybe You are not provided with reading rights?!" & vbNewLine &
|
||||
" - Check Your windream-drive: is W accessible? Can You navigate to the filepath?" & vbNewLine & "Please inform Your admin!")
|
||||
Else
|
||||
MSGBOX_Handler("ERROR", "File not found (2):", "File '" & RESULT_DOC_PATH & "' exists in windream BUT is not accessible!" & vbNewLine &
|
||||
" - Maybe You are not provided with reading rights?!" & vbNewLine &
|
||||
" - Check Your windream-drive: is W accessible? Can You navigate to the filepath?" & vbNewLine & "Please inform Your admin!")
|
||||
Try
|
||||
Dim oMyProcess = New Process()
|
||||
Try
|
||||
Dim oPSI As New ProcessStartInfo(RESULT_DOC_PATH)
|
||||
|
||||
oMyProcess.StartInfo.FileName = RESULT_DOC_PATH
|
||||
oMyProcess.StartInfo.UseShellExecute = True
|
||||
oMyProcess.StartInfo.RedirectStandardOutput = False
|
||||
oMyProcess.Start()
|
||||
oMyProcess.WaitForExit()
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add("Error in Process1.Start(): " & ex.Message & vbNewLine & " - Path: " & RESULT_DOC_PATH & " - DocID: " & DocID, True)
|
||||
Exit Sub
|
||||
End Try
|
||||
|
||||
|
||||
|
||||
Dim oExtension = Path.GetExtension(RESULT_DOC_PATH).ToLower
|
||||
If LogErrorsOnly = False Then ClassLogger.Add($"Checking oExtension [{oExtension}]...", False)
|
||||
If FILE_FORMATS_CHANGE_DURING_EDIT.Contains(oExtension) Then
|
||||
Dim osql = $"SELECT Count(DocID) FROM VWPMO_DOC_SYNC WHERE DocID = {DocID}"
|
||||
Dim oFileExists = clsDatabase.Execute_Scalar(osql, False)
|
||||
If oFileExists = 0 Then
|
||||
CURRENT_OFFICE_FILE_CHANGED = True
|
||||
ClassLogger.Add("The docId of handled file changed during editing mode!- OldDocID: " & DocID, False)
|
||||
osql = $"SELECT dwDocID FROM windream60.dbo.BaseAttributes WHERE dwVersionID = {DocID}"
|
||||
Dim oNEW_DOC As DataTable = clsDatabase.Return_Datatable(osql, False)
|
||||
If oNEW_DOC.Rows.Count = 1 Then
|
||||
Dim oNEWDocID = oNEW_DOC.Rows(0).Item(0)
|
||||
ClassLogger.Add($"New DocID is {oNEWDocID}!!", False)
|
||||
osql = $"EXEC PRPMO_DOC_CHANGE_DOCID {DocID},{oNEWDocID},'{USER_USERNAME}'"
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(osql, False)
|
||||
If clsDatabase.Execute_non_Query(osql, False) = False Then
|
||||
ClassLogger.Add($"Could not relink the DocID!!", False)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add("Error in Process.Start(): " & ex.Message & vbNewLine & " - Path: " & RESULT_DOC_PATH & " - DocID: " & DocID, True)
|
||||
Try
|
||||
Process.Start(RESULT_DOC_PATH)
|
||||
Catch ex1 As Exception
|
||||
ClassLogger.Add("Error in Process.Start(1): " & ex1.Message & vbNewLine & " - Path: " & RESULT_DOC_PATH & " - DocID: " & DocID, True)
|
||||
End Try
|
||||
|
||||
End Try
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox("Unexpected Error in File_SYSOPEN:" & vbNewLine & ex.Message & vbNewLine & RESULT_DOC_PATH & vbNewLine & "DocID: " & DocID, MsgBoxStyle.Critical)
|
||||
@@ -239,14 +278,12 @@ Public Class ClassHelper
|
||||
Private Shared Sub FOLDER_OPEN(PATH As Object, DocID As String)
|
||||
Try
|
||||
If PATH <> Nothing Then
|
||||
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> in FOLDER_OPEN(" & PATH & ")", False)
|
||||
If System.IO.Directory.Exists(PATH) = True Then
|
||||
Process.Start(PATH)
|
||||
Else
|
||||
MsgBox("Folder '" & PATH & "' not existing or accessible!", MsgBoxStyle.Exclamation)
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox("Unexpected Error in FOLDER_OPEN:" & vbNewLine & ex.Message & vbNewLine & PATH & vbNewLine & "DocID: " & DocID, MsgBoxStyle.Critical)
|
||||
|
||||
Reference in New Issue
Block a user