EDMIService: First completed version of UpdateFileMethod
This commit is contained in:
@@ -2,12 +2,11 @@
|
||||
Imports DigitalData.Modules.Database.MSSQLServer
|
||||
Imports DigitalData.Modules.Language
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.EDMI.API.Client
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.IO
|
||||
Imports DigitalData.Modules.ZooFlow.State
|
||||
Imports DigitalData.Modules.Patterns
|
||||
Imports DigitalData.Services.EDMIService.Methods.IDB
|
||||
Imports DigitalData.Modules.Filesystem
|
||||
|
||||
Namespace IDB
|
||||
Public Class Helpers
|
||||
@@ -15,15 +14,17 @@ Namespace IDB
|
||||
|
||||
Private ReadOnly Patterns As Patterns2
|
||||
Private ReadOnly Database As MSSQLServer
|
||||
Private ReadOnly FileEx As File
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pMSSQLServer As MSSQLServer)
|
||||
MyBase.New(pLogConfig)
|
||||
Patterns = New Patterns2(pLogConfig)
|
||||
Database = pMSSQLServer
|
||||
FileEx = New File(pLogConfig)
|
||||
End Sub
|
||||
|
||||
Public Function GetPlaceholderValue(pValue As String,
|
||||
pFileInfo As FileInfo,
|
||||
pFileInfo As IO.FileInfo,
|
||||
pUserState As UserState,
|
||||
pUserAttributes As Dictionary(Of String, List(Of String)),
|
||||
pAutoAttributes As Dictionary(Of String, List(Of String))) As String
|
||||
@@ -135,6 +136,32 @@ Namespace IDB
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function GetFileObjectPath(pStore As GlobalState.ObjectStore, pDateImported As Date) As String
|
||||
' Get directory by DateImported or, if not supplied, by current date
|
||||
Dim oSubDirectory As String
|
||||
If IsNothing(pDateImported) Then
|
||||
oSubDirectory = FileEx.CreateDateDirectory(Now)
|
||||
Else
|
||||
oSubDirectory = FileEx.CreateDateDirectory(pDateImported)
|
||||
End If
|
||||
Logger.Debug("Subdirectory is [{0}]", oSubDirectory)
|
||||
|
||||
' Check and create final path, if necessary
|
||||
Dim oFinalPath = IO.Path.Combine(pStore.Path, oSubDirectory)
|
||||
If Not IO.Directory.Exists(oFinalPath) Then
|
||||
Try
|
||||
Logger.Debug("Path does not exist, creating: [{0}]", oFinalPath)
|
||||
IO.Directory.CreateDirectory(oFinalPath)
|
||||
Logger.Debug("Created folder [{0}]", oFinalPath)
|
||||
Catch ex As Exception
|
||||
LogAndThrow(ex, $"Store Directory [{oFinalPath}] could not be created!")
|
||||
End Try
|
||||
End If
|
||||
Logger.Debug("Final Directory is [{0}]", oFinalPath)
|
||||
|
||||
Return oFinalPath
|
||||
End Function
|
||||
|
||||
Public Function GetObject(pObjectId As Long) As IDBObject
|
||||
Try
|
||||
Dim oGetObjectSQL = $"SELECT * FROM VWIDB_OBJECT WHERE IDB_OBJ_ID = {pObjectId}"
|
||||
|
||||
Reference in New Issue
Block a user