scheduler

This commit is contained in:
Jonathan Jenne
2023-12-01 15:05:41 +01:00
parent 3ca992e043
commit bdff38410c
13 changed files with 178 additions and 51 deletions

View File

@@ -10,6 +10,8 @@ Public Class EnvelopeEditorController
Public ReadOnly Envelope As Envelope = Nothing
Public ReadOnly EmailService As EmailService
Public ReadOnly ActionService As ActionService
Public ReadOnly Thumbnail As Thumbnail
@@ -19,6 +21,7 @@ Public Class EnvelopeEditorController
Envelope = CreateEnvelope()
Thumbnail = New Thumbnail(pState.LogConfig)
EmailService = New EmailService(pState)
ActionService = New ActionService(pState)
End Sub
Public Sub New(pState As State, pEnvelope As Envelope)
@@ -29,32 +32,12 @@ Public Class EnvelopeEditorController
Envelope.Receivers = ReceiverModel.ListEnvelopeReceivers(pEnvelope.Id).ToList()
Thumbnail = New Thumbnail(pState.LogConfig)
EmailService = New EmailService(pState)
ActionService = New ActionService(pState)
End Sub
#Region "Public"
Public Function SendEnvelope() As Boolean
For Each receiverItem As EnvelopeReceiver In Envelope.Receivers
If EmailService.SendInitialEmail(receiverItem.Id, Envelope.Id) = False Then
Logger.Warn("Email could not be sent.")
Return False
End If
Next
Dim newHistoryEntry As New EnvelopeHistoryEntry With {
.EnvelopeId = Envelope.Id,
.Status = EnvelopeStatus.EnvelopeQueued,
.UserReference = Envelope.User.Email
}
If HistoryModel.Insert(newHistoryEntry) Then
Return True
Else
Logger.Warn("History Entry could not be created!")
Return False
End If
Return ActionService.SendEnvelope(Envelope)
End Function
Public Function ValidateEnvelopeForSending(pErrors As List(Of String)) As List(Of String)