Class AssociateCache
Implements
Inherited Members
Namespace: SuperOffice.CRM.Cache
Assembly: SoDataBase.dll
Syntax
[Cache(600, "Database")]
public class AssociateCache : XCacheBase, IFlushable
Constructors
AssociateCache()
Refresh the content of the cache
Declaration
[SoInjectConstructor]
protected AssociateCache()
Methods
GetAssociate(Int32)
Get an Associate based on it's associateId
Declaration
public AssociateRow GetAssociate(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | Primary key for the Associate. |
Returns
Type | Description |
---|---|
AssociateRow | Associate entity. |
GetAssociateContact(Int32)
Get the (cached) contact for an associate
Declaration
public ContactRow GetAssociateContact(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | The associate id of the user to get the contact for |
Returns
Type | Description |
---|---|
ContactRow | ContactRow, or null if the associate does not have an owning contact (is a resource, for instance) |
GetAssociateContactId(Int32)
Get the ContactId for an associate.
Declaration
public int GetAssociateContactId(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | The associate id of the user to get the ContactId for. |
Returns
Type | Description |
---|---|
Int32 | ContactId for the user. |
GetAssociateCountry(Int32)
Get country id for the associate.
Declaration
public int GetAssociateCountry(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | AssociateId to get countryId for |
Returns
Type | Description |
---|---|
Int32 | Country id for the associate. |
GetAssociateDateOfBirth(Int32)
Get the date of birth of the associate (from person record that the associate belongs to)
Declaration
public DateTime GetAssociateDateOfBirth(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | Associate to look up |
Returns
Type | Description |
---|---|
DateTime | Date of birth of the associate's person |
GetAssociateEjUserId(Int32)
Declaration
public int GetAssociateEjUserId(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId |
Returns
Type | Description |
---|---|
Int32 |
GetAssociateEmailId(Int32)
Get the email-id, of rank 1, if it exists for an associate
Declaration
public int GetAssociateEmailId(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | Associate to look up |
Returns
Type | Description |
---|---|
Int32 | email_id of rank 0 linked to associates' person; 0 is returned in any other case |
GetAssociateFirstName(Int32)
Get the first name of the associate (from person record that the associate belongs to)
Declaration
public string GetAssociateFirstName(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | Associate to look up |
Returns
Type | Description |
---|---|
String | First name of the associate's person |
GetAssociateFormalName(Int32)
Get the formal name of an associate based on GetFormalName(String, String, String, Int32, String, String).
Declaration
public string GetAssociateFormalName(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | AssociateId of the person |
Returns
Type | Description |
---|---|
String | Formal name according to GetFormalName(String, String, String, Int32, String, String). |
GetAssociateFullName(Int32)
Get the full name of an associate according to GetFullName(String, String, String).
Declaration
public string GetAssociateFullName(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | AssociateId of the person to get the full name for. |
Returns
Type | Description |
---|---|
String | Full name according to GetFullName(String, String, String). |
GetAssociateId(String)
Get the associate id from a associate name
Declaration
public int GetAssociateId(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | name of the associate (e.g. user id) |
Returns
Type | Description |
---|---|
Int32 | Associate Id. -1 is returned if the the provided name is not a valid associate. |
GetAssociateIds()
Get all associate id's as an array
Declaration
public int[] GetAssociateIds()
Returns
Type | Description |
---|---|
Int32[] | Array, may be empty but never null |
GetAssociateLastName(Int32)
Get the last name of the associate (from person record that the associate belongs to)
Declaration
public string GetAssociateLastName(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | Associate to look up |
Returns
Type | Description |
---|---|
String | Last name of the associate's person |
GetAssociateMiddleName(Int32)
Get the middle name of the associate (from person record that the associate belongs to)
Declaration
public string GetAssociateMiddleName(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | Associate to look up |
Returns
Type | Description |
---|---|
String | Middle name of the associate's person |
GetAssociateMrMrs(Int32)
Get the MrMrs field of the associate (from person record that the associate belongs to)
Declaration
public string GetAssociateMrMrs(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | Associate to look up |
Returns
Type | Description |
---|---|
String | MrMrs field of the associate's person |
GetAssociateName(Int32)
Declaration
public string GetAssociateName(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId |
Returns
Type | Description |
---|---|
String |
GetAssociateOwnerId(Int32)
Get the associate id for the owner of the contact that the person representing the associate belongs to. (associate.person.contact.associate)
Declaration
public int GetAssociateOwnerId(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | AssociateId of the person the get owner for. |
Returns
Type | Description |
---|---|
Int32 | AssociateId of the owner. |
GetAssociatePersonId(Int32)
Get the PersonId for an associate. 0 is returned if there is no valid associate with that id (or if the associate.PersonId actually is 0, which is the case for resources and some other special kinds of associates).
Declaration
public int GetAssociatePersonId(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | The associate id of the user to get the PersonId for. |
Returns
Type | Description |
---|---|
Int32 | PersonId for the user. |
GetAssociateTitle(Int32)
Get the title field of the associate (from person record that the associate belongs to)
Declaration
public string GetAssociateTitle(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | Associate to look up |
Returns
Type | Description |
---|---|
String | Title field of the associate's person |
GetAssociateType(Int32)
Get the
Declaration
public AssociateType GetAssociateType(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | AssociateId for the user to check the |
Returns
Type | Description |
---|---|
AssociateType | Type of user. |
GetCachedTableNumbers()
Declaration
public override int[] GetCachedTableNumbers()
Returns
Type | Description |
---|---|
Int32[] |
Overrides
GetCurrent()
Declaration
public static AssociateCache GetCurrent()
Returns
Type | Description |
---|---|
AssociateCache |
GetEjUserAssociateId(Int32)
Declaration
public int GetEjUserAssociateId(int ejUserId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | ejUserId |
Returns
Type | Description |
---|---|
Int32 |
GetPersonAssociateId(Int32)
Get a AssociateId for a person, 0 is returned if the person is not an associate.
Declaration
public int GetPersonAssociateId(int personId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personId | The person's id to get the AssociateId for. |
Returns
Type | Description |
---|---|
Int32 | The AssociateId of the user. If the person is not a user, '0' is returned. |
IsAssociateRetired(Int32)
Get the ContactId for an associate.
Declaration
public bool IsAssociateRetired(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | The associate id of the user to get the ContactId for. |
Returns
Type | Description |
---|---|
Boolean | ContactId for the user. |
IsAssociateTypeAnonymous(Int32)
Determine whether this associate is anonymous,
based on the
Declaration
public bool IsAssociateTypeAnonymous(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | Associate to check |
Returns
Type | Description |
---|---|
Boolean | true if the associate is anonymous |
IsAssociateTypeDiaryOwner(Int32)
Determine whether this associate has a diary,
based on the
Declaration
public bool IsAssociateTypeDiaryOwner(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | Associate to check |
Returns
Type | Description |
---|---|
Boolean | true if the associate has a diary |
IsAssociateTypeNoSentry(Int32)
Determine whether this associate is exempt from Sentry checks,
based on the
Declaration
public bool IsAssociateTypeNoSentry(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | Associate to check |
Returns
Type | Description |
---|---|
Boolean | true if the associate ignores the sentry system (a rare privilege) |
IsAssociateTypeResource(Int32)
Determine whether this associate is a resource
based on the
Declaration
public bool IsAssociateTypeResource(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | Associate to check |
Returns
Type | Description |
---|---|
Boolean | true if the associate actually is a resource |
IsAssociateTypeSomeKindOfPerson(Int32)
Determine whether this associate is some kind of person (resource, for instamce, are not),
based on the
Declaration
public bool IsAssociateTypeSomeKindOfPerson(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | Associate to check |
Returns
Type | Description |
---|---|
Boolean | true if the associate is some kind of person |
IsCacheInvalidated(Int32, SqlType, Int32)
Declaration
protected override bool IsCacheInvalidated(int tableNumber, SqlType sqlType, int primaryKey)
Parameters
Type | Name | Description |
---|---|---|
Int32 | tableNumber | |
SqlType | sqlType | |
Int32 | primaryKey |
Returns
Type | Description |
---|---|
Boolean |
Overrides
IsPersonAssociate(Int32)
Is a given person an associate (e.g. user).
Declaration
public bool IsPersonAssociate(int personId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personId | PersonId of the person to check if it is an associate. |
Returns
Type | Description |
---|---|
Boolean | True if the person is an associate. |
IsPersonAssociate(Int32, Boolean)
Is a given person an associate (e.g. user).
Declaration
public bool IsPersonAssociate(int personId, bool useFailSafeValidation)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personId | PersonId of the person to check if it is an associate. |
Boolean | useFailSafeValidation | If you have to be 100% sure that your database is consistent with the cache, this value should be true. Otherwise, use false or just omit the parameter all together. Setting this value true might refresh the cache and subsequently limits performance. Should only be used if consistency is vital |
Returns
Type | Description |
---|---|
Boolean | True if the person is an associate. |
IsUserInSameContact(Int32)
Is the logged on user belonging to the same contact?
Declaration
public bool IsUserInSameContact(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | AssociateId for the user to check if belongs to same contact |
Returns
Type | Description |
---|---|
Boolean | true if they belong to the same contact. |
IsUserInSameContact(Int32, Int32)
Is the two users belonging to the same contact?
Declaration
public bool IsUserInSameContact(int associateId1, int associateId2)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId1 | AssociateId for the 1st user to check if belongs to same contac. |
Int32 | associateId2 | AssociateId for the 2nd user to check if belongs to same contact. |
Returns
Type | Description |
---|---|
Boolean | true if they belong to the same contact. |
ValidateAndTestAssociate(Int32)
Validate that an associate exists. Refresh the cache if we're asking about the current logged-in user, since he may be freshly created and not in the cache. Keep a zombie list of known non-existent ones.
Declaration
public bool ValidateAndTestAssociate(int associateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | Id of the associate to validate. |
Returns
Type | Description |
---|---|
Boolean |