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 Class EmailData
Public Property EmailAdress As String Public Property EmailAdress As String = ""
Public Property EmailSubject As String Public Property EmailSubject As String = ""
Public Property EmailBody As String Public Property EmailBody As String = ""
Public Property EmailType As Constants.EnvelopeStatus Public Property EmailType As Constants.EnvelopeStatus = Constants.EnvelopeStatus.Invalid
Public Property ReferenceID As Integer Public Property ReferenceID As Integer = 0
Public Property ReferenceString As String Public Property ReferenceString As String = ""
Public Property ReceiverAccessCode As String Public Property ReceiverAccessCode As String = ""
Public Property ReceiverName As String Public Property ReceiverName As String = ""
Public Property SenderName As String Public Property SenderName As String = ""
Public Property SenderAdress As String Public Property SenderAdress As String = ""
Public Property SignatureLink As String Public Property SignatureLink As String = ""
Public Property Message As String Public Property Message As String = ""
Public Property EnvelopeTitle As String Public Property EnvelopeTitle As String = ""
Public Property EmailAttachment 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) Throw New ExportDocumentException("Could not export final document to disk!", ex)
End Try End Try
SendFinalEmails(oEnvelope, oOutputFilePath) If SendFinalEmails(oEnvelope, oOutputFilePath) = False Then
Throw New ApplicationException("Final emails could not be sent!")
End If
oCurrent += 1 oCurrent += 1
Logger.Info("Envelope finalized!") Logger.Info("Envelope finalized!")
@ -156,6 +158,10 @@ Namespace Jobs
Logger.Warn("Certificate Document job failed at step: Merging documents!") Logger.Warn("Certificate Document job failed at step: Merging documents!")
Logger.Error(ex) Logger.Error(ex)
Catch ex As ExportDocumentException
Logger.Warn("Certificate Document job failed at step: Exporting document!")
Logger.Error(ex)
Catch ex As Exception Catch ex As Exception
Logger.Warn("Certificate Document job failed!") Logger.Warn("Certificate Document job failed!")
Logger.Error(ex) Logger.Error(ex)
@ -171,10 +177,12 @@ Namespace Jobs
Dim oMailToReceivers = pEnvelope.FinalEmailToReceivers Dim oMailToReceivers = pEnvelope.FinalEmailToReceivers
If oMailToCreator <> FinalEmailType.No Then If oMailToCreator <> FinalEmailType.No Then
Logger.Debug("Sending email to creator..")
SendFinalEmailToCreator(pEnvelope, pAttachment) SendFinalEmailToCreator(pEnvelope, pAttachment)
End If End If
If oMailToReceivers <> FinalEmailType.No Then If oMailToReceivers <> FinalEmailType.No Then
Logger.Debug("Sending emails to receivers..")
SendFinalEmailToReceivers(pEnvelope, pAttachment) SendFinalEmailToReceivers(pEnvelope, pAttachment)
End If End If
@ -185,6 +193,7 @@ Namespace Jobs
Dim oIncludeAttachment = SendFinalEmailWithAttachment(pEnvelope.FinalEmailToCreator) Dim oIncludeAttachment = SendFinalEmailWithAttachment(pEnvelope.FinalEmailToCreator)
Dim oAttachment = Nothing Dim oAttachment = Nothing
Logger.Debug("Attachment included: [{0}]", oIncludeAttachment)
If oIncludeAttachment Then If oIncludeAttachment Then
oAttachment = pAttachment oAttachment = pAttachment
End If End If
@ -201,6 +210,7 @@ Namespace Jobs
Dim oIncludeAttachment = SendFinalEmailWithAttachment(pEnvelope.FinalEmailToReceivers) Dim oIncludeAttachment = SendFinalEmailWithAttachment(pEnvelope.FinalEmailToReceivers)
Dim oAttachment = Nothing Dim oAttachment = Nothing
Logger.Debug("Attachment included: [{0}]", oIncludeAttachment)
If oIncludeAttachment Then If oIncludeAttachment Then
oAttachment = pAttachment oAttachment = pAttachment
End If End If

View File

@ -179,6 +179,21 @@ Public Class ReceiverModel
End Try End Try
End Function 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) Public Function ListReceivers(pReceiversFromGrid As List(Of EnvelopeReceiver)) As IEnumerable(Of EnvelopeReceiver)
Try Try
If pReceiversFromGrid.Count = 0 Then If pReceiversFromGrid.Count = 0 Then

View File

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

View File

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

View File

@ -108,6 +108,20 @@ namespace EnvelopeGenerator.Web.Services
ToList(); 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) public List<Envelope> LoadEnvelopes(int pReceiverId)
{ {
return (List<Envelope>)envelopeModel.List(pReceiverId); return (List<Envelope>)envelopeModel.List(pReceiverId);

View File

@ -7,7 +7,7 @@
@functions { @functions {
string encodeEnvelopeKey(Envelope envelope) 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); return Helpers.EncodeEnvelopeReceiverId(envelope.Uuid, receiver.Signature);
} }
} }

View File

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