29-11-2023
This commit is contained in:
@@ -1,18 +1,79 @@
|
||||
Imports DigitalData.Modules.Base
|
||||
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class EmailService
|
||||
Inherits BaseClass
|
||||
|
||||
Private ReadOnly State As State
|
||||
|
||||
Private ReadOnly EnvelopeModel As EnvelopeModel
|
||||
Private ReadOnly ReceiverModel As ReceiverModel
|
||||
Private ReadOnly EmailModel As EmailModel
|
||||
|
||||
Private ReadOnly EmailTemplate As EmailTemplate
|
||||
|
||||
Public Sub New(pState As State)
|
||||
MyBase.New(pState.LogConfig)
|
||||
|
||||
State = pState
|
||||
EnvelopeModel = New EnvelopeModel(pState)
|
||||
ReceiverModel = New ReceiverModel(pState)
|
||||
EmailModel = New EmailModel(pState)
|
||||
EmailTemplate = New EmailTemplate()
|
||||
End Sub
|
||||
|
||||
Public Function SendSignedEmail(pReceiverId As Integer, pEnvelopeId As Integer)
|
||||
Public Function SendEnvelopeDeletedEmail(pReceiverId As Integer, pEnvelopeId As Integer) As Boolean
|
||||
Dim oEnvelope = EnvelopeModel.GetById(pEnvelopeId)
|
||||
Dim oReceiver = ReceiverModel.GetById(pReceiverId)
|
||||
|
||||
Dim oEnvelope =
|
||||
Dim oEmailData As New EmailData(oEnvelope, oReceiver) With
|
||||
{
|
||||
.SignatureLink = ""
|
||||
}
|
||||
|
||||
EmailTemplate.FillEnvelopeDeletedEmailBody(oEmailData)
|
||||
|
||||
If EmailModel.Insert(oEmailData) = False Then
|
||||
Logger.Error("EMail data could not be inserted.")
|
||||
Return False
|
||||
End If
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Public Function SendInitialEmail(pReceiverId As Integer, pEnvelopeId As Integer) As Boolean
|
||||
Dim oEnvelope = EnvelopeModel.GetById(pEnvelopeId)
|
||||
Dim oReceiver = ReceiverModel.GetById(pReceiverId)
|
||||
|
||||
Dim oEmailData As New EmailData(oEnvelope, oReceiver) With
|
||||
{
|
||||
.SignatureLink = Helpers.GetEnvelopeURL(State.DbConfig.SignatureHost, oEnvelope.Uuid, oReceiver.Signature)
|
||||
}
|
||||
|
||||
EmailTemplate.FillDocumentReceivedEmailBody(oEmailData)
|
||||
|
||||
If EmailModel.Insert(oEmailData) = False Then
|
||||
Logger.Error("EMail data could not be inserted.")
|
||||
Return False
|
||||
End If
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Public Function SendSignedEmail(pReceiverId As Integer, pEnvelopeId As Integer) As Boolean
|
||||
Dim oEnvelope = EnvelopeModel.GetById(pEnvelopeId)
|
||||
Dim oReceiver = ReceiverModel.GetById(pReceiverId)
|
||||
|
||||
Dim oEmailData = New EmailData(oEnvelope, oReceiver) With {.SignatureLink = ""}
|
||||
EmailTemplate.FillDocumentSignedEmailBody(oEmailData)
|
||||
|
||||
If EmailModel.Insert(oEmailData) = False Then
|
||||
Logger.Error("EMail data could not be inserted.")
|
||||
Return False
|
||||
End If
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user