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

@@ -6,7 +6,7 @@
EnvelopeCreated = 1001
EnvelopeSaved = 1002
EnvelopeQueued = 1003
EnvelopeSent = 1004
EnvelopeSent = 1004 ' Nicht verwendet
EnvelopePartlySigned = 1005
EnvelopeCompletelySigned = 1006
EnvelopeArchived = 1007

View File

@@ -1,4 +1,5 @@
Imports DigitalData.Modules.Base
Imports DigitalData.Modules.Logging
Public Class EmailTemplate
Private _DocumentReceivedBodyTemplate As List(Of String)
@@ -15,13 +16,17 @@ Public Class EmailTemplate
Private _replaceDictionary As Dictionary(Of String, String)
Private DbConfig As DbConfig
Private ReadOnly DbConfig As DbConfig
Private ReadOnly LogConfig As LogConfig
Private ReadOnly Logger As Logger
Public Sub New(pState As State)
InitBodyTemplates()
InitSubjectTemplates()
DbConfig = pState.DbConfig
LogConfig = pState.LogConfig
Logger = LogConfig.GetLogger()
End Sub
Private Sub InitSubjectTemplates()
@@ -29,7 +34,7 @@ Public Class EmailTemplate
_DocumentSignedSubjectTemplate = "Dokument unterschrieben: '[DOCUMENT_TITLE]'"
_DocumentDeletedSubjectTemplate = "Vorgang zurückgezogen: '[DOCUMENT_TITLE]'"
_DocumentCompletedSubjectTemplate = "Vorgang abgeschlossen: '[DOCUMENT_TITLE]'"
_DocumentAccessCodeReceivedSubjectTemplate = "Dokument Passwort erhalten: '[DOCUMENT_TITLE]'"
_DocumentAccessCodeReceivedSubjectTemplate = "Zugriffscode für Dokument erhalten: '[DOCUMENT_TITLE]'"
End Sub
@@ -82,7 +87,7 @@ Public Class EmailTemplate
"Guten Tag [NAME_RECEIVER]",
"",
"[NAME_SENDER] hat Ihnen ein Dokument zum [SIGNATURE_TYPE] gesendet. ",
"Verwenden Sie das folgende Passwort, um das Dokument einzusehen:",
"Verwenden Sie den folgenden Zugriffscode, um das Dokument einzusehen:",
"",
"[DOCUMENT_ACCESS_CODE]",
"",
@@ -92,6 +97,8 @@ Public Class EmailTemplate
End Sub
Private Sub InitDictionary(pEmailData As EmailData)
Logger.Debug("Initializing dictionary..")
_replaceDictionary = New Dictionary(Of String, String) From {
{"[NAME_RECEIVER]", pEmailData.ReceiverName},
{"[NAME_SENDER]", pEmailData.SenderName},

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

View File

@@ -109,10 +109,18 @@ Public Class ActionService
End Function
Public Function CompleteEnvelope(pEnvelope As Envelope, pReceiver As EnvelopeReceiver, pAttachment As String) As Boolean
If HistoryService.SetEnvelopeStatus(pEnvelope, Constants.EnvelopeStatus.MessageCompletionSent, pReceiver.Email) = False Then
Return False
End If
Return EmailService.SendDocumentCompletedEmailToReceiver(pEnvelope, pReceiver, pAttachment)
End Function
Public Function CompleteEnvelope(pEnvelope As Envelope, pAttachment As String) As Boolean
If HistoryService.SetEnvelopeStatus(pEnvelope, Constants.EnvelopeStatus.MessageCompletionSent, pEnvelope.User.Email) = False Then
Return False
End If
Return EmailService.SendDocumentCompletedEmailToCreator(pEnvelope, pAttachment)
End Function

View File

@@ -16,6 +16,7 @@ Public Class EmailService
End Sub
Public Function SendEnvelopeDeletedEmail(pEnvelope As Envelope, pReceiver As EnvelopeReceiver) As Boolean
Logger.Debug("Creating email data object.")
Dim oEmailData As New EmailData(pEnvelope, pReceiver, Constants.EnvelopeStatus.MessageDeletionSent) With
{
.SignatureLink = ""
@@ -32,6 +33,7 @@ Public Class EmailService
End Function
Public Function SendDocumentReceivedEmail(pEnvelope As Envelope, pReceiver As EnvelopeReceiver) As Boolean
Logger.Debug("Creating email data object.")
Dim oEmailData As New EmailData(pEnvelope, pReceiver, Constants.EnvelopeStatus.MessageInvitationSent) With
{
.SignatureLink = Helpers.GetEnvelopeURL(State.DbConfig.SignatureHost, pEnvelope.Uuid, pReceiver.Signature)
@@ -48,7 +50,7 @@ Public Class EmailService
End Function
Public Function SendDocumentAccessCodeReceivedEmail(pEnvelope As Envelope, pReceiver As EnvelopeReceiver) As Boolean
Logger.Debug("Creating email data object.")
Dim oEmailData As New EmailData(pEnvelope, pReceiver, Constants.EnvelopeStatus.MessageAccessCodeSent) With
{
.SignatureLink = Helpers.GetEnvelopeURL(State.DbConfig.SignatureHost, pEnvelope.Uuid, pReceiver.Signature)
@@ -65,6 +67,7 @@ Public Class EmailService
End Function
Public Function SendSignedEmail(pEnvelope As Envelope, pReceiver As EnvelopeReceiver) As Boolean
Logger.Debug("Creating email data object.")
Dim oEmailData = New EmailData(pEnvelope, pReceiver, Constants.EnvelopeStatus.MessageConfirmationSent) With
{
.SignatureLink = ""
@@ -81,6 +84,7 @@ Public Class EmailService
End Function
Public Function SendDocumentCompletedEmailToReceiver(pEnvelope As Envelope, pReceiver As EnvelopeReceiver, pAttachment As String) As Boolean
Logger.Debug("Creating email data object.")
Dim oEmailData = New EmailData(pEnvelope, pReceiver, Constants.EnvelopeStatus.MessageCompletionSent) With
{
.SignatureLink = "",
@@ -100,6 +104,7 @@ Public Class EmailService
End Function
Public Function SendDocumentCompletedEmailToCreator(pEnvelope As Envelope, pAttachment As String) As Boolean
Logger.Debug("Creating email data object.")
Dim oEmailData = New EmailData(pEnvelope, Constants.EnvelopeStatus.MessageCompletionSent) With
{
.SignatureLink = "",

View File

@@ -64,6 +64,33 @@ Namespace My.Resources
End Set
End Property
'''<summary>
''' Sucht eine lokalisierte Zeichenfolge, die Zugriffscode korrekt eingegeben ähnelt.
'''</summary>
Public Shared ReadOnly Property AccessCodeCorrect() As String
Get
Return ResourceManager.GetString("AccessCodeCorrect", resourceCulture)
End Get
End Property
'''<summary>
''' Sucht eine lokalisierte Zeichenfolge, die Zugriffscode falsch eingegeben ähnelt.
'''</summary>
Public Shared ReadOnly Property AccessCodeIncorrect() As String
Get
Return ResourceManager.GetString("AccessCodeIncorrect", resourceCulture)
End Get
End Property
'''<summary>
''' Sucht eine lokalisierte Zeichenfolge, die Zugriffscode angefordert ähnelt.
'''</summary>
Public Shared ReadOnly Property AccessCodeRequested() As String
Get
Return ResourceManager.GetString("AccessCodeRequested", resourceCulture)
End Get
End Property
'''<summary>
''' Sucht eine lokalisierte Zeichenfolge, die Abgeschlossen ähnelt.
'''</summary>
@@ -217,6 +244,24 @@ Namespace My.Resources
End Get
End Property
'''<summary>
''' Sucht eine lokalisierte Zeichenfolge, die Zugriffscode versendet ähnelt.
'''</summary>
Public Shared ReadOnly Property MessageAccessCodeSent() As String
Get
Return ResourceManager.GetString("MessageAccessCodeSent", resourceCulture)
End Get
End Property
'''<summary>
''' Sucht eine lokalisierte Zeichenfolge, die Abschlussemail versendet ähnelt.
'''</summary>
Public Shared ReadOnly Property MessageCompletionSent() As String
Get
Return ResourceManager.GetString("MessageCompletionSent", resourceCulture)
End Get
End Property
'''<summary>
''' Sucht eine lokalisierte Zeichenfolge, die Bestätigung versendet ähnelt.
'''</summary>

View File

@@ -117,6 +117,15 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="AccessCodeCorrect" xml:space="preserve">
<value>Accesscode entered correctly</value>
</data>
<data name="AccessCodeIncorrect" xml:space="preserve">
<value>Accesscode entered incorrectly</value>
</data>
<data name="AccessCodeRequested" xml:space="preserve">
<value>Accesscode requested</value>
</data>
<data name="Completed" xml:space="preserve">
<value>Completed</value>
</data>
@@ -165,6 +174,12 @@
<data name="EnvelopeTransmittedDMS" xml:space="preserve">
<value>DMS</value>
</data>
<data name="MessageAccessCodeSent" xml:space="preserve">
<value>Accesscode sent</value>
</data>
<data name="MessageCompletionSent" xml:space="preserve">
<value>Final email sent</value>
</data>
<data name="MessageConfirmationSent" xml:space="preserve">
<value>Confirmation Sent</value>
</data>

View File

@@ -117,6 +117,15 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="AccessCodeCorrect" xml:space="preserve">
<value>Zugriffscode korrekt eingegeben</value>
</data>
<data name="AccessCodeIncorrect" xml:space="preserve">
<value>Zugriffscode falsch eingegeben</value>
</data>
<data name="AccessCodeRequested" xml:space="preserve">
<value>Zugriffscode angefordert</value>
</data>
<data name="Completed" xml:space="preserve">
<value>Abgeschlossen</value>
</data>
@@ -168,6 +177,12 @@
<data name="EnvelopeTransmittedDMS" xml:space="preserve">
<value>DMS</value>
</data>
<data name="MessageAccessCodeSent" xml:space="preserve">
<value>Zugriffscode versendet</value>
</data>
<data name="MessageCompletionSent" xml:space="preserve">
<value>Abschlussemail versendet</value>
</data>
<data name="MessageConfirmationSent" xml:space="preserve">
<value>Bestätigung versendet</value>
</data>