10.01.2024

This commit is contained in:
Jonathan Jenne 2024-01-10 13:06:55 +01:00
parent 37908b6a1b
commit c7dba51ec9
8 changed files with 58 additions and 20 deletions

View File

@ -1,20 +1,20 @@

Public Class EmailData
Public Property EmailAdress As String
Public Property EmailSubject As String
Public Property EmailBody As String
Public Property EmailType As Constants.EnvelopeStatus
Public Property ReferenceID As Integer
Public Property ReferenceString As String
Public Property EmailAdress As String = ""
Public Property EmailSubject As String = ""
Public Property EmailBody As String = ""
Public Property EmailType As Constants.EnvelopeStatus = Constants.EnvelopeStatus.Invalid
Public Property ReferenceID As Integer = 0
Public Property ReferenceString As String = ""
Public Property ReceiverAccessCode As String
Public Property ReceiverName As String
Public Property SenderName As String
Public Property SenderAdress As String
Public Property ReceiverAccessCode As String = ""
Public Property ReceiverName As String = ""
Public Property SenderName As String = ""
Public Property SenderAdress As String = ""
Public Property SignatureLink As String
Public Property Message As String
Public Property EnvelopeTitle As String
Public Property SignatureLink As String = ""
Public Property Message As String = ""
Public Property EnvelopeTitle As String = ""
Public Property EmailAttachment As String = ""

View File

@ -144,7 +144,9 @@ Namespace Jobs
Throw New ExportDocumentException("Could not export final document to disk!", ex)
End Try
SendFinalEmails(oEnvelope, oOutputFilePath)
If SendFinalEmails(oEnvelope, oOutputFilePath) = False Then
Throw New ApplicationException("Final emails could not be sent!")
End If
oCurrent += 1
Logger.Info("Envelope finalized!")
@ -156,6 +158,10 @@ Namespace Jobs
Logger.Warn("Certificate Document job failed at step: Merging documents!")
Logger.Error(ex)
Catch ex As ExportDocumentException
Logger.Warn("Certificate Document job failed at step: Exporting document!")
Logger.Error(ex)
Catch ex As Exception
Logger.Warn("Certificate Document job failed!")
Logger.Error(ex)
@ -171,10 +177,12 @@ Namespace Jobs
Dim oMailToReceivers = pEnvelope.FinalEmailToReceivers
If oMailToCreator <> FinalEmailType.No Then
Logger.Debug("Sending email to creator..")
SendFinalEmailToCreator(pEnvelope, pAttachment)
End If
If oMailToReceivers <> FinalEmailType.No Then
Logger.Debug("Sending emails to receivers..")
SendFinalEmailToReceivers(pEnvelope, pAttachment)
End If
@ -185,6 +193,7 @@ Namespace Jobs
Dim oIncludeAttachment = SendFinalEmailWithAttachment(pEnvelope.FinalEmailToCreator)
Dim oAttachment = Nothing
Logger.Debug("Attachment included: [{0}]", oIncludeAttachment)
If oIncludeAttachment Then
oAttachment = pAttachment
End If
@ -201,6 +210,7 @@ Namespace Jobs
Dim oIncludeAttachment = SendFinalEmailWithAttachment(pEnvelope.FinalEmailToReceivers)
Dim oAttachment = Nothing
Logger.Debug("Attachment included: [{0}]", oIncludeAttachment)
If oIncludeAttachment Then
oAttachment = pAttachment
End If

View File

@ -179,6 +179,21 @@ Public Class ReceiverModel
End Try
End Function
Public Function ListReceivers() As IEnumerable(Of EnvelopeReceiver)
Try
Dim oSql = $"SELECT * FROM [dbo].[TBSIG_RECEIVER]"
Dim oTable = Database.GetDatatable(oSql)
Return oTable?.Rows.Cast(Of DataRow).
Select(AddressOf ToReceiver).
ToList()
Catch ex As Exception
Logger.Error(ex)
Return Nothing
End Try
End Function
Public Function ListReceivers(pReceiversFromGrid As List(Of EnvelopeReceiver)) As IEnumerable(Of EnvelopeReceiver)
Try
If pReceiversFromGrid.Count = 0 Then

View File

@ -87,6 +87,8 @@ Public Class EmailService
.EmailAttachment = pAttachment
}
Logger.Debug("Sending mail to receiver: [{0}]", oEmailData.EmailAdress)
EmailTemplate.FillDocumentCompletedEmailBody(oEmailData)
If EmailModel.Insert(oEmailData) = False Then

View File

@ -20,8 +20,7 @@ namespace EnvelopeGenerator.Web.Controllers
[Route("/")]
public IActionResult Index()
{
var receiverId = 1;
List<Envelope> envelopes = _envelopeService.LoadEnvelopes(receiverId);
List<Envelope> envelopes = _envelopeService.LoadEnvelopes();
return View(envelopes);
}

View File

@ -108,6 +108,20 @@ namespace EnvelopeGenerator.Web.Services
ToList();
}
public List<Envelope> LoadEnvelopes()
{
var receivers = receiverModel.ListReceivers();
List<Envelope> envelopes = new();
foreach (var receiver in receivers)
{
var envs = (List<Envelope>)envelopeModel.List(receiver.Id);
envelopes.AddRange(envs);
}
return envelopes;
}
public List<Envelope> LoadEnvelopes(int pReceiverId)
{
return (List<Envelope>)envelopeModel.List(pReceiverId);

View File

@ -7,7 +7,7 @@
@functions {
string encodeEnvelopeKey(Envelope envelope)
{
var receiver = envelope.Receivers.Where(r => r.Id == 1).SingleOrDefault();
var receiver = envelope.Receivers.First();
return Helpers.EncodeEnvelopeReceiverId(envelope.Uuid, receiver.Signature);
}
}

View File

@ -165,9 +165,7 @@ class App {
case 'RESET':
result = await this.handleReset(null)
console.log(result)
if (result == true) {
if (result.isConfirmed) {
Swal.fire({
title: 'Erfolg',
text: 'Dokument wurde zurückgesetzt',