Skip to content

DocumentParameterService

Implements IDocumentParameterService, managing the document-template parameter definitions and the per-request parameter values derived from them (creating default request parameters from a template, saving edited values, and — in a partially disabled state — loading claim data into request parameters), all via IUnitOfWork. It is constructed with a primary IUnitOfWork, a second (currently unused) claim-scoped IUnitOfWork, and IUserProfileService, and registers its DocumentTemplateParameter/DocumentRequestParameter/address AutoMapper maps in a static constructor.

Purpose

  • Retrieves the ordered parameter definitions for a document template, and the stored parameter values for a specific document request.
  • Seeds a new document request's parameters from its template's default values, persisting them in one transaction.
  • Saves only the changed values among a set of document request parameters, stamping update user/date/number.
  • Determines whether a request's parameters require vocational-coordinator selection.
  • Loads the vocational coordinators list from a flat file on disk.

Context

  • Namespace: SAIF.Services.Documents
  • Assembly/package: SAIF.Services (packaged inside the SAIF.SAIFCode.Core NuGet package)

Public members

Member Signature Purpose
DocumentParameterService(...) public DocumentParameterService(IUnitOfWork unitOfWork, IUnitOfWork unitOfWorkClaim, IUserProfileService userProfileService) Stores the primary unit of work and user-profile collaborator (the claim-scoped unit of work is accepted but not retained), requiring unitOfWork and userProfileService to be non-null.
GetDocumentTemplateParameters public IList<DocumentTemplateParameter> GetDocumentTemplateParameters(long inTemplateId) Returns the parameter definitions for template inTemplateId, ordered by parameter number, mapped to contract objects.
GetDocumentRequestParameters public IList<DocumentRequestParameter> GetDocumentRequestParameters(long inRequestId) Returns the stored parameter values for request inRequestId, ordered by parameter number, mapped to contract objects.
StoreOriginalDocumentRequestParameters public IList<DocumentRequestParameter> StoreOriginalDocumentRequestParameters(long inRequestId, long inTemplateId) Copies each of the template's parameter definitions into new request-parameter rows (using the default value, or blank when the default is the literal "nodefault") for inRequestId, commits them in one transaction, and returns the resulting request parameters.
SaveChangedDocumentRequestParameters public void SaveChangedDocumentRequestParameters(IList<DocumentRequestParameter> theDocumentParameters) For each supplied parameter whose value differs from the stored value, updates the stored ValueTxt, update user, update date, and increments UpdateNumber, committing all changes in one transaction.
NeedVocCoordinators public Boolean NeedVocCoordinators(long inRequestId) Returns true when request inRequestId has a stored parameter with data type "SELECTVOC", indicating the UI must present vocational-coordinator selection.
GetVocationalCoordinators public IList<Contract.VocationalCoordinator> GetVocationalCoordinators() Reads a fixed local file (C:\Downloads\vocAlpha.txt), parsing each tilde-delimited line into a VocationalCoordinator (name, employer, address, phone, fax, email).
LoadClaimDataToRequestParameters public void LoadClaimDataToRequestParameters(IList<DocumentRequestParameter> theDocumentParameters, long inClaimId) Intended to populate "CLM"-typed parameters from claim detail XML and save the changes, but the claim-data retrieval is currently disabled, so this is effectively a no-op given the code as written*.

Behavioral notes

  • GetVocationalCoordinators reuses a single oneCoordinator instance across all parsed lines and adds the same reference to the result list repeatedly, meaning every entry in the returned list reflects only the last parsed line's values**.
  • LoadClaimDataToRequestParameters's claim-detail XML retrieval is entirely commented out (claimDetailXml is always null), so the method currently never updates any parameters or calls SaveChangedDocumentRequestParameters**.
  • StoreOriginalDocumentRequestParameters and SaveChangedDocumentRequestParameters wrap their writes in UnitOfWork.Begin()/Commit(), rethrowing a wrapped Exception on failure in the former.

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/Documents/DocumentParameterService.cs