From 4e756f06edb25dfa5ecdb03dbe904854ed96037e Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Tue, 12 Feb 2019 17:46:52 +0100 Subject: [PATCH] fix file skip not working --- app/DD_PM_WINDREAM/ModuleMySettings.vb | 16 ++++++++-- app/DD_PM_WINDREAM/frmValidator.vb | 44 ++++++++++++++++++++------ 2 files changed, 48 insertions(+), 12 deletions(-) diff --git a/app/DD_PM_WINDREAM/ModuleMySettings.vb b/app/DD_PM_WINDREAM/ModuleMySettings.vb index 6ac990d..2aabdeb 100644 --- a/app/DD_PM_WINDREAM/ModuleMySettings.vb +++ b/app/DD_PM_WINDREAM/ModuleMySettings.vb @@ -33,6 +33,14 @@ Module ModuleMySettings Return Path.Combine(Application.CommonAppDataPath(), CONFIG_FILE) End Function + Public Function GetCurrentConfigPath() As String + If File.Exists(GetUserConfigPath()) Then + Return GetUserConfigPath() + Else + Return GetAllUsersConfigPath() + End If + End Function + Public Function Settings_Load() Try Dim oDatatable As DataTable @@ -192,8 +200,10 @@ Module ModuleMySettings ''' Public Function SaveMySettingsValue(name As String, value As String) Try - Dim oConfigPath = GetUserConfigPath() - Dim oDatatable As DataTable = GetTablefromXML(oConfigPath) + Dim oUserConfigPath = GetUserConfigPath() + Dim oCurrentConfigPath = GetCurrentConfigPath() + + Dim oDatatable As DataTable = GetTablefromXML(oCurrentConfigPath) For Each Row As DataRow In oDatatable.Rows If Row.Item("ConfigName") = name Then @@ -201,7 +211,7 @@ Module ModuleMySettings End If Next oDatatable.AcceptChanges() - oDatatable.WriteXml(oConfigPath) + oDatatable.WriteXml(oUserConfigPath) Return True Catch ex As Exception MsgBox("Error in SaveConfigValue" & vbNewLine & ex.Message, MsgBoxStyle.Critical) diff --git a/app/DD_PM_WINDREAM/frmValidator.vb b/app/DD_PM_WINDREAM/frmValidator.vb index 8dafae9..c02eaac 100644 --- a/app/DD_PM_WINDREAM/frmValidator.vb +++ b/app/DD_PM_WINDREAM/frmValidator.vb @@ -1204,15 +1204,42 @@ Public Class frmValidator viewerID = Proc.Id End If End Sub + + Function ReplaceWindreamDriveLetter(Filepath As String) As String + Return Filepath. + Replace("W:", "\\windream\objects"). + Replace("K:", "\\windream\objects") + End Function + + Function Next_GUID(Filepath As String, ProfilId As Integer, OrderByNewest As Boolean) As Integer + Dim oFilePath = ReplaceWindreamDriveLetter(Filepath).ToUpper() + Dim oSQL = $" + SELECT GUID FROM TBPM_PROFILE_FILES WHERE + PROFIL_ID = {CURRENT_ProfilGUID} AND EDIT = 0 AND IN_WORK = 0 AND + UPPER(REPLACE(FILE_PATH, 'W:','\\windream\objects')) <> '{oFilePath}' AND + UPPER(REPLACE(FILE_PATH, 'W:','\\windream\objects')) NOT IN ( + SELECT UPPER(FILE_PATH) + FROM TBPM_FILES_USER_NOT_INDEXED + WHERE (PROFIL_ID = {ProfilId}) AND (UPPER(USR_NAME) = UPPER('{Environment.UserName}')) + ) + {IIf(OrderByNewest, " ORDER BY DMS_ERSTELLT_DATE DESC", "")} + " + + Return ClassDatabase.Execute_Scalar(oSQL, MyConnectionString, True) + End Function + Function Get_Next_GUID() As Integer Try Dim newGUID As Integer If LogErrorsOnly = False Then ClassLogger.Add(" >> Old Document_Path: " & OLD_Document_Path, False) - If PROFIL_sortbynewest = True Then - newGUID = TBPM_PROFILE_FILESTableAdapter.cmdgetNextFile_GUID_Newest(CURRENT_ProfilGUID, OLD_Document_Path, Environment.UserName) - Else - newGUID = TBPM_PROFILE_FILESTableAdapter.cmdGetNextFile_GUID(CURRENT_ProfilGUID, OLD_Document_Path, Environment.UserName) - End If + + newGUID = Next_GUID(OLD_Document_Path, CURRENT_ProfilGUID, PROFIL_sortbynewest) + + 'If PROFIL_sortbynewest = True Then + ' newGUID = TBPM_PROFILE_FILESTableAdapter.cmdgetNextFile_GUID_Newest(CURRENT_ProfilGUID, OLD_Document_Path, Environment.UserName) + 'Else + ' newGUID = TBPM_PROFILE_FILESTableAdapter.cmdGetNextFile_GUID(CURRENT_ProfilGUID, OLD_Document_Path, Environment.UserName) + 'End If Document_Path = "" CURRENT_DOC_PATH = "" If newGUID > 0 Then @@ -2135,16 +2162,15 @@ Public Class frmValidator Try Dim lookup As LookupControl = inctrl Dim wertWD = aktivesDokument.GetVariableValue(idxname) - If wertWD.GetType.ToString.Contains("System.Object") Then + If IsNothing(wertWD) Then + lookup.SelectedValues = New List(Of String) + ElseIf wertWD.GetType.ToString.Contains("System.Object") Then Dim oArrlist As New List(Of String) For Each oVectorRow As Object In wertWD oArrlist.Add(oVectorRow.ToString) Next lookup.SelectedValues = oArrlist - - Else - End If Catch ex As Exception