Skip to content

clsName

clsName is a public class in SAIF.Business.ContactInfo that stores standard name parts and can render them in several business-specific display formats.

Purpose

  • Stores title, first, middle, last, extension, gender, preferred-name, description, and single-value name data.
  • Exposes derived values such as initials, first and last initials, presence flags, and a format-driven FormattedValue.
  • Produces multiple display formats for full-name, first/last, last/first, and SAIF employee naming conventions.
  • Supports explicit empty-state handling, duplication, and reset-to-old behavior for the stored name parts.

Context

  • Namespace: SAIF.Business.ContactInfo
  • Assembly/package: SAIF.Business

Public members

Member Signature Purpose
FormattedTypes Public Enum FormattedTypes Enumerates the supported output formats used by FormatType and FormattedValue.
MR Public Const MR As String = "Mr." Supplies the default male title string.
MRS Public Const MRS As String = "Mrs." Supplies the default female title string.
SingleValue Public Property SingleValue() As String Stores a single fallback name string.
Description Public Property Description() As String Stores descriptive text associated with the name.
Extension Public Property Extension() As String Stores the name extension such as Jr. or III.
First Public Property First() As String Stores the full first name.
FirstInitial Public ReadOnly Property FirstInitial() As String Returns the first character of the first name when present.
FormatType Public Property FormatType() As FormattedTypes Gets or sets the format mode used by FormattedValue.
Gender Public Property Gender() As String Stores the gender code used by title-defaulting logic.
HasMiddleName Public ReadOnly Property HasMiddleName() As Boolean Returns whether the middle name has been populated.
HasPreferredName Public ReadOnly Property HasPreferredName() As Boolean Returns whether the preferred name has been populated.
HasDescription Public ReadOnly Property HasDescription() As Boolean Returns whether the description has been populated.
HasFirstName Public ReadOnly Property HasFirstName() As Boolean Returns whether the first name has been populated.
HasLastName Public ReadOnly Property HasLastName() As Boolean Returns whether the last name has been populated.
HasTitle Public ReadOnly Property HasTitle() As Boolean Returns whether an explicit title has been populated.
HasExtension Public ReadOnly Property HasExtension() As Boolean Returns whether the extension has been populated.
HasSingleValue Public ReadOnly Property HasSingleValue() As Boolean Returns whether the single-value fallback has been populated.
Initials Public ReadOnly Property Initials() As String Returns the concatenated first, middle, and last initials.
IsEmpty Public ReadOnly Property IsEmpty() As Boolean Returns whether all stored name-related values are blank.
Last Public Property Last() As String Stores the last name.
LastInitial Public ReadOnly Property LastInitial() As String Returns the first character of the last name when present.
Middle Public Property Middle() As String Stores the middle name.
MiddleInitial Public ReadOnly Property MiddleInitial() As String Returns the first character of the middle name when present.
PreferredName Public Property PreferredName() As String Stores the preferred name or nickname.
Title Public Property Title() As String Stores the explicit title or derives one from gender when no title is set.
FormattedValue Public ReadOnly Property FormattedValue() As String Returns the name formatted according to FormatType.
IsFirstNameNull Public Function IsFirstNameNull() As Boolean Returns whether the first name is stored as empty.
IsLastNameNull Public Function IsLastNameNull() As Boolean Returns whether the last name is stored as empty.
IsMiddleNameNull Public Function IsMiddleNameNull() As Boolean Returns whether the middle name is stored as empty.
IsExtensionNull Public Function IsExtensionNull() As Boolean Returns whether the extension is stored as empty.
IsTitleNull Public Function IsTitleNull() As Boolean Returns whether the title is stored as empty.
IsPreferredNameNull Public Function IsPreferredNameNull() As Boolean Returns whether the preferred name is stored as empty.
IsDescriptionNull Public Function IsDescriptionNull() As Boolean Returns whether the description is stored as empty.
IsSingleValueNull Public Function IsSingleValueNull() As Boolean Returns whether the single-value fallback is stored as empty.
SetFirstNameNull Public Sub SetFirstNameNull() Clears the first name and marks the object dirty.
SetLastNameNull Public Sub SetLastNameNull() Clears the last name and marks the object dirty.
SetMiddleNameNull Public Sub SetMiddleNameNull() Clears the middle name and marks the object dirty.
SetExtensionNull Public Sub SetExtensionNull() Clears the extension and marks the object dirty.
SetTitleNull Public Sub SetTitleNull() Clears the title and marks the object dirty.
SetPreferredNameNull Public Sub SetPreferredNameNull() Clears the preferred name and marks the object dirty.
SetDescriptionNull Public Sub SetDescriptionNull() Clears the description and marks the object dirty.
SetSingleValueNull Public Sub SetSingleValueNull() Clears the single-value fallback and marks the object dirty.
Duplicate Public Function Duplicate() As clsName Creates a copy of the current name object and marks the copy old.
MarkOld Public Shadows Sub MarkOld() Marks the name object as not modified.
New Public Sub New() Creates a name object and immediately marks it old.
ToFullNameWithTitle Public Function ToFullNameWithTitle() As String Formats the name as title, preferred-or-first name, middle name, last name, and extension.
ToFirstLastPreferred Public Function ToFirstLastPreferred() As String Formats the name as preferred-or-first name followed by last name.
ToStandardLast Public Function ToStandardLast() As String Formats the name as last name, extension, first name, and middle initial.
ToStandardFirst Public Function ToStandardFirst() As String Formats the name as first name, middle initial, last name, and extension.
ToEmployeeFormat Public Function ToEmployeeFormat() As String Formats the name as last name, extension, and preferred-or-first name for SAIF employee display.

Behavioral notes

  • Title returns the stored title when present; otherwise it derives Mr. for gender M and Mrs. for gender F.
  • FormattedValue dispatches to ToFullNameWithTitle, ToEmployeeFormat, ToStandardFirst, or ToStandardLast based on FormatType.
  • The formatting methods fall back to SingleValue, then Description, when structured name parts do not produce output.
  • Duplicate() copies the stored fields into a new instance and then calls MarkOld() on the copy.

Constraints and usage notes

  • New() immediately calls MarkOld(), so a freshly created instance starts in the not-modified state.
  • Empty-state semantics come from the underlying smart-string fields, so callers should use the provided Is...Null and Set...Null helpers when they need to preserve that distinction.
  • The source file does not enforce required name parts or validate gender codes beyond the title-defaulting behavior.

Sources

  • Business\SAIF.Business\ContactInfo\clsName.vb