Show / Hide Table of Contents

Class AssociateCache

Inheritance
Object
CacheBaseV2
AssociateCache
Implements
IFlushableV2
IDisposable
Inherited Members
CacheBaseV2.Dispose()
CacheBaseV2.Flush()
CacheBaseV2.BeginDisableAutoUpdate()
CacheBaseV2.GetCurrent<T>()
CacheBaseV2.Load()
CacheBaseV2.Disposed
Namespace: SuperOffice.CRM.Cache
Assembly: SoDataBase.dll
Syntax
[CacheV2("Database", 0)]
public class AssociateCache : CacheBaseV2, IFlushableV2, IDisposable

Properties

TableNames

Declaration
protected override IEnumerable<string> TableNames { get; }
Property Value
Type Description
IEnumerable<String>
Overrides
CacheBaseV2.TableNames

Methods

GetAllAssociateFullNames(Boolean)

Get all employees/users - the associate tooltip is set to the person's full name

Declaration
public Dictionary<int, string> GetAllAssociateFullNames(bool includeRetired)
Parameters
Type Name Description
Boolean includeRetired

true if you want retired associates included

Returns
Type Description
Dictionary<Int32, String>

Array of associate info

GetAssociate(Int32)

Get an Associate based on it's associate Id

Declaration
public AssociateRecordData GetAssociate(int associateId)
Parameters
Type Name Description
Int32 associateId

Primary key for the Associate.

Returns
Type Description
AssociateRecordData

Associate entity.

GetAssociateContact(Int32)

Get the (cached) contact for an associate

Declaration
public ContactRecordData GetAssociateContact(int associateId)
Parameters
Type Name Description
Int32 associateId

The associate id of the user to get the contact for

Returns
Type Description
ContactRecordData

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)

Get the EjUserId for a given associate

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

Declaration
public IEnumerable<int> GetAssociateIds()
Returns
Type Description
IEnumerable<Int32>

GetAssociateImage(Int32, Int32, Int32)

Declaration
public Image GetAssociateImage(int associateId, int width = 0, int height = 0)
Parameters
Type Name Description
Int32 associateId
Int32 width
Int32 height
Returns
Type Description
Image

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 AssociateType for a user.

Declaration
public AssociateType GetAssociateType(int associateId)
Parameters
Type Name Description
Int32 associateId

AssociateId for the user to check the AssociateType for.

Returns
Type Description
AssociateType

Type of user.

GetCurrent()

Declaration
public static AssociateCache GetCurrent()
Returns
Type Description
AssociateCache

GetEjUserAssociateId(Int32)

Get the AssociateId for a given EjUser

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.

GetPersonImage(Int32)

Declaration
public static Image GetPersonImage(int personId)
Parameters
Type Name Description
Int32 personId
Returns
Type Description
Image

IsAssociateRetired(Int32)

Declaration
public bool IsAssociateRetired(int associateId)
Parameters
Type Name Description
Int32 associateId
Returns
Type Description
Boolean

IsAssociateTypeAnonymous(Int32)

Determine whether this associate is anonymous, based on the AssociateType flag bits of the associate type.

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 NoCalenderBit flag bits of the associate type.

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 (AssociateType.NoCalenderBit = 0)

IsAssociateTypeNoSentry(Int32)

Determine whether this associate is exempt from Sentry checks, based on the AssociateType flag bits of the associate type.

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 AssociateType flag bits of the associate type.

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 instance, are not), based on the AssociateType flag bits of the associate type.

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(String, Int32, PrivateSave)

Determine if cache actually needs to be flushed. The answer is no for changes to non-person associates

Declaration
protected override bool IsCacheInvalidated(string tableName, int primaryKey, PrivateSave save)
Parameters
Type Name Description
String tableName
Int32 primaryKey
PrivateSave save
Returns
Type Description
Boolean
Overrides
CacheBaseV2.IsCacheInvalidated(String, Int32, PrivateSave)

IsPersonAssociate(Int32, Boolean)

Is a given person an associate (e.g. user).

Declaration
public bool IsPersonAssociate(int personId, bool useFailSafeValidation = false)
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.

OnLoad()

Declaration
protected override void OnLoad()
Overrides
CacheBaseV2.OnLoad()

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

Implements

IFlushableV2
System.IDisposable

Extension Methods

EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top