Added status methods in histroy service
This commit is contained in:
parent
efcd254749
commit
4f61f1b6cb
@ -11,5 +11,7 @@ namespace EnvelopeGenerator.Application.Contracts
|
|||||||
Task<int> CountAsync(int? envelopeId = null, string? userReference = null, int? status = null);
|
Task<int> CountAsync(int? envelopeId = null, string? userReference = null, int? status = null);
|
||||||
|
|
||||||
Task<bool> AccessCodeAlreadyRequested(int envelopeId, string userReference);
|
Task<bool> AccessCodeAlreadyRequested(int envelopeId, string userReference);
|
||||||
|
|
||||||
|
Task<bool> IsSigned(int envelopeId, string userReference);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -19,6 +19,19 @@ namespace EnvelopeGenerator.Application.Services
|
|||||||
|
|
||||||
public async Task<int> CountAsync(int? envelopeId = null, string? userReference = null, int? status = null) => await _repository.CountAsync(envelopeId: envelopeId, userReference: userReference, status: status);
|
public async Task<int> CountAsync(int? envelopeId = null, string? userReference = null, int? status = null) => await _repository.CountAsync(envelopeId: envelopeId, userReference: userReference, status: status);
|
||||||
|
|
||||||
public async Task<bool> AccessCodeAlreadyRequested(int envelopeId, string userReference) => await _repository.CountAsync(envelopeId: envelopeId, userReference:userReference, status: (int) EnvelopeStatus.AccessCodeRequested) > 0;
|
public async Task<bool> HasStatus(EnvelopeStatus status, int envelopeId, string userReference) => await _repository.CountAsync(
|
||||||
|
envelopeId: envelopeId,
|
||||||
|
userReference: userReference,
|
||||||
|
status: (int) status) > 0;
|
||||||
|
|
||||||
|
public async Task<bool> AccessCodeAlreadyRequested(int envelopeId, string userReference) => await _repository.CountAsync(
|
||||||
|
envelopeId: envelopeId,
|
||||||
|
userReference:userReference,
|
||||||
|
status: (int) EnvelopeStatus.AccessCodeRequested) > 0;
|
||||||
|
|
||||||
|
public async Task<bool> IsSigned(int envelopeId, string userReference) => await _repository.CountAsync(
|
||||||
|
envelopeId: envelopeId,
|
||||||
|
userReference: userReference,
|
||||||
|
status: (int) EnvelopeStatus.DocumentSigned) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,9 +120,7 @@
|
|||||||
<Compile Include="frmFinalizePDF.Designer.vb">
|
<Compile Include="frmFinalizePDF.Designer.vb">
|
||||||
<DependentUpon>frmFinalizePDF.vb</DependentUpon>
|
<DependentUpon>frmFinalizePDF.vb</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="frmFinalizePDF.vb">
|
<Compile Include="frmFinalizePDF.vb" />
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="frmReportViewer.Designer.vb">
|
<Compile Include="frmReportViewer.Designer.vb">
|
||||||
<DependentUpon>frmReportViewer.vb</DependentUpon>
|
<DependentUpon>frmReportViewer.vb</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|||||||
@ -119,19 +119,18 @@ namespace EnvelopeGenerator.Web.Controllers
|
|||||||
EnvelopeResponse response = await envelopeOldService.LoadEnvelope(envelopeReceiverId);
|
EnvelopeResponse response = await envelopeOldService.LoadEnvelope(envelopeReceiverId);
|
||||||
if (isVerified)
|
if (isVerified)
|
||||||
{
|
{
|
||||||
//todo: write using crud-service (mostlikely history-service) to make it async
|
|
||||||
if (envelopeOldService.ReceiverAlreadySigned(response.Envelope, response.Receiver.Id))
|
|
||||||
{
|
|
||||||
return View("EnvelopeSigned");
|
|
||||||
}
|
|
||||||
|
|
||||||
database.Services.actionService.EnterCorrectAccessCode(response.Envelope, response.Receiver); //for history
|
database.Services.actionService.EnterCorrectAccessCode(response.Envelope, response.Receiver); //for history
|
||||||
ViewData["EnvelopeKey"] = envelopeReceiverId;
|
ViewData["EnvelopeKey"] = envelopeReceiverId;
|
||||||
ViewData["EnvelopeResponse"] = response;
|
|
||||||
|
|
||||||
return await _envRcvService.ReadByUuidSignatureAsync(uuid: uuid, signature: signature).ThenAsync<EnvelopeReceiverDto, IActionResult>(
|
return await _envRcvService.ReadByUuidSignatureAsync(uuid: uuid, signature: signature).ThenAsync<EnvelopeReceiverDto, IActionResult>(
|
||||||
SuccessAsync: async er =>
|
SuccessAsync: async er =>
|
||||||
{
|
{
|
||||||
|
if(await _historyService.IsSigned(envelopeId: er.Envelope!.Id, userReference: er.Receiver!.EmailAddress))
|
||||||
|
return View("EnvelopeSigned");
|
||||||
|
|
||||||
|
database.Services.actionService.EnterCorrectAccessCode(response.Envelope, response.Receiver); //for history
|
||||||
|
ViewData["EnvelopeKey"] = envelopeReceiverId;
|
||||||
|
|
||||||
if (response.Envelope.Documents.Count() > 0)
|
if (response.Envelope.Documents.Count() > 0)
|
||||||
{
|
{
|
||||||
var document = await envelopeOldService.GetDocument(response.Envelope.Documents[0].Id, envelopeReceiverId);
|
var document = await envelopeOldService.GetDocument(response.Envelope.Documents[0].Id, envelopeReceiverId);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user