Skip to content

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

  1. Load all eligibility periods for the beneficiary. GetEligibilityPeriodsForBeneficiary runs the collection query ordered by descending effective date, creates a clsAwardEligibility child for each row, and adds it to the managed list (SQL-005, CL_AWARD_ELIGIBILITY).
  2. Resolve the current period from the loaded set. CurrentPeriod first 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.
  3. Create a new eligibility period when requested. clsAwardEligibility.Create seeds the new child with the parent PersonID, today's date as the effective date, an empty expiration date, an empty benefit note, and zeroed update metadata.
  4. 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).
  5. 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).
  6. Persist inserts, updates, and deletes through managed child saves. clsAwardEligibilityCollection.Save calls ApplyEdit() 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).
  7. 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).
  8. Refresh collection ordering and current-period cache. Every add or remove re-sorts the collection by effective date descending and clears the cached CurrentPeriod reference 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

  • AwardEligExpDate reads as Date.MaxValue when 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.IsValid returns True for deleted objects.
  • If no currently effective period exists, CurrentPeriod falls back to the latest effective-dated row already loaded rather than returning Nothing.
  • Insert and update operations stamp the acting user from DataPortalInfo.UserID immediately before the SQL request is built.

Sources

  • Business\SAIF.Business.Claim.Person\clsAwardEligibility.vb
  • Business\SAIF.Business.Claim.Person\clsAwardEligibilityCollection.vb