EDMI: Method NewFileAsync Improvements

This commit is contained in:
Jonathan Jenne
2021-06-28 16:40:21 +02:00
parent 5d296873be
commit 36b86ed9d1
10 changed files with 198 additions and 203 deletions

View File

@@ -580,12 +580,17 @@ Public Class EDMIService
End Function
Public Function ImportFileIntoFileObject(Data As ImportFileIntoFileObjectRequest) As ImportFileIntoFileObjectResponse Implements IEDMIService.ImportFileIntoFileObject
Dim oObjectStore = GlobalState.ObjectStores.First()
Dim oEDMIPath = New EDMI.File.Path(LogConfig, oObjectStore.Path)
Try
Using oStream = New FileStream(Data.pIDBFilePath, FileMode.Create, FileAccess.Write)
_Logger.Info("ImportFile: Saving file to path [{0}]", Data.pIDBFilePath)
Dim oObjectStore = GlobalState.ObjectStores.
Where(Function(o) o.Title = Data.ObjectStoreType).
FirstOrDefault()
If oObjectStore Is Nothing Then
Throw New KeyNotFoundException($"ObjectStore [{Data.ObjectStoreType}] was not found.")
End If
Using oStream = New FileStream(Data.FilePath, FileMode.Create, FileAccess.Write)
_Logger.Info("ImportFile: Saving file to path [{0}]", Data.FilePath)
_Logger.Info("ImportFile: Content Length: {0}", Data.Contents.Length)
oStream.Write(Data.Contents, 0, Data.Contents.Length)
@@ -594,7 +599,7 @@ Public Class EDMIService
End Using
' insert into db
Dim oSQL As String = $"EXEC PRIDB_NEW_IDBFO '{Data.pIDBFilePath}','{Data.pWho}','{Data.pIDB_OBJ_ID}',{Data.pObjectStoreID}"
Dim oSQL As String = $"EXEC PRIDB_NEW_IDBFO '{Data.FilePath}','{Data.Who}','{Data.ObjectId}',{oObjectStore.Id}"
Dim oResult As Boolean = MSSQL_IDB.ExecuteNonQuery(oSQL)
Return New ImportFileIntoFileObjectResponse() With {.Result = oResult}