From 2bd253d4f5f462b91c86e45c3152f6608a354b7a Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Tue, 13 Jul 2021 16:01:54 +0200 Subject: [PATCH] EDMIService: Small tweaks --- Service.EDMIService/EDMIService.vb | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Service.EDMIService/EDMIService.vb b/Service.EDMIService/EDMIService.vb index 5d8a99d3..3ba90779 100644 --- a/Service.EDMIService/EDMIService.vb +++ b/Service.EDMIService/EDMIService.vb @@ -506,7 +506,7 @@ Public Class EDMIService oStoreType = ClassConstants.FileStoreWork End If - Dim oRelpath As String = GetFileStorePraefix(oStoreType) + Dim oBasePath As String = GetFileStorePraefix(oStoreType) Dim oSubDirectory As String If IsNothing(Data.DateImported) Then @@ -517,21 +517,23 @@ Public Class EDMIService _Logger.Debug("Subdirectory is [{0}]", oSubDirectory) - oRelpath = Path.Combine(oRelpath, oSubDirectory) + Dim oFinalPath = Path.Combine(oBasePath, oSubDirectory) - If Not Directory.Exists(oRelpath) Then + If Not Directory.Exists(oFinalPath) Then Try - _Logger.Debug("Path does not exist, creating: [{0}]", oRelpath) - Directory.CreateDirectory(oRelpath) - _Logger.Debug("Created folder [{0}]", oRelpath) + _Logger.Debug("Path does not exist, creating: [{0}]", oFinalPath) + Directory.CreateDirectory(oFinalPath) + _Logger.Debug("Created folder [{0}]", oFinalPath) Catch ex As Exception Throw GetFault(ex) End Try End If - _Logger.Debug("Relative Path is [{0}]", oRelpath) + _Logger.Debug("Final Directory is [{0}]", oFinalPath) - Dim oFileObjectPath As String = Path.Combine(oRelpath, GetFileObjectFileName(Data.ObjectId, Data.Extension, Data.KeepExtension)) + Dim oFileName As String = GetFileObjectFileName(Data.ObjectId, Data.Extension, Data.KeepExtension) + + Dim oFileObjectPath As String = Path.Combine(oFinalPath, oFileName) _Logger.Debug("Final Path is [{0}]", oFileObjectPath) Return New NewFileObjectResponse With {.FileObjectPath = oFileObjectPath} @@ -562,8 +564,8 @@ Public Class EDMIService oStream.Close() End Using - ' insert into db - Dim oSQL As String = $"EXEC PRIDB_NEW_IDBFO '{Data.FilePath}','{Data.Who}','{Data.ObjectId}',{oObjectStore.Id}" + ' Insert into DB + Dim oSQL As String = $"EXEC PRIDB_NEW_IDBFO '{Data.FilePath}',{Data.Contents.Length},'{Data.Who}','{Data.ObjectId}',{oObjectStore.Id}" Dim oResult As Boolean = MSSQL_IDB.ExecuteNonQuery(oSQL) Return New ImportFileIntoFileObjectResponse() With {.Result = oResult}