03-11-2023

This commit is contained in:
Jonathan Jenne
2023-11-03 14:12:24 +01:00
parent b08f13a7fd
commit 0b6eecc534
12 changed files with 133 additions and 404 deletions

View File

@@ -13,7 +13,7 @@ namespace EnvelopeGenerator.Web.Services
private ReceiverModel receiverModel;
private ElementModel elementModel;
private HistoryModel historyModel;
private DocumentStatusModel documentStatusModel;
private readonly LogConfig _logConfig;
private readonly Logger _logger;
@@ -56,6 +56,7 @@ namespace EnvelopeGenerator.Web.Services
receiverModel = new(state);
elementModel = new(state);
historyModel = new(state);
documentStatusModel = new(state);
}
public EnvelopeResponse LoadEnvelope(string pEnvelopeKey)
@@ -65,11 +66,28 @@ namespace EnvelopeGenerator.Web.Services
var receiverSignature = result.Item2;
var receiverId = receiverModel.GetReceiverIdBySignature(receiverSignature);
Envelope envelope = envelopeModel.GetByUuid(envelopeUuid);
Envelope? envelope = envelopeModel.GetByUuid(envelopeUuid);
if (envelope == null)
{
throw new NullReferenceException("Envelope not found");
}
if (envelope.Receivers == null)
{
throw new NullReferenceException("Receivers for envelope not loaded");
}
EnvelopeReceiver? receiver = envelope.Receivers.Where(r => r.Id == receiverId).SingleOrDefault();
if (receiver == null)
{
throw new NullReferenceException("Receiver not found");
}
return new()
{
ReceiverId = receiverId,
Receiver = receiver,
Envelope = envelope
};
}
@@ -89,5 +107,10 @@ namespace EnvelopeGenerator.Web.Services
return historyModel.Insert(historyEntry);
}
public bool InsertDocumentStatus(DocumentStatus documentStatus)
{
return documentStatusModel.InsertOrUpdate(documentStatus);
}
}
}