Updated ReportCreator and ReportItem to accept EnvelopeDto instead of Envelope, promoting better separation of concerns and improved data handling via DTOs.
38 lines
1.6 KiB
C#
38 lines
1.6 KiB
C#
using EnvelopeGenerator.Application.Common.Dto;
|
|
using EnvelopeGenerator.Domain.Constants;
|
|
using EnvelopeGenerator.Domain.Entities;
|
|
|
|
namespace EnvelopeGenerator.ServiceHost.Jobs.FinalizeDocument;
|
|
|
|
public class ReportItem
|
|
{
|
|
public ReportItem() { }
|
|
|
|
public ReportItem(EnvelopeReport report, EnvelopeDto 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;
|
|
public string EnvelopeTitle { get; set; } = string.Empty;
|
|
public string EnvelopeUuid { get; set; } = string.Empty;
|
|
public string EnvelopeCertificationType { get; set; } = string.Empty;
|
|
|
|
// Detail fields (from EnvelopeReport)
|
|
public EnvelopeStatus ItemStatus { get; set; }
|
|
public string ItemStatusTranslated => ItemStatus.ToString();
|
|
public string ItemUserReference { get; set; } = string.Empty;
|
|
public DateTime ItemDate { get; set; }
|
|
}
|