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

@@ -2,6 +2,7 @@
using DigitalData.Modules.Logging;
using EnvelopeGenerator.Common;
using Microsoft.Extensions.Primitives;
using System.Reflection;
using System.Reflection.Metadata;
using System.Text;
@@ -39,9 +40,9 @@ namespace EnvelopeGenerator.Web.Services
if (string.IsNullOrEmpty(result.Item2))
throw new ArgumentNullException("ReceiverSignature");
EnvelopeResponse r = database.LoadEnvelope(envelopeKey);
EnvelopeResponse response = database.LoadEnvelope(envelopeKey);
return r;
return response;
}
public async Task<string?> EnsureValidAnnotationData(HttpRequest request)
@@ -118,10 +119,6 @@ namespace EnvelopeGenerator.Web.Services
}
public State GetState(LogConfig LogConfig, MSSQLServer Database)
{
return new State

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);
}
}
}