Class PersonNameFormatter
Collection of helper functions to format names.
Inherited Members
Namespace: SuperOffice.CRM.Globalization
Assembly: SoDataBase.dll
Syntax
public static class PersonNameFormatter
Methods
GetAssociateNameFormatStylePreferenceAsync(CancellationToken)
Get the name formatting preference for associates; fallback to persons' preference, ultimately to First/Last name
Declaration
public static Task<PersonNameFormatter.NameFormatStylePreference> GetAssociateNameFormatStylePreferenceAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<PersonNameFormatter.NameFormatStylePreference> |
GetAssociateOrderByAsync(PersonTableInfo, CancellationToken)
Collection of helper functions to format names.
Declaration
public static Task<FieldInfo[]> GetAssociateOrderByAsync(this PersonTableInfo personInfo, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
PersonTableInfo | personInfo | |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<FieldInfo[]> |
GetFormalName(Person)
Get formal name for a person, as used in labels.
Declaration
public static string GetFormalName(this Person person)
Parameters
Type | Name | Description |
---|---|---|
Person | person | Person to get formal name for. |
Returns
Type | Description |
---|---|
string | Formal name for a person, as used in labels. |
GetFormalName(PersonRow)
Get formal name for a person, as used in labels.
Declaration
public static string GetFormalName(this PersonRow person)
Parameters
Type | Name | Description |
---|---|---|
PersonRow | person | Person to get formal name for. |
Returns
Type | Description |
---|---|
string | Formal name for a person, as used in labels. |
GetFormalName(string, string, string, int, string, string)
Get formal name for a person, as used in labels.
Declaration
public static string GetFormalName(string firstName, string middleName, string lastName, int countryId, string title, string mrMrs)
Parameters
Type | Name | Description |
---|---|---|
string | firstName | First name of the person. |
string | middleName | Middle name of the person. |
string | lastName | Last name of a person. |
int | countryId | CountryId for the person, the persons origin. |
string | title | Title of the person. |
string | mrMrs | Mr/Mrs/Miss/Ms, etc. for the person. |
Returns
Type | Description |
---|---|
string | Formal name for a person, as used in labels. |
GetFullName(Person)
Get the persons full name (internal name used in clients for employees).
Declaration
public static string GetFullName(this Person person)
Parameters
Type | Name | Description |
---|---|---|
Person | person | Person to get full name for. |
Returns
Type | Description |
---|---|
string | Persons full name. |
GetFullName(Person, NameFormatStylePreference)
Get the persons full name (internal name used in clients for employees).
Declaration
public static string GetFullName(this Person person, PersonNameFormatter.NameFormatStylePreference style)
Parameters
Type | Name | Description |
---|---|---|
Person | person | Person to get full name for. |
PersonNameFormatter.NameFormatStylePreference | style |
Returns
Type | Description |
---|---|
string | Persons full name. |
GetFullName(PersonRow)
Get the persons full name (internal name used in clients for employees).
Declaration
public static string GetFullName(this PersonRow person)
Parameters
Type | Name | Description |
---|---|---|
PersonRow | person | Person to get full name for. |
Returns
Type | Description |
---|---|
string | Persons full name. |
GetFullName(PersonRow, NameFormatStylePreference)
Get the persons full name (internal name used in clients for employees).
Declaration
public static string GetFullName(this PersonRow person, PersonNameFormatter.NameFormatStylePreference style)
Parameters
Type | Name | Description |
---|---|---|
PersonRow | person | Person to get full name for. |
PersonNameFormatter.NameFormatStylePreference | style |
Returns
Type | Description |
---|---|
string | Persons full name. |
GetFullName(string, string, string)
Get the persons full name (internal name used in clients for employees).
Declaration
public static string GetFullName(string firstName, string middleName, string lastName)
Parameters
Type | Name | Description |
---|---|---|
string | firstName | Persons first name. |
string | middleName | Persons middle name. |
string | lastName | Persons last name. |
Returns
Type | Description |
---|---|
string | Persons full name. |
GetFullName(string, string, string, NameFormatStylePreference)
Get the persons full name (internal name used in clients for employees).
Declaration
public static string GetFullName(string firstName, string middleName, string lastName, PersonNameFormatter.NameFormatStylePreference style)
Parameters
Type | Name | Description |
---|---|---|
string | firstName | Persons first name. |
string | middleName | Persons middle name. |
string | lastName | Persons last name. |
PersonNameFormatter.NameFormatStylePreference | style |
Returns
Type | Description |
---|---|
string | Persons full name. |
GetFullNameAsync(string, string, string, CancellationToken)
Get the persons full name (internal name used in clients for employees).
Declaration
[CreateSyncVersion(OmitNullableDirective = true)]
public static Task<string> GetFullNameAsync(string firstName, string middleName, string lastName, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | firstName | Persons first name. |
string | middleName | Persons middle name. |
string | lastName | Persons last name. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<string> | Persons full name. |
GetNameFormatStylePreference()
Get the name formatting preference for persons
Declaration
public static PersonNameFormatter.NameFormatStylePreference GetNameFormatStylePreference()
Returns
Type | Description |
---|---|
PersonNameFormatter.NameFormatStylePreference |
GetNameFormatStylePreferenceAsync(CancellationToken)
Get the name formatting preference for persons
Declaration
[CreateSyncVersion(OmitNullableDirective = true)]
public static Task<PersonNameFormatter.NameFormatStylePreference> GetNameFormatStylePreferenceAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<PersonNameFormatter.NameFormatStylePreference> |
GetOrderBy(PersonTableInfo, NameFormatStylePreference)
Collection of helper functions to format names.
Declaration
public static FieldInfo[] GetOrderBy(PersonTableInfo personInfo, PersonNameFormatter.NameFormatStylePreference format)
Parameters
Type | Name | Description |
---|---|---|
PersonTableInfo | personInfo | |
PersonNameFormatter.NameFormatStylePreference | format |
Returns
Type | Description |
---|---|
FieldInfo[] |
GetPersonOrderByAsync(PersonTableInfo, CancellationToken)
Collection of helper functions to format names.
Declaration
public static Task<FieldInfo[]> GetPersonOrderByAsync(this PersonTableInfo personInfo, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
PersonTableInfo | personInfo | |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<FieldInfo[]> |
TryGetNamePartsAsync(string, CancellationToken)
Tries to extract the name into parts based on database preferences.
Declaration
public static Task<(bool result, string firstName, string middleName, string lastName)> TryGetNamePartsAsync(string fullName, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | fullName | The full name of the person, without salutation. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<(bool result, string firstName, string middleName, string lastName)> | true if parsing succeeded. |