refactor: simplify AddReportBehavior by making DoCreateReport static and reordering base64 conversion
This commit is contained in:
parent
e1aa7fe650
commit
ff60cd7ef8
@ -39,7 +39,6 @@ public class AddReportBehavior : IPipelineBehavior<BurnPdfCommand, byte[]>
|
|||||||
public async Task<byte[]> Handle(BurnPdfCommand request, RequestHandlerDelegate<byte[]> next, CancellationToken cancel)
|
public async Task<byte[]> Handle(BurnPdfCommand request, RequestHandlerDelegate<byte[]> next, CancellationToken cancel)
|
||||||
{
|
{
|
||||||
var docResult = await next(cancel);
|
var docResult = await next(cancel);
|
||||||
var base64 = Convert.ToBase64String(docResult);
|
|
||||||
|
|
||||||
if (!request.Debug)
|
if (!request.Debug)
|
||||||
await _sender.Send(new CreateHistoryCommand()
|
await _sender.Send(new CreateHistoryCommand()
|
||||||
@ -51,6 +50,8 @@ public class AddReportBehavior : IPipelineBehavior<BurnPdfCommand, byte[]>
|
|||||||
|
|
||||||
docResult = await CreateReport(request.Envelope!, cancel);
|
docResult = await CreateReport(request.Envelope!, cancel);
|
||||||
|
|
||||||
|
var base64 = Convert.ToBase64String(docResult);
|
||||||
|
|
||||||
return docResult;
|
return docResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,12 +71,12 @@ public class AddReportBehavior : IPipelineBehavior<BurnPdfCommand, byte[]>
|
|||||||
throw new CreateReportException("No report data found!");
|
throw new CreateReportException("No report data found!");
|
||||||
}
|
}
|
||||||
|
|
||||||
var oBuffer = DoCreateReport(oItems);
|
var oBuffer = AddReportBehavior.DoCreateReport(oItems);
|
||||||
|
|
||||||
return oBuffer;
|
return oBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] DoCreateReport(IEnumerable<EnvelopeReport> oItems)
|
private static byte[] DoCreateReport(IEnumerable<EnvelopeReport> oItems)
|
||||||
{
|
{
|
||||||
var oSource = new ReportSource { Items = oItems };
|
var oSource = new ReportSource { Items = oItems };
|
||||||
var oReport = new rptEnvelopeHistory
|
var oReport = new rptEnvelopeHistory
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user