This commit is contained in:
Jonathan Jenne
2024-01-11 11:20:23 +01:00
parent 32a965800e
commit 52ffcc21cc
15 changed files with 758 additions and 681 deletions

View File

@@ -60,6 +60,11 @@ Namespace Jobs
Logger.Debug("Loading Models & Services")
Dim oState = GetState()
InitializeModels(oState)
Logger.Debug("Loading Configuration..")
Config = ConfigModel.LoadConfiguration()
oState.DbConfig = Config
InitializeServices(oState)
Logger.Debug("Loading PDFBurner..")
@@ -71,9 +76,6 @@ Namespace Jobs
Logger.Debug("Loading ReportCreator..")
ReportCreator = New ReportCreator(LogConfig, oState)
Logger.Debug("Loading Configuration..")
Config = ConfigModel.LoadConfiguration()
Logger.Debug("DocumentPath: [{0}]", Config.DocumentPath)
Logger.Debug("ExportPath: [{0}]", Config.ExportPath)
@@ -117,12 +119,6 @@ Namespace Jobs
Throw New ApplicationException("Document could not be finalized")
End If
Logger.Debug("Setting envelope status..")
If ActionService.FinalizeEnvelope(oEnvelope) = False Then
Logger.Warn("Envelope could not be finalized!")
Throw New ApplicationException("Envelope could not be finalized")
End If
Logger.Debug("Creating report..")
Dim oReport As Byte() = ReportCreator.CreateReport(oEnvelope)
Logger.Debug("Report created.")
@@ -144,10 +140,18 @@ Namespace Jobs
Throw New ExportDocumentException("Could not export final document to disk!", ex)
End Try
Logger.Info("Sending final Emails..")
If SendFinalEmails(oEnvelope, oOutputFilePath) = False Then
Throw New ApplicationException("Final emails could not be sent!")
End If
Logger.Debug("Setting envelope status..")
If ActionService.FinalizeEnvelope(oEnvelope) = False Then
Logger.Warn("Envelope could not be finalized!")
Throw New ApplicationException("Envelope could not be finalized")
End If
oCurrent += 1
Logger.Info("Envelope finalized!")
@@ -191,7 +195,7 @@ Namespace Jobs
Private Function SendFinalEmailToCreator(pEnvelope As Envelope, pAttachment As String) As Boolean
Dim oIncludeAttachment = SendFinalEmailWithAttachment(pEnvelope.FinalEmailToCreator)
Dim oAttachment = Nothing
Dim oAttachment = String.Empty
Logger.Debug("Attachment included: [{0}]", oIncludeAttachment)
If oIncludeAttachment Then
@@ -208,7 +212,7 @@ Namespace Jobs
Private Function SendFinalEmailToReceivers(pEnvelope As Envelope, pAttachment As String) As Boolean
Dim oIncludeAttachment = SendFinalEmailWithAttachment(pEnvelope.FinalEmailToReceivers)
Dim oAttachment = Nothing
Dim oAttachment = String.Empty
Logger.Debug("Attachment included: [{0}]", oIncludeAttachment)
If oIncludeAttachment Then