Award eligibility management¶
Award eligibility management loads every eligibility period for one beneficiary, derives the current period from the loaded set, validates date-boundary and overlap rules, and saves row-level inserts, updates, and deletes to the award eligibility table. The child rows are managed under the beneficiary object, so birth-date and death-date validation reads parent beneficiary state during save.
| Field | Value |
|---|---|
| Operation ID | OP-PER-05 |
| Trigger | Caller retrieves award eligibility for a beneficiary, edits periods, and calls Save() on the collection |
| Inputs | PersonID; period fields AwardEligEffDate, AwardEligExpDate, BenefitNoteText; beneficiary BirthDate and DeathDate; acting user from DataPortalInfo.UserID |
| Outputs | In-memory eligibility-period collection; computed current period; persisted inserts, updates, or deletes in CL_AWARD_ELIGIBILITY; broken rules and DB-contention messages |
| Primary components | clsAwardEligibilityCollection.GetEligibilityPeriodsForBeneficiary, clsAwardEligibilityCollection.CurrentPeriod, clsAwardEligibility.BeforeInsert, clsAwardEligibility.BeforeUpdate, clsAwardEligibility.BeforeDelete |
| Entry point | Business\SAIF.Business.Claim.Person\clsAwardEligibilityCollection.vb |
Steps¶
- Load all eligibility periods for the beneficiary.
GetEligibilityPeriodsForBeneficiaryruns the collection query ordered by descending effective date, creates aclsAwardEligibilitychild for each row, and adds it to the managed list (SQL-005, CL_AWARD_ELIGIBILITY). - Resolve the current period from the loaded set.
CurrentPeriodfirst looks for a period whose effective date is on or before today and whose expiration date is blank or on or after today; if none qualifies, it falls back to the latest effective-dated period already in memory. - Create a new eligibility period when requested.
clsAwardEligibility.Createseeds the new child with the parentPersonID, today's date as the effective date, an empty expiration date, an empty benefit note, and zeroed update metadata. - Validate each period's date boundaries. The child rules require an effective date, reject expiration dates before the effective date, reject periods that start before the beneficiary birth date, and reject periods that run past the beneficiary death date (BR-PER-010, BR-PER-011, BR-PER-012, BR-PER-013).
- Validate collection-wide overlap rules. The collection-level rule compares each period to every other period and blocks save when any period contains, starts inside, or ends inside another period's date range (BR-PER-014).
- Persist inserts, updates, and deletes through managed child saves.
clsAwardEligibilityCollection.SavecallsApplyEdit()and delegates row persistence to the child objects, which issue insert, update, or delete SQL as needed (BR-PER-001, SQL-001, SQL-015, SQL-020, CL_AWARD_ELIGIBILITY). - Convert zero-row results into contention errors. After delete or update, the child adds a DB-contention error when the database reports zero affected rows; after insert, it requires exactly one affected row and otherwise adds the same error (BR-PER-001).
- Refresh collection ordering and current-period cache. Every add or remove re-sorts the collection by effective date descending and clears the cached
CurrentPeriodreference so the next read re-evaluates the loaded periods.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Load beneficiary eligibility periods]) --> Read[Retrieve periods ordered by effective date]
Read --> Change{Add, edit, or delete a period?}
Change -->|Add| NewPeriod[Initialize default period]
Change -->|Edit| Validate[Validate period and collection]
Change -->|Delete| DeletePeriod[Queue child delete]
NewPeriod --> Validate
Validate --> Valid{Validation passes?}
Valid -->|No| Fail([Broken rules returned])
Valid -->|Yes| Save[Run managed child save]
DeletePeriod --> Save
Save --> Rows{Expected rows affected?}
Rows -->|No| Contention([Add DB-contention message])
Rows -->|Yes| Done([Save completes and cache resets])
Failure and edge-case behavior¶
AwardEligExpDatereads asDate.MaxValuewhen the underlying smart date is empty, so open-ended periods participate in overlap checks as far-future ranges.- Deleted rows bypass child validation because
clsAwardEligibility.IsValidreturnsTruefor deleted objects. - If no currently effective period exists,
CurrentPeriodfalls back to the latest effective-dated row already loaded rather than returningNothing. - Insert and update operations stamp the acting user from
DataPortalInfo.UserIDimmediately before the SQL request is built.
Related documentation¶
Sources¶
Business\SAIF.Business.Claim.Person\clsAwardEligibility.vbBusiness\SAIF.Business.Claim.Person\clsAwardEligibilityCollection.vb