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

# clsPolicyPreferredWorkerCollection

Collection façade for retrieving the preferred workers on a policy across an optional date window.

## Purpose
- Load preferred-worker policy associations from the shared association/person SQL fragments.
- Provide collection search and removal helpers over the in-memory result set.

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

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| CurrentItem | `Public Shadows ReadOnly Property CurrentItem() As clsPolicyPreferredWorker` | Gives the framework's traversal pointer back as a typed preferred worker, so callers walking the list with the BOF cursor reach eligibility members without casting — and touching those members triggers that worker's own eligibility query. |
| Add | `Public Shadows Function Add(ByVal inPolicyPreferredWorker As clsPolicyPreferredWorker) As Integer` | Appends a worker to the in-memory list only; with no insert SQL in this library, an added worker is never written to `BUSINESS_AFFILIATE` and disappears with the collection. |
| Contains | `Public Overloads Function Contains(ByVal inPolicyPreferredWorker As clsPolicyPreferredWorker) As Boolean` | Scans the live list for a worker matching the supplied object on policy, SSN, and effective date, so the same person on another policy period is not treated as already present. |
| Contains | `Public Overloads Function Contains(ByVal inPolicyNumber As Decimal, ByVal inAffiliateID As String, ByVal inEffectiveDate As Date) As Boolean` | Answers the same membership question from loose key values, letting callers test whether a policy period already carries that preferred worker without constructing an object first. |
| ContainsDeleted | `Public Overloads Function ContainsDeleted(ByVal inPolicyPreferredWorker As clsPolicyPreferredWorker) As Boolean` | Searches the framework's removed-items list instead of the live list, distinguishing a worker that was never in the result set from one removed during this session. |
| ContainsDeleted | `Public Overloads Function ContainsDeleted(ByVal inPolicyNumber As Decimal, ByVal inAffiliateID As String, ByVal inEffectiveDate As Date) As Boolean` | Answers the removed-items question from loose key values, matching on the same three-part association key. |
| Remove | `Public Sub Remove(ByVal inPolicyPreferredWorker As clsPolicyPreferredWorker)` | Drops the given worker from the in-memory list; the underlying association row survives, since this library exposes no delete SQL. |
| Remove | `Public Sub Remove(ByVal inPolicyNumber As Decimal, ByVal inAffiliateID As String, ByVal inEffectiveDate As Date)` | Finds the worker matching a three-part key and drops the first match from the in-memory list, leaving the database row untouched. |
| Where | `Public Function Where(ByVal match As Predicate(Of clsPolicyPreferredWorker)) As clsPolicyPreferredWorkerCollection` | Produces a new typed collection of the workers satisfying a caller's test, so filtered results keep the collection surface instead of degrading to a plain sequence. |
| GetPolicyPreferredWorkerCollection | `Public Shared Function GetPolicyPreferredWorkerCollection(ByVal inDataportal As IDataPortalInfo, ByVal inPolicyNumber As Decimal) As clsPolicyPreferredWorkerCollection` | Superseded name kept for existing callers: forwards unchanged to `GetPolicyPreferredWorkers` and behaves identically, so migrating is a rename with no behavioral difference. |
| GetPolicyPreferredWorkerCollection | `Public Shared Function GetPolicyPreferredWorkerCollection(ByVal inDataportal As IDataPortalInfo, ByVal inPolicyNumber As Decimal, ByVal inStartDate As Date, ByVal inEndDate As Date) As clsPolicyPreferredWorkerCollection` | Superseded windowed name kept for existing callers: forwards unchanged to the windowed `GetPolicyPreferredWorkers` overload with the same overlap semantics. |
| GetPolicyPreferredWorkers | `Public Shared Function GetPolicyPreferredWorkers(ByVal inDataportal As IDataPortalInfo, ByVal inPolicyNumber As Decimal) As clsPolicyPreferredWorkerCollection` | Loads every preferred-worker attachment ever recorded on the policy — the date window defaults to the widest possible range — admitting only type-`2` association rows, each hydrated with its person and ordered by name. |
| GetPolicyPreferredWorkers | `Public Shared Function GetPolicyPreferredWorkers(ByVal inDataportal As IDataPortalInfo, ByVal inPolicyNumber As Decimal, ByVal inStartDate As Date, ByVal inEndDate As Date) As clsPolicyPreferredWorkerCollection` | Loads the preferred-worker attachments overlapping the requested window — effective before the window ends and not cancelled before it starts, with still-open attachments always counted — without touching preferred-worker eligibility data, which each worker fetches on demand. |

## Inherited public members

Members in this table whose Origin is `SAIF.Framework.Core` were retrieved from that library's documentation via the Legends CLI; the Origin column identifies the originating class for each member.

| Member | Signature | Purpose | Origin |
| --- | --- | --- | --- |
| First | `Sub First()` | Moves the current-item pointer to the first item in the BOF collection. | `SAIF.Framework.Core` — `clsBusinessCollectionBase` |
| Last | `Sub Last()` | Moves the current-item pointer to the last item in the BOF collection. | `SAIF.Framework.Core` — `clsBusinessCollectionBase` |
| Next | `Sub Next()` | Advances the current-item pointer to the next item. | `SAIF.Framework.Core` — `clsBusinessCollectionBase` |
| Previous | `Sub Previous()` | Moves the current-item pointer to the previous item. | `SAIF.Framework.Core` — `clsBusinessCollectionBase` |
| SetCurrent | `Sub SetCurrent(item As Object)` | Sets the current item used by traversal-aware consumers. | `SAIF.Framework.Core` — `clsBusinessCollectionBase` |
| Traverse | `Sub Traverse(...)` | Exposes BOF collection traversal behavior to callers that walk the list surface. | `SAIF.Framework.Core` — `clsBusinessCollectionBase` |
| Error | `ReadOnly Property Error As String` | Surfaces collection-level validation or broken-rule text to data-binding consumers. | `SAIF.Framework.Core` — `clsBusinessCollectionBase` |
| Item(columnName) | `ReadOnly Property Item(columnName As String) As String` | Returns column-specific validation error text through `IDataErrorInfo`. | `SAIF.Framework.Core` — `clsBusinessCollectionBase` |

## Behavioral notes
- Related operations, rules, and SQL are cross-referenced from the library-level documentation.

## Constraints and usage notes
- The library exposes read-only retrieval behavior; no type in this package can persist changes through live criteria SQL.

> **Note:** Inherited-member descriptions attributed to `SAIF.Framework.Core` in the Origin column were retrieved from that library's documentation via the Legends CLI and should be reverified if the dependency version changes.

## Sources
- `Business\SAIF.Business.Policy.Affiliate\clsPolicyPreferredWorkerCollection.vb`
