Skip to content

clsProviderSearch

clsProviderSearch is the multi-criteria provider-location search engine, the only type in this library that dynamically assembles its query text at runtime with a Text.StringBuilder and executes it directly through SqlHelper.ResultSetQuery, bypassing the portal/criteria retrieval pattern used by the rest of the library. It accepts a clsSearchCriteria object populated by the caller and returns matches as a clsProviders collection of clsSearchResults rows, silently capping results at 300.

Purpose

  • Runs a name/tax-ID/other-ID/type/service/MCO/address/phone search against PROVIDER_LOCATION and related tables, joining only the tables needed for the criteria supplied (BR-SRCH-004, BR-SRCH-008).
  • Unions in a registered-name match whenever a provider name is supplied, so both display name and registered name are searched (BR-SRCH-005).
  • Caps the result set at 300 rows, discarding excess matches without surfacing a warning to the caller (BR-SRCH-007).
  • Hosts the criteria validation rules (minimum criteria, numeric zip, tax-ID length) evaluated by the BOF rule engine, though searchForProvider itself does not gate execution on IsValid (BR-SRCH-001, BR-SRCH-002, BR-SRCH-003).

Context

  • Namespace: SAIF.Business.View.Provider
  • Assembly/package: SAIF.Business.View.Provider (embedded/project-compiled); also distributed as the NuGet package SAIF.BOF.Business.View.Provider.

Public members

Member Signature Purpose
.ctor Sub New(dpi As IDataPortalInfo) Constructs the search object bound to a data-portal context for subsequent searchForProvider calls.
searchForProvider Sub searchForProvider() Builds and executes the dynamic search query from the current SearchCriteria, populating Providers with up to 300 matching rows (OP-09, SQL-SRCH-01, BR-SRCH-007).
resetSearchCriteria Sub resetSearchCriteria() Clears the current SearchCriteria and result collection, preparing the object for a new search.
SearchCriteria Property SearchCriteria As clsSearchCriteria The caller-populated input model (name, tax ID, other ID, type, service, MCO, address, phone) consumed by searchForProvider.
Providers ReadOnly Property Providers As clsProviders The read-only collection of clsSearchResults rows produced by the most recent searchForProvider call.
IsValid ReadOnly Property IsValid As Boolean (overridden from clsBusinessBase) Reflects whether SearchCriteria currently satisfies BR-SRCH-001/BR-SRCH-002/BR-SRCH-003; not enforced by searchForProvider itself.
IsDirty ReadOnly Property IsDirty As Boolean (overridden from clsBusinessBase) Indicates in-memory changes to the search object; has no effect on persistence since this type performs no writes (BR-DATA-001).

Behavioral notes

  • OP-09: evaluates BusinessPerson first ("BUSINESS" → BUSINESS_FLAG = 'Y', "PERSON" → 'N', otherwise WHERE 1 = 1) (BR-SRCH-004), then appends optional joins/predicates for tax ID, other ID, service type, MCO plan, name (prefix LIKE), provider type, street (prefix LIKE), city, state, zip, area code, and phone; string inputs are upper-cased/trimmed and phone strips -/. (BR-SRCH-008).
  • Results are ordered ORDER BY fullNAME ASC and materialised into clsSearchResults, computing SortName via FormatSortName (BR-SRCH-006); loading stops once the collection exceeds 299 rows with no caller-visible warning (BR-SRCH-007).
  • searchForProvider does not check SearchCriteria.IsValid before executing — a caller can run a search with criteria that would fail BR-SRCH-001/BR-SRCH-002/BR-SRCH-003 validation.

Constraints and usage notes

  • Callers should invoke SearchCriteria.IsValid explicitly before calling searchForProvider if they want to enforce the minimum-criteria/zip/tax-ID rules, since the method does not check this itself.*
  • Because the underlying query is built with string concatenation from criteria values rather than a fixed parameterized statement, unusual criteria combinations should be tested against the actual join/predicate logic described in OP-09.*
  • Result sets larger than 300 rows are truncated silently; UI layers should not assume completeness for broad searches (BR-SRCH-007).

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

  • SAIF.Business.View.Provider/clsProviderSearch.vb