EDMIService: Small tweaks

This commit is contained in:
Jonathan Jenne 2021-07-13 16:01:54 +02:00
parent fd22b6a3bf
commit 2bd253d4f5

View File

@ -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}