Maintain provider contact¶
clsProviderContact maintains a named contact (phone/email) attached to a provider location. Unlike the identity, tax ID, MCO membership, and relationship classes, its own Save() path does not call the accompanying clsContactApi helper in this codebase — the API wrapper exists as a separate, caller-driven sync utility.
| Field | Value |
|---|---|
| Operation ID | OP-PRV-05 |
| Trigger | Caller calls NewProviderContact/GetProviderContact, edits properties, and calls Save() or Delete() |
| Inputs | ProviderLocationSeqNum, ProviderContactCode, Name, EmailAddress, PhoneNumber |
| Outputs | Persisted PROVIDER_CONTACT row |
| Primary components | clsProviderContact.Create, BeforeInsert/BeforeUpdate/BeforeDelete, ValidateContactType, ValidateEmailPhone, ValidatePhone |
| Entry point | Business\SAIF.Business.Provider\clsProviderContact.vb |
Steps¶
- Create.
NewProviderContact(inDataportal, inProviderLocationSeqNum)constructs withRetrieveType.Location;Create()assignsProviderLocationSeqNumand a new seq num viaGetNextSeqNum("PROVIDER_CONTACT_SEQ"). - Retrieve single.
BeforeRetrieve/AfterRetrieveread PROVIDER_CONTACT byPROVIDER_CONTACT_SEQ_NUM(SQL-045);Fill(...)runs only when a row is returned, otherwise the object is still marked old with empty fields.* - Retrieve collection.
GetContacts(inDPI, inProviderLocationSeqNum)runs a directSqlHelper.ResultSetQueryfiltered byPROVIDER_LOCATION_SEQ_NUMto load every contact for a location. - Validate before save.
- BR-009:
ValidateContactTyperequires a nonblankProviderContactCode("Error: Select a contact type.");ValidateEmailPhonerequires at least one ofEmailAddressorPhoneNumber("Error: Either a phone # or an email address must be entered."). CommonBusinessRules.IsValidEmailAddressvalidatesEmailAddressformat when present.ValidatePhone: hard error ifPhoneNumberis present and its trimmed formatted length is less than 12 characters ("Error: Invalid phone number.").- A contact-name-required rule exists in source as a commented-out call and is not currently enforced.*
- Insert.
BeforeInsertwritesPROVIDER_CONTACT_SEQ_NUM,PROVIDER_LOCATION_SEQ_NUM,PROVIDER_CONTACT_CODE,NAME,EMAIL_ADDR,PHONE_NUM(formatted via thePhoneNumbergetter), and audit fields to PROVIDER_CONTACT (SQL-021). - On a rows-affected value other than
1: add"Insert Failed"; otherwiseMarkOld(). - Update.
BeforeUpdatewrites the same fields to PROVIDER_CONTACT (SQL-069) with concurrency checkWHERE PROVIDER_CONTACT_SEQ_NUM = :ProviderContactSeqNum AND UPDATE_NUM = :UpdateNum. - On a rows-affected value other than
1: add the DB contention error; otherwise incrementm_UpdateNumandMarkOld(). - Delete.
BeforeDeletedeletes the PROVIDER_CONTACT row byPROVIDER_CONTACT_SEQ_NUM(SQL-091). - On a rows-affected value other than
1: add the DB contention error; otherwiseMarkNew(). - Separate API sync utility.
clsContactApi.AddContact/UpdateContact/RemoveContactis a standalone wrapper that sends aContactDtoto Provider API routesprovider/{0}(insert/update) andprovider/{0}/remove(delete) viaDataApiAccessLayer.InsertObject/UpdateObject/DeleteObject. BecauseclsProviderContact.Save()/Delete()never invoke this class, Contact Manager synchronization for contact records — if it happens at all — is driven by a caller outside this file rather than embedded in the persistence pipeline.*
Process flow¶
flowchart TD
Start([Caller edits contact]) --> TypeCheck{Contact type entered?}
TypeCheck -->|No| Fail([Missing type or<br>communication path blocks save])
TypeCheck -->|Yes| CommCheck{Phone or email present?}
CommCheck -->|Neither| Fail
CommCheck -->|At least one| PhoneCheck{Phone present and valid length?}
PhoneCheck -->|No, too short| Fail
PhoneCheck -->|Yes or blank| Persist[Insert/update/delete PROVIDER_CONTACT]
Persist --> Rows{RowsAffected = 1?}
Rows -->|No| Contention([Insert Failed / DB contention error])
Rows -->|Yes| Done([Save complete;<br>no automatic Contact Manager sync])
Failure and edge-case behavior¶
Save()/Delete()do not callclsContactApi, so provider contacts are the one maintenance class in this library whose persistence path does not automatically synchronize to Contact Manager.*- Contact name is not a required field despite a commented-out rule suggesting it once was.*
- Retrieving a nonexistent contact seq num returns an unpopulated object rather than an explicit not-found error.*
Related documentation¶
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.
Sources¶
Business\SAIF.Business.Provider\clsProviderContact.vbBusiness\SAIF.Business.Provider\Api\clsContactApi.vb