ReportingService¶
Implements IReportingService, driving the batch certificate print/distribution run: it pulls certificates ready for distribution (via ICertificateService), splits recipients by delivery preference (ICertificatePreferenceService) into mail-vs-email/fax groups, generates and images PDF certificate and summary-list reports (via the certificate IDocumentService and the utility SAIF.Core.Services.Documents.IDocumentService), sends email/fax copies directly to policyholders whose preference is Email or Fax (via IEmailService/IFaxService), writes progress and control-report lines to a supplied ILogWriter, and marks processed certificates as printed for the certificate-holder copy, the policyholder copy, or both — all print/imaging/update work for the mail-delivery path is wrapped in a single IUnitOfWork transaction per batch run.
Purpose¶
- Orchestrates a full certificate batch-print run: selecting eligible certificates, branching by delivery method, generating certificate and summary reports, submitting them to imaging, emailing/faxing where applicable, and marking certificates as printed.
- Generates and delivers an individual policy's renewal certificate report or renewal summary report to its policyholder by email or fax, immediately marking those certificates' policyholder-copy print status inside its own transaction.
- Updates a certificate's certificate-holder print status, policyholder print status, or both, recording the print/imaging status change against the underlying data record.
Context¶
- Namespace:
SAIF.Services.Policies.Certificates - Assembly/package:
SAIF.Services(packaged inside theSAIF.SAIFCode.CoreNuGet package).
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| ReportingService (constructor) | public ReportingService(IUnitOfWork unitOfWork, ICertDocumentService certificateDocumentService, ICertificateService certificateService, ICertificatePreferenceService certificatePreferenceService, IEmailService emailService, IFaxService faxService, UtilDocument.IDocumentService utilDocumentService) |
Wires the unit of work, certificate document service, certificate service, preference service, email/fax services, and the utility document/imaging service used throughout the batch reporting workflow. |
| GenerateCertificateBatchReports | public CertificateBatchPrintResult GenerateCertificateBatchReports(CertificateBatchPrintArguments batchPrintArguments, ILogWriter controlReport) |
Retrieves all certificates ready for batch distribution via ICertificateService.GetCertificatesReadyForBatchDistribution and delegates to the overload that processes an explicit certificate list. |
| GenerateCertificateBatchReports (overload) | public CertificateBatchPrintResult GenerateCertificateBatchReports(CertificateBatchPrintArguments batchPrintArguments, IList<Certificate> certificatesToProcess, ILogWriter controlReport) |
Runs the full batch: writes control-report progress lines, exits early if no certificates need printing, splits certificates by delivery preference into email/fax vs. mail groups, sends email/fax copies immediately, then — inside a single transaction — generates the printed certificate report and printed summary report, marks all mail-delivered certificates as printed (both copies), commits, and returns counts of certificate reports and summary reports generated. |
| GenerateCertificateReportForPolicy | public void GenerateCertificateReportForPolicy(CertificatePreference policyPreference, IList<Certificate> certificates, CertificateBatchPrintArguments batchPrintArguments, ILogWriter controlReport) |
For a single policy's certificate list (no-ops if empty), generates the policyholder-copy PDF stream, submits it to imaging with a "Renewal Certificates" comment, writes a control-report line per certificate, sends the report to the policyholder via email or fax based on their delivery preference, then transactionally marks the certificates' policyholder-copy print status as printed. |
| GenerateCertificateSummaryReportForPolicy | public void GenerateCertificateSummaryReportForPolicy(CertificatePreference policyPreference, IList<Certificate> certificateSummaryList, string updateUser, ILogWriter controlReport) |
For a single policy's renewal-summary certificate list (no-ops if empty), generates the summary-report PDF stream, submits it to imaging with an "OSC summary list" or "Renewal summary list" comment depending on certificate type, writes a control-report line per certificate, sends the report to the policyholder via email or fax, then transactionally marks the certificates' policyholder-copy print status as printed. |
| UpdateCertificatesAsPrinted | public void UpdateCertificatesAsPrinted(IEnumerable<Certificate> certificatesToUpdate, WhichPrintStatus whichPrintStatus, string updateUser) |
Iterates the given certificates and marks each one's certificate-holder print status, policyholder print status, or both (per whichPrintStatus) as Printed, stamping the underlying data record's update user and update date. |
Behavioral notes¶
GenerateCertificateBatchReports(list overload) returns an emptyCertificateBatchPrintResultimmediately, after logging "No data found - application terminating.", when there are no certificates ready to print for either the certificate-holder or policyholder copy.- The email/fax delivery path (
GenerateEmailAndFaxReportsForPolicy, private) is executed outside the main transaction, beforeunitOfWork.Begin(), while the mail/print/imaging path runs inside the transaction — so an email/fax send failure does not roll back any already-completed send, but a failure during the mail/imaging/update phase does.* SendReportToPolicyHolder(private) does nothing if the generated stream has zero length, and otherwise dispatches viaCertificateEmailer.SendEmailstoStakeHoldersforEmailpreference or builds aFaxConfig/FaxRecipient(prefixing the fax number with"91") forFaxpreference.GenerateCertificateReportForPolicyandGenerateCertificateSummaryReportForPolicyeach open and commit their ownunitOfWorktransaction after sending the report, separate from the transaction used by the mainGenerateCertificateBatchReportsbatch run.- A source comment documents a prior production fix ("marbur 9/25/14") that corrected an over-aggressive LINQ filter excluding non-renewal and certificate-holder certificates from the printed certificate report.
Constraints and usage notes¶
- The nested
WhichPrintStatusenum (Certificate,Policyholder,Both) controls which print-status field(s)UpdateCertificatesAsPrinted/MarkCertificateAsPrintedupdate; see theWhichPrintStatusreference page for its full member list. - Callers driving
GenerateCertificateReportForPolicy/GenerateCertificateSummaryReportForPolicydirectly (outside the batch run) are responsible for ensuring the certificate list belongs to a single policy, since imaging and mailing metadata are derived from the first certificate in the list.*
Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.
Sources¶
Services/SAIF.Services/Policies/Certificates/ReportingService.cs