---
title: clsAgencyContractCollection
summary: API reference for clsAgencyContractCollection.
status: draft
owner: Technical Writer
last_reviewed: 2026-07-31
library: SAIF.Business.Policy.Agency
reference_type: package
---

# clsAgencyContractCollection

`clsAgencyContractCollection` is the BOF collection façade for agency-contract retrieval and filtering. It loads contract sets from `AGENCY_CONTRACT`, narrows them by date or contract type, and exposes the producer-commission subset used by agency eligibility logic.

## Purpose
- Retrieve all contracts or the contracts for one agency.
- Provide in-memory filters for active contracts, contract type, and producer-commission contracts.
- Support collection membership and removal operations keyed by contract identity.

## Context
- Namespace: `SAIF.Business.Policy.Agency`
- Assembly/package: `SAIF.Business.Policy.Agency`

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `Item` (index) | `Default Public ReadOnly Property Item(ByVal Index As Integer) As clsAgencyContract` | Returns the contract at the given zero-based position in the collection. |
| `Item` (agency seq) | `Default Public ReadOnly Property Item(ByVal inAgencySeqNum As Decimal) As clsAgencyContract` | Looks up the first contract in the collection belonging to the given agency sequence number. |
| `CurrentItem` | `Public Shadows ReadOnly Property CurrentItem() As clsAgencyContract` | Returns the contract at the collection's current cursor position, typed as `clsAgencyContract` rather than the base collection's untyped current item. |
| `Active` | `Public ReadOnly Property Active(ByVal inDate As Date) As clsAgencyContractCollection` | Returns only contracts active on the requested date. |
| `ContractType` | `Public ReadOnly Property ContractType(ByVal inContractType As clsAgencyContract.AgencyContractTypes) As clsAgencyContractCollection` | Returns only contracts matching one appointment classification. |
| `ProducerCommissionContracts` | `Public ReadOnly Property ProducerCommissionContracts() As clsAgencyContractCollection` | Returns only contracts that qualify for producer commissions. |
| `Add` | `Public Shadows Function Add(ByVal inAgencyContract As clsAgencyContract) As Integer` | Adds a contract to the collection and returns its list position. |
| `Contains` (contract) | `Public Overloads Function Contains(ByVal inAgencyContract As clsAgencyContract) As Boolean` | Reports whether a contract instance is already present. |
| `Contains` (agency seq) | `Public Overloads Function Contains(ByVal inAgencySeqNum As Decimal) As Boolean` | Reports whether a contract belonging to the given agency is already present. |
| `ContainsDeleted` (contract) | `Public Overloads Function ContainsDeleted(ByVal inAgencyContract As clsAgencyContract) As Boolean` | Reports whether a contract instance is present in the deleted-items set. |
| `ContainsDeleted` (agency seq) | `Public Overloads Function ContainsDeleted(ByVal inAgencySeqNum As Decimal) As Boolean` | Reports whether a deleted contract matching the given agency sequence number is present in the deleted-items set. |
| `Remove` (contract) | `Public Sub Remove(ByVal inAgencyContract As clsAgencyContract)` | Removes a specific contract instance from the collection. |
| `Remove` (agency seq) | `Public Sub Remove(ByVal inAgencySeqNum As Decimal)` | Removes a contract by identity from the collection. |
| `GetAgencyContractCollection` (by agency) | `Public Shared Function GetAgencyContractCollection(ByVal inDataportal As IDataPortalInfo, ByVal inAgencySeqNum As Decimal) As clsAgencyContractCollection` | Retrieves all contracts belonging to a single agency. |
| `GetAgencyContractCollection` (all) | `Public Shared Function GetAgencyContractCollection(ByVal inDataportal As IDataPortalInfo) As clsAgencyContractCollection` | Retrieves every contract row across all agencies. |

## Inherited public members

Members in this section are inherited from `clsBusinessCollectionBase` in `SAIF.Framework.Core`. They are available on this type through inheritance.

| Member | Signature | Purpose | Origin |
| --- | --- | --- | --- |
| `First` | `Sub First()` | Moves the collection cursor to the first contract.* | `SAIF.Framework.Core` — `clsBusinessCollectionBase` |
| `Last` | `Sub Last()` | Moves the collection cursor to the last contract.* | `SAIF.Framework.Core` — `clsBusinessCollectionBase` |
| `Next` | `Sub Next()` | Advances the collection cursor.* | `SAIF.Framework.Core` — `clsBusinessCollectionBase` |
| `Previous` | `Sub Previous()` | Moves the collection cursor backward.* | `SAIF.Framework.Core` — `clsBusinessCollectionBase` |
| `SetCurrent` | `Sub SetCurrent(item As Object)` | Assigns the current-item position used by BOF traversal helpers.* | `SAIF.Framework.Core` — `clsBusinessCollectionBase` |
| `Traverse` | `Sub Traverse(inDirection As TraverseDirection)` (via `ITraversion`) | Advances the cursor according to a supplied direction/step.* | `SAIF.Framework.Core` — `clsBusinessCollectionBase` |
| `Error` | `ReadOnly Property Error As String` (via `IDataErrorInfo`) | Returns a summary validation-error message aggregated across collection items.* | `SAIF.Framework.Core` — `clsBusinessCollectionBase` |
| `Item(columnName)` | `ReadOnly Property Item(columnName As String) As String` (via `IDataErrorInfo`) | Returns a per-property validation-error message for the collection.* | `SAIF.Framework.Core` — `clsBusinessCollectionBase` |
| `DeletedCollection` | `Protected Class DeletedCollection` (inherits `CollectionBase`) | Tracks items removed from the collection for inclusion in save/delete operations.* | `SAIF.Framework.Core` — `clsBusinessCollectionBase` |
| `SortDirection` | `ReadOnly Property SortDirection() As ListSortDirection` | Returns the direction of the most recent sort.* | `SAIF.Framework.Core` — `clsSortableCollectionBase` |
| `SortProperty` | `ReadOnly Property SortProperty() As String` | Returns the name of the property the collection is currently sorted by.* | `SAIF.Framework.Core` — `clsSortableCollectionBase` |
| `Sort` / `SortMulti` | `Sub Sort(aProp As String, [aDir As ListSortDirection = Ascending], [stable As StableSortSetting = Default])` / `Sub SortMulti(aParms() As SortParm)` | Sorts the collection by one property, or by multiple properties in sequence using a stable sort.* | `SAIF.Framework.Core` — `clsSortableCollectionBase` |
| `Find` / `FindMulti` / `BinarySearch` | `Function Find(aProp As String, aKey As Object) As Integer` / `Function FindMulti(aParms() As FindParm) As Integer` / `Function BinarySearch(aProp As String, aKey As Object) As Integer` | Locates an item by one or more property/value pairs, or by binary search on an already-sorted collection.* | `SAIF.Framework.Core` — `clsSortableCollectionBase` |
| `Shuffle` | `Sub Shuffle()` | Randomizes item order.* | `SAIF.Framework.Core` — `clsSortableCollectionBase` |
| `RemoveLinks` / `LinkItems` | `Sub RemoveLinks()` / `Sub LinkItems()` | Manages a doubly linked list across `ILinkItem` children so siblings can reference each other.* | `SAIF.Framework.Core` — `clsSortableCollectionBase` |

## Behavioral notes
- The retrieval path can return all contracts or only one agency's contracts, depending on whether `AgencySeqNum` is present.
- Producer-commission filtering depends on the nested commission classification enum rather than a dedicated Boolean flag.

## Constraints and usage notes
- The collection is retrieve-only; persistence helpers are not implemented.

> **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
- `Business\SAIF.Business.Policy.Agency\clsAgencyContractCollection.vb`
