diff --git a/EDMI.File/Path.vb b/EDMI.File/Path.vb index 8da28dcb..de043ed8 100644 --- a/EDMI.File/Path.vb +++ b/EDMI.File/Path.vb @@ -16,23 +16,24 @@ Public Class Path _BasePath = DatastoreBasePath End Sub - Public Function GetActivePath(DocumentType As String) + Public Function GetActivePath(DocumentType As String, Optional FileName As String = "") Dim oPathParts As New List(Of String) From {_BasePath, PATH_EDMI, PATH_ACTIVE} - oPathParts.AddRange(GetRelativePath(DocumentType)) + oPathParts.AddRange(GetRelativePath(DocumentType, FileName)) Return IO.Path.Combine(oPathParts.ToArray()) End Function - Public Function GetArchivePath(DocumentType As String) + Public Function GetArchivePath(DocumentType As String, Optional FileName As String = "") Dim oPathParts As New List(Of String) From {_BasePath, PATH_EDMI, PATH_ARCHIVE} - oPathParts.AddRange(GetRelativePath(DocumentType)) + oPathParts.AddRange(GetRelativePath(DocumentType, FileName)) Return IO.Path.Combine(oPathParts.ToArray()) End Function - Public Function GetRelativePath(DocumentType As String) + Public Function GetRelativePath(DocumentType As String, Optional FileName As String = "") Dim oPathParts As New List(Of String) From {DocumentType} oPathParts.AddRange(GetDatePath()) + oPathParts.Add(FileName) Return IO.Path.Combine(oPathParts.ToArray()) End Function diff --git a/Service.EDMIService/EDMIService.vb b/Service.EDMIService/EDMIService.vb index 2a36814f..7d13f7bf 100644 --- a/Service.EDMIService/EDMIService.vb +++ b/Service.EDMIService/EDMIService.vb @@ -303,9 +303,9 @@ Public Class EDMIService #Region "Document" Public Function ImportFile(FileName As String, Contents() As Byte, AddedWho As String) As DocumentResult2 Implements IEDMIService.ImportFile Dim oDocumentType As String = "DummyDocumentType" + Dim oRelativePath As String = EDMIPath.GetRelativePath(oDocumentType, FileName) + Dim oAbsolutePath As String = EDMIPath.GetActivePath(oDocumentType) Dim oDirectoryPath = EDMIPath.GetActivePath(oDocumentType) - Dim oAbsPath = Path.Combine(oDirectoryPath, FileName) - Dim oRelativePath = EDMIPath.GetRelativePath(oDocumentType) Dim oDocument = New DocumentResult2.DocumentObject With {.FileName = FileName} Try @@ -316,7 +316,7 @@ Public Class EDMIService End Try Try - Dim oVersionedFileName As String = Filesystem.GetVersionedFilename(oAbsPath) + Dim oVersionedFileName As String = Filesystem.GetVersionedFilename(oAbsolutePath) _logger.Info("Saving file [{0}] to path [{1}]", FileName, oVersionedFileName) Using oStream = New FileStream(oVersionedFileName, FileMode.CreateNew) @@ -328,7 +328,7 @@ Public Class EDMIService ' insert into db Dim oCommand As New SqlCommand("PRIDB_NEW_DOCUMENT") oCommand.Parameters.AddWithValue("@OBJ_ST_ID", 1) - oCommand.Parameters.AddWithValue("@REL_PATH", oDirectoryPath) + oCommand.Parameters.AddWithValue("@REL_PATH", oRelativePath) oCommand.Parameters.AddWithValue("@WHO", AddedWho) oCommand.Parameters.AddWithValue("@REF_DOCID", 0) oCommand.Parameters.Add(New SqlParameter("@IDB_OBJ_ID", SqlDbType.BigInt))