diff --git a/EnvelopeGenerator.ServiceHost/Jobs/FinalizeDocument/ReportCreator.cs b/EnvelopeGenerator.ServiceHost/Jobs/FinalizeDocument/ReportCreator.cs index 36107395..9ff9e190 100644 --- a/EnvelopeGenerator.ServiceHost/Jobs/FinalizeDocument/ReportCreator.cs +++ b/EnvelopeGenerator.ServiceHost/Jobs/FinalizeDocument/ReportCreator.cs @@ -1,6 +1,5 @@ using DevExpress.Xpo; using DigitalData.Core.Abstraction.Application.Repository; -using EnvelopeGenerator.Domain.Constants; using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.ServiceHost.Exceptions; @@ -16,7 +15,7 @@ public class ReportCreator(IRepository reportRepo) throw new CreateReportException("Could not prepare report data! No report data found!"); var items = reports - .Select(r => ToReportItem(r, envelope)) + .Select(r => new ReportItem(r, envelope)) .OrderByDescending(r => r.ItemDate) .ToList(); @@ -27,21 +26,4 @@ public class ReportCreator(IRepository reportRepo) report.ExportToPdf(stream); return stream.ToArray(); } - - private static ReportItem ToReportItem(EnvelopeReport report, Envelope envelope) - { - return new ReportItem - { - CreatorFullName = envelope.User is not null - ? $"{envelope.User.Prename} {envelope.User.Name}".Trim() - : string.Empty, - CreatorEmailAddress = envelope.User?.Email ?? string.Empty, - EnvelopeTitle = report.HeadTitle ?? string.Empty, - EnvelopeUuid = report.HeadUuid ?? string.Empty, - EnvelopeCertificationType = envelope.CertificationType is int certType ? ((CertificationType)certType).ToString() : "null", - ItemStatus = (EnvelopeStatus)report.PosStatus, - ItemUserReference = report.PosWho ?? string.Empty, - ItemDate = report.PosWhen ?? DateTime.MinValue - }; - } } \ No newline at end of file diff --git a/EnvelopeGenerator.ServiceHost/Jobs/FinalizeDocument/ReportItem.cs b/EnvelopeGenerator.ServiceHost/Jobs/FinalizeDocument/ReportItem.cs index 98dd94a4..e815a04e 100644 --- a/EnvelopeGenerator.ServiceHost/Jobs/FinalizeDocument/ReportItem.cs +++ b/EnvelopeGenerator.ServiceHost/Jobs/FinalizeDocument/ReportItem.cs @@ -1,9 +1,26 @@ using EnvelopeGenerator.Domain.Constants; +using EnvelopeGenerator.Domain.Entities; namespace EnvelopeGenerator.ServiceHost.Jobs.FinalizeDocument; public class ReportItem { + public ReportItem() { } + + public ReportItem(EnvelopeReport report, Envelope envelope) + { + CreatorFullName = envelope.User is not null + ? $"{envelope.User.Prename} {envelope.User.Name}".Trim() + : string.Empty; + CreatorEmailAddress = envelope.User?.Email ?? string.Empty; + EnvelopeTitle = report.HeadTitle ?? string.Empty; + EnvelopeUuid = report.HeadUuid ?? string.Empty; + EnvelopeCertificationType = envelope.CertificationType is int certType ? ((CertificationType)certType).ToString() : "null"; + ItemStatus = (EnvelopeStatus)report.PosStatus; + ItemUserReference = report.PosWho ?? string.Empty; + ItemDate = report.PosWhen ?? DateTime.MinValue; + } + // Header fields (from Envelope) public string CreatorFullName { get; set; } = string.Empty; public string CreatorEmailAddress { get; set; } = string.Empty;