clsAddress¶
Represents an Address. Represents a formatted postal address with validation, formatting, and contact-channel support.
Purpose¶
- Represents a formatted postal address with validation, formatting, and contact-channel support.
Context¶
- Namespace:
SAIF.Business.ContactInfo - Assembly/package:
SAIF.Business
Public members¶
| Member | Signature | Purpose |
|---|---|---|
SmartProperty |
Public Enum SmartProperty |
Enumerates the smart-string-backed address fields that GetSmartString and SetSmartString can access. |
ActiveFormating |
Public Property ActiveFormating() As Boolean |
When True formatted address lines are updated each time a property is modified. This property should be set to false when the object is being loaded with initial data. Setting it back to true will update formatting with the current property values. The default value is True |
FormatUsingName |
Public Property FormatUsingName() As Boolean |
Gets/Sets the setting which utilizes the Name as the first line of the formatted Address. This is set to false by default. |
FormatUsingCountryName |
Public Property FormatUsingCountryName() As Boolean |
Gets/Sets the setting which utilizes the Country Name as the last line of the formatted Address. when formatting Foreign Addresses |
PhoneFormat |
Public Property PhoneFormat() As PhoneFormat |
Gets or Sets the Format in which the Phone and Fax numbers are returned in the string property. The default format is Standard (###) ###-#### |
AddressLine1 |
<Reportable()> Public Property AddressLine1() As String |
Gets or Sets the 1st Address Line. This line is primarily for a street address or a PO Box. Use the Name and InCareOf properties if you wish them to be used in the formatted Address. |
AddressLine2 |
<Reportable()> Public Property AddressLine2() As String |
Gets or Sets the 2nd Address Line. This property is primarily for additional street or suite information. |
AddressLine3 |
<Reportable()> Public Property AddressLine3() As String |
Gets or Sets the 3rd Address Line. Normally used for Foreign Addresses that have no city, state and Zip. |
AddressLine4 |
<Reportable()> Public Property AddressLine4() As String |
Gets or Sets the 4th Address Line. Normally used for Foreign Addresses. |
CareOf |
<Reportable()> Public Property CareOf() As String |
Get or Sets the CareOf Name. This is formatted with the c/o in front of the value. |
ForLine |
<Reportable()> Public Property ForLine() As String |
Get or Sets the For Name. This is formatted with the For: in front of the value. |
City |
<Reportable()> Public Property City() As String |
Gets or Sets the City portion of the address. |
County |
<Reportable()> Public Property County() As String |
Gets or Sets the County. Set the UseCounty property to true if you wish this to show up in a formatted address. |
Country |
<Reportable()> Public Property Country() As String |
Gets or Sets the Full Text of the Country. Used when the Foreign Address Flag has been set. |
CountryCode |
<Reportable()> Public Property CountryCode() As String |
Used to Get or Set the Country Code. Used when formatting a Foreign Address. |
CountryCodeInfo |
Public ReadOnly Property CountryCodeInfo As CodeMappings.clsCountryCodeInfo |
Returns the country-code metadata for the current CountryCode, or Nothing when no country code is set. |
Fax |
<System.ComponentModel.Browsable(False)> Public Property Fax() As clsPhone |
Gets or Sets an Object of type clsPhone which stores the Fax Number and allows for multiple formatting options. The property FaxNumber displays the phone number according to the PhoneFormatting Property. To display the number in an alternative format use the FAX.ToFormattedString method passing in a different PhoneFormat. |
FaxNumber |
<Reportable()> Public ReadOnly Property FaxNumber() As String |
Displays the Fax number stored in the Property FAX according to the format designated by the PhoneFormatting property. To display the number in an alternative format use the FAX.ToFormattedString method passing in a different PhoneFormat. |
IsEmpty |
Public Overridable ReadOnly Property IsEmpty() As Boolean |
Returns True if all of the following properties contain a blank string: AddressLines 1 to 4, City, StateCode, ZipCode, ZipCodePlus4, Country, CountryCode, County, PhoneNumber, FaxNumber, Name and CareOf |
IsForeign |
<Reportable()> Public Property IsForeign() As Boolean |
Gets or Sets whether the address should be formatted as a foreign address. |
IsForeignModified |
<Reportable()> Public Readonly Property IsForeignModified() As Boolean |
Gets whether the foreign address flag has been modified. |
Name |
<Reportable()> Public Property Name() As String |
Gets or Sets the Name that is used as the first address line when formatting an address if the FormatUsingName property has been set to True. |
Phone |
<System.ComponentModel.Browsable(False)> Public Property Phone() As clsPhone |
Gets or Sets an Object of type clsPhone which stores the Phone Number and allows for multiple formatting options. The property PhoneNumber displays the phone number according to the PhoneFormatting Property. To display the number in an alternative format use the Phone.ToFormattedString method passing in a different PhoneFormat. |
PhoneNumber |
<Reportable()> Public ReadOnly Property PhoneNumber() As String |
Displays the phone number stored in the Phone Property according to the format designated by the PhoneFormatting property. To display the number in an alternative format use the Phone.ToFormattedString method passing in a different PhoneFormat. |
StateCode |
<Reportable()> Public Property StateCode() As String |
Gets or Sets the State Code. |
UseCounty |
Public Property UseCounty() As Boolean |
Gets or Sets whether the County should be used when formatting the address. The default setting is False. |
WebFormatting |
Public Property WebFormatting() As Boolean |
Gets the Status of WebFormatting. If Set to true, formatting uses html to make line breaks. If False, a CRLF is used. |
ZipCode |
<Reportable()> Public Property ZipCode() As String |
Gets or Sets the ZipCode. |
ZipCodeNumeric |
Public Property ZipCodeNumeric() As Int32 |
Gets or Sets the ZipCode Using a numeric value. |
ZipCodePlus4 |
<Reportable()> Public Property ZipCodePlus4() As String |
Gets or Sets the 4 character-digit Extension |
IsComplete |
Public ReadOnly Property IsComplete() As Boolean |
Returns True when the address has address line 1, city, state, and ZIP populated, or when it is marked as foreign. |
FormattedAddressLine1 |
<Reportable()> Public ReadOnly Property FormattedAddressLine1() As String |
Returns the first line of the formatted address. |
FormattedAddressLine2 |
<Reportable()> Public ReadOnly Property FormattedAddressLine2() As String |
The 2nd line displayed in the formatted Address. |
FormattedAddressLine3 |
<Reportable()> Public ReadOnly Property FormattedAddressLine3() As String |
The 3rd line displayed in the formatted address. |
FormattedAddressLine4 |
<Reportable()> Public ReadOnly Property FormattedAddressLine4() As String |
The 4th line displayed in the formatted address. |
FormattedAddressLine5 |
<Reportable()> Public ReadOnly Property FormattedAddressLine5() As String |
The 5th line displayed in the formatted address. |
FormattedAddressLine6 |
<Reportable()> Public ReadOnly Property FormattedAddressLine6() As String |
The 6th line displayed in the formatted address. |
FormattedAddress |
<Reportable()> Public ReadOnly Property FormattedAddress() As String |
Returns the fully formatted address (up to 6 lines). Each line ends with the vbNLCRF constant so it is suitable for display. |
FormattedSingleLineAddress |
<Reportable()> Public ReadOnly Property FormattedSingleLineAddress() As String |
Returns the formatted address collapsed into a single comma-separated line. |
New |
Public Sub New(Optional ByVal inEmptyStringIsBlank As Boolean = False) |
Initializes a new address instance and its smart-string fields, optionally treating empty strings as blank database values. |
New |
Public Sub New(ByVal inDataPortalInfo As IDataPortalInfo, Optional ByVal inEmptyStringIsBlank As Boolean = False) |
Initializes a new address instance with data portal context and smart-string fields, optionally treating empty strings as blank database values. |
SetCountryName |
Public Sub SetCountryName(ByVal inCountryName As String, Optional ByVal MarkAsDirty As Boolean = False) |
This method is called from FormatForeign and FormatUS. |
GetSmartString |
Public Function GetSmartString(ByVal inProperty As SmartProperty) As clsSmartString |
Returns the clsSmartString backing field for the requested smart property. |
SetSmartString |
Public Sub SetSmartString(ByVal inProperty As SmartProperty, ByVal inSmartString As clsSmartString) |
Replaces the clsSmartString backing field for the requested smart property. |
AddressRules |
Public ReadOnly Property AddressRules() As clsAddress.clsRules |
Provides access to the Properties and Methods of the Address Object which manage Address Business Rules. |
InitializeRules |
Public Sub InitializeRules() |
Initializes Rules according to the properties previously set. |
CityIsRequired |
Public Function CityIsRequired(ByVal target As Object, ByVal e As clsRuleArgs) As Boolean |
Validates that the address contains a city value. |
StateCodeIsRequired |
Public Function StateCodeIsRequired(ByVal target As Object, ByVal e As clsRuleArgs) As Boolean |
Validates that the address contains a state code. |
CountyIsRequired |
Public Function CountyIsRequired(ByVal target As Object, ByVal e As clsRuleArgs) As Boolean |
Validates that the address contains a county value. |
CountryCodeIsRequired |
Public Function CountryCodeIsRequired(ByVal target As Object, ByVal e As clsRuleArgs) As Boolean |
Validates that the address contains a country code. |
CountryIsRequired |
Public Function CountryIsRequired(ByVal target As Object, ByVal e As clsRuleArgs) As Boolean |
Validates that the address contains a country value. |
AddressLine1IsRequired |
Public Function AddressLine1IsRequired(ByVal target As Object, ByVal e As clsRuleArgs) As Boolean |
Validates that the address contains the first address line. |
AddressLine2IsRequired |
Public Function AddressLine2IsRequired(ByVal target As Object, ByVal e As clsRuleArgs) As Boolean |
Validates that the address contains the second address line. |
AddressLine3IsRequired |
Public Function AddressLine3IsRequired(ByVal target As Object, ByVal e As clsRuleArgs) As Boolean |
Validates that the address contains the third address line. |
AddressLine4IsRequired |
Public Function AddressLine4IsRequired(ByVal target As Object, ByVal e As clsRuleArgs) As Boolean |
Validates that the address contains the fourth address line. |
ZipCodeIsRequired |
Public Function ZipCodeIsRequired(ByVal target As Object, ByVal e As clsRuleArgs) As Boolean |
Validates that the address contains a ZIP code. |
ZipCodePlus4IsRequired |
Public Function ZipCodePlus4IsRequired(ByVal target As Object, ByVal e As clsRuleArgs) As Boolean |
Validates that the address contains a ZIP+4 extension. |
NameIsRequired |
Public Function NameIsRequired(ByVal target As Object, ByVal e As clsRuleArgs) As Boolean |
Validates that the address contains a name value. |
IsStateCodeValid |
Public Function IsStateCodeValid(ByVal target As Object, ByVal e As clsRuleArgs) As Boolean |
Validates the current state code against the ALL_STATES lookup. |
IsZipCodeExtValid |
Public Function IsZipCodeExtValid(ByVal target As Object, ByVal e As clsRuleArgs) As Boolean |
Validates that any ZIP+4 extension is exactly four characters long. |
IsCountryCodeValid |
Public Function IsCountryCodeValid(ByVal target As Object, ByVal e As clsRuleArgs) As Boolean |
Validates the current country code against the COUNTRY lookup. |
IsZipCodeValid |
Public Function IsZipCodeValid(ByVal target As Object, ByVal e As clsRuleArgs) As Boolean |
Validates that any ZIP code is exactly five characters long. |
IsStateZipCodeValid |
Public Function IsStateZipCodeValid(ByVal target As Object, ByVal e As clsRuleArgs) As Boolean |
Validates that the ZIP code falls within the configured range for the current state. |
IsOregonZipCodeValid |
Public Function IsOregonZipCodeValid(ByVal target As Object, ByVal e As clsRuleArgs) As Boolean |
Validates that an Oregon ZIP code exists in the ZIP_MCO_COUNTY lookup. |
ValidStateCode |
Public Shared Function ValidStateCode(ByVal inDataPortalInfo As IDataPortalInfo, ByVal inStateCode As String) As Boolean |
Checks whether the supplied state code exists in ALL_STATES. |
ValidCountryCode |
Public Shared Function ValidCountryCode(ByVal inDataPortalInfo As IDataPortalInfo, ByVal inCountryCode As String) As Boolean |
Checks whether the supplied country code exists in COUNTRY. |
ValidStateZip |
Public Shared Function ValidStateZip(ByVal inDataPortalInfo As IDataPortalInfo, ByVal inStateCode As String, ByVal inZipCode As String) As Boolean |
Checks whether the ZIP code falls within the configured range for the supplied state. |
GetCountryName |
Public Shared Function GetCountryName(ByVal inDataPortalInfo As IDataPortalInfo, ByVal inCountryCode As String) As String |
Retrieves the country name for a country code from the COUNTRY lookup. |
ValidOregonZip |
Public Shared Function ValidOregonZip(ByVal inDataPortalInfo As IDataPortalInfo, ByVal inZipCode As String) As Boolean |
Checks whether the supplied ZIP code exists in ZIP_MCO_COUNTY. |
<Serializable()> Public Class clsRules |
<Serializable()> Public Class clsRules |
Stores the flags and prefixes that control clsAddress rule registration and validation behavior. |
ErrorTextPrefix |
Public Property ErrorTextPrefix() As String |
Gets or Sets the Text which precedes the Error Message |
ErrorPropertyPrefix |
Public Property ErrorPropertyPrefix() As String |
Gets or Sets the Value which precedes the PropertyName to make the IDataErrorInfo Unique for each Address. For Example: "Worker" would cause IDataErrorInfo to return WorkerCity, WorkerStateCode, WorkerAddressLine1, etc. |
CityRequired |
Public Property CityRequired() As Boolean |
Controls whether city is required when address business rules are initialized. |
StateCodeRequired |
Public Property StateCodeRequired() As Boolean |
Controls whether state code is required when address business rules are initialized. |
CountyCodeRequired |
Public Property CountyCodeRequired() As Boolean |
Controls whether county is required when address business rules are initialized. |
CountryCodeRequired |
Public Property CountryCodeRequired() As Boolean |
Controls whether country code is required when address business rules are initialized. |
CountryRequired |
Public Property CountryRequired() As Boolean |
Controls whether country is required when address business rules are initialized. |
AddressLine1Required |
Public Property AddressLine1Required() As Boolean |
Controls whether address line 1 is required when address business rules are initialized. |
AddressLine2Required |
Public Property AddressLine2Required() As Boolean |
Controls whether address line 2 is required when address business rules are initialized. |
AddressLine3Required |
Public Property AddressLine3Required() As Boolean |
Controls whether address line 3 is required when address business rules are initialized. |
AddressLine4Required |
Public Property AddressLine4Required() As Boolean |
Controls whether address line 4 is required when address business rules are initialized. |
ZipCodeRequired |
Public Property ZipCodeRequired() As Boolean |
Controls whether ZIP code is required when address business rules are initialized. |
ZipPlus4Required |
Public Property ZipPlus4Required() As Boolean |
Controls whether ZIP+4 is required when address business rules are initialized. |
NameRequired |
Public Property NameRequired() As Boolean |
Controls whether name is required when address business rules are initialized. |
ValidateZip |
Public Property ValidateZip() As Boolean |
Controls whether ZIP code length validation is enabled when address business rules are initialized. |
ValidateZipPlus4 |
Public Property ValidateZipPlus4() As Boolean |
Controls whether ZIP+4 length validation is enabled when address business rules are initialized. |
ValidateStateCode |
Public Property ValidateStateCode() As Boolean |
Controls whether state-code lookup validation is enabled when address business rules are initialized. |
ValidateStateZip |
Public Property ValidateStateZip() As Boolean |
Controls whether state-to-ZIP lookup validation is enabled when address business rules are initialized. |
ValidateCountyCode |
Public Property ValidateCountyCode() As Boolean |
Stores whether county-code validation should be enabled for address rules. |
ValidateCountryCode |
Public Property ValidateCountryCode() As Boolean |
Controls whether country-code lookup validation is enabled when address business rules are initialized. |
ValidateOregonZip |
Public Property ValidateOregonZip() As Boolean |
Controls whether Oregon ZIP lookup validation is enabled when address business rules are initialized. |
GetID |
Public Overrides Function GetID() As Decimal |
Returns 0 for this address object identifier. |
Behavioral notes¶
- Property setters call Format so formatted address lines stay synchronized with the underlying address fields.
- The class also embeds SQL validation constants for state, ZIP, and country checks used by address-validation workflows.
Constraints and usage notes¶
- Formatting behavior depends on flags such as ActiveFormating, FormatUsingName, and FormatUsingCountryName.
- Address validation helpers rely on the configured IDataPortalInfo and the Oracle lookup tables referenced by the class.
Sources¶
Business\SAIF.Business\ContactInfo\clsAddress.vb