Skip to content

Determine an agency's contract type on a date

This operation derives an agency-level contract classification by filtering the agency's loaded contracts to those active on a requested date and returning the first surviving contract type.

Field Value
Operation ID OP-005
Trigger A caller invokes clsAgency.ContractType(inDate).
Inputs clsAgency, as-of date
Outputs AgencyContractTypes value
Primary components clsAgency.ContractType, clsAgency.Contracts, clsAgencyContractCollection.Active
Entry point Business\SAIF.Business.Policy.Agency\clsAgency.vb

Steps

  1. Ensure the agency's Contracts collection is available, lazily loading it through Retrieve agency contracts when necessary.
  2. Filter the contracts to those active on the requested date (BR-008).
  3. If at least one active contract remains, return the first contract's domain contract type.
  4. If no active contract remains, return AgencyContractTypes.Unassigned (BR-009).
  5. When lazy loading is required, the contract retrieve executes SQL-004 against AGENCY_CONTRACT.

Process flow

The following diagram visualizes the contract-type decision.

flowchart TD
  Start([ContractType]) --> Load[Ensure contracts loaded]
  Load --> Filter[Filter active contracts]
  Filter --> Any{Any active contract?}
  Any -->|Yes| First[Return first contract type]
  Any -->|No| Unassigned[Return Unassigned]

Failure and edge-case behavior

  • The operation depends on the ordering of the loaded contract collection when multiple active contracts exist on the same date.

Sources

  • Business\SAIF.Business.Policy.Agency\clsAgency.vb
  • Business\SAIF.Business.Policy.Agency\clsAgencyContractCollection.vb