Changes
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
Imports System.IO
|
||||
Imports System.Globalization
|
||||
Imports DD_LIB_Standards
|
||||
Imports System.ComponentModel
|
||||
|
||||
Public Class ClassHelper
|
||||
Private Shared BW_DocPath As String
|
||||
Private Shared BW_DocID As Integer
|
||||
Public Shared Function FORMAT_WM_PATH(WMpath As String)
|
||||
Try
|
||||
Dim ochanged As Boolean = False
|
||||
@@ -157,6 +161,8 @@ Public Class ClassHelper
|
||||
End Function
|
||||
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
|
||||
@@ -220,56 +226,14 @@ Public Class ClassHelper
|
||||
Private Shared Sub File_SYSOPEN(RESULT_DOC_PATH As Object, DocID As String)
|
||||
Try
|
||||
If RESULT_DOC_PATH <> Nothing Then
|
||||
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
|
||||
BW_DocPath = RESULT_DOC_PATH
|
||||
BW_DocID = DocID
|
||||
|
||||
Dim BWFileHandler As New BackgroundWorker
|
||||
AddHandler BWFileHandler.DoWork, AddressOf BWFileHandler_DoWork
|
||||
BWFileHandler.RunWorkerAsync()
|
||||
|
||||
|
||||
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 {DocID} of handled file changed during editing mode!", False)
|
||||
osql = $"SELECT MAX(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
|
||||
Else
|
||||
ClassLogger.Add($"Could not get the new DOCID [{osql}]!!", False)
|
||||
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)
|
||||
@@ -277,6 +241,44 @@ Public Class ClassHelper
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
Private Shared Sub BWFileHandler_DoWork()
|
||||
Try
|
||||
|
||||
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
|
||||
oExtension = Path.GetExtension(BW_DocPath).ToLower
|
||||
If LogErrorsOnly = False Then ClassLogger.Add($"Checking oExtension [{oExtension}]...", False)
|
||||
If FILE_FORMATS_CHANGE_DURING_EDIT.Contains(oExtension) Then
|
||||
oSql = $"SELECT dwVersionID FROM windream60.dbo.BaseAttributes WHERE dwDocID = {BW_DocID}"
|
||||
Dim odwVersionId = clsDatabase.Execute_Scalar(oSql, False)
|
||||
|
||||
Dim oInsert = $"INSERT INTO TBPMO_DOC_ID_CHANGED (USER_ID,PROCESS_ID,VERSION_ID,OLD_DOC_ID,DOC_PATH) VALUES ({USER_GUID},'{ProcID.ToString}',{odwVersionId},{BW_DocID},'{BW_DocPath}')"
|
||||
clsDatabase.Execute_non_Query(oInsert, False)
|
||||
End If
|
||||
|
||||
'oMyProcess.WaitForExit()
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add("Error in Process1.Start(): " & ex.Message & vbNewLine & " - Path: " & BW_DocPath & " - DocID: " & BW_DocID, True)
|
||||
Exit Sub
|
||||
End Try
|
||||
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add("Error in Process.Start(): " & ex.Message & vbNewLine & " - Path: " & BW_DocPath & " - DocID: " & BW_DocID, True)
|
||||
Try
|
||||
Process.Start(BW_DocPath)
|
||||
Catch ex1 As Exception
|
||||
ClassLogger.Add("Error in Process.Start(1): " & ex1.Message & vbNewLine & " - Path: " & BW_DocPath & " - DocID: " & BW_DocID, True)
|
||||
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