Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Class CustomerContext

The CustomerContext class is used to access the functions of the Customer Management System.

Inheritance
System.Object
CustomerContext
Namespace: Mediachase.Commerce.Customers
Assembly: Mediachase.Commerce.dll
Version: 14.26.0
Syntax
public class CustomerContext : Object

Constructors

CustomerContext()

Initializes a new instance of the CustomerContext class.

Declaration
public CustomerContext()

CustomerContext(CustomerOptions)

Initializes a new instance of the CustomerContext class.

Declaration
public CustomerContext(CustomerOptions customerOptions)
Parameters
Type Name Description
CustomerOptions customerOptions

The options

Properties

Current

Gets the current context.

Declaration
public static CustomerContext Current { get; }
Property Value
Type Description
CustomerContext

The current.

CurrentContact

Gets the current contact.

Declaration
public CustomerContact CurrentContact { get; }
Property Value
Type Description
CustomerContact

The current contact.

Remarks

If there is no contact associated with the current user, then such a contact will be created automatically.

CurrentContactId

Gets the current contact's id.

Declaration
public Guid CurrentContactId { get; }
Property Value
Type Description
System.Guid

The current contact's id.

CurrentContactName

Gets the name of the current contact.

Declaration
public string CurrentContactName { get; }
Property Value
Type Description
System.String

The name of the current contact.

Methods

GetAddressesInOrganization(Organization)

Gets customer addresses in an organisation.

Declaration
public IEnumerable<CustomerAddress> GetAddressesInOrganization(Organization organization)
Parameters
Type Name Description
Organization organization

The organization.

Returns
Type Description
System.Collections.Generic.IEnumerable<CustomerAddress>

Customer addresses. Maximum number of items that will be retrieved can be configured in 'baf.data.metaobjects.config'.

Remarks

This method retrieves up to the number of items defined in "maxListObjects". It's possible to configure the maximum number of items that can be retrieved, by setting 'maxListObjects' in baf.data.metaobjects.config.

GetContactAddresses(CustomerContact)

Gets customer addresses for an customer contact.

Declaration
public IEnumerable<CustomerAddress> GetContactAddresses(CustomerContact contact)
Parameters
Type Name Description
CustomerContact contact

The customer contact.

Returns
Type Description
System.Collections.Generic.IEnumerable<CustomerAddress>

Customer addresses. Maximum number of items that will be retrieved can be configured in 'baf.data.metaobjects.config'.

Remarks

This method retrieves up to the number of items defined in "maxListObjects". It's possible to configure the maximum number of items that can be retrieved, by setting 'maxListObjects' in baf.data.metaobjects.config.

GetContactById(Guid)

Gets the contact by id.

Declaration
public virtual CustomerContact GetContactById(Guid contactId)
Parameters
Type Name Description
System.Guid contactId

The contact id.

Returns
Type Description
CustomerContact

GetContactByUserId(String)

Gets the contact by id.

Declaration
public virtual CustomerContact GetContactByUserId(string userId)
Parameters
Type Name Description
System.String userId

The contact id.

Returns
Type Description
CustomerContact

GetContactCreditCards(CustomerContact)

Gets credit cards for an customer contact.

Declaration
public IEnumerable<CreditCard> GetContactCreditCards(CustomerContact contact)
Parameters
Type Name Description
CustomerContact contact

The customer contact.

Returns
Type Description
System.Collections.Generic.IEnumerable<CreditCard>

Customer addresses. Maximum number of items that will be retrieved can be configured in 'baf.data.metaobjects.config'.

Remarks

This method retrieves up to the number of items defined in "maxListObjects". It's possible to configure the maximum number of items that can be retrieved, by setting 'maxListObjects' in baf.data.metaobjects.config.

GetContacts(DateTime, DateTime, Int32, Int32)

Gets the customer contacts by start date or end date and paging.

Declaration
public IEnumerable<CustomerContact> GetContacts(DateTime fromDate, DateTime toDate, int startIndex, int recordsToRetrieve)
Parameters
Type Name Description
System.DateTime fromDate

The start date.

System.DateTime toDate

The to date.

System.Int32 startIndex

The start index.

System.Int32 recordsToRetrieve

Number of contacts to get.

Returns
Type Description
System.Collections.Generic.IEnumerable<CustomerContact>

GetContacts(Int32, Int32)

Gets the customer contacts, by paging.

Declaration
public IEnumerable<CustomerContact> GetContacts(int startIndex, int recordsToRetrieve)
Parameters
Type Name Description
System.Int32 startIndex

The start index.

System.Int32 recordsToRetrieve

Number of contacts to get.

Returns
Type Description
System.Collections.Generic.IEnumerable<CustomerContact>

GetContactsByPattern(String)

Gets the contacts by pattern.

Declaration
public IEnumerable<CustomerContact> GetContactsByPattern(string pattern)
Parameters
Type Name Description
System.String pattern

The pattern.

Returns
Type Description
System.Collections.Generic.IEnumerable<CustomerContact>

GetCustomerContactsInOrganization(Organization)

Gets customer contacts in an organisation.

Declaration
public IEnumerable<CustomerContact> GetCustomerContactsInOrganization(Organization organisation)
Parameters
Type Name Description
Organization organisation

The organisation

Returns
Type Description
System.Collections.Generic.IEnumerable<CustomerContact>

Customer contacts. Maximum number of items that will be retrieved can be configured in 'baf.data.metaobjects.config'.

Remarks

This method retrieves up to the number of items defined in "maxListObjects". It's possible to configure the maximum number of items that can be retrieved, by setting 'maxListObjects' in baf.data.metaobjects.config.

GetOrganizationById(PrimaryKeyId)

Gets the organization by id.

Declaration
public virtual Organization GetOrganizationById(PrimaryKeyId orgId)
Parameters
Type Name Description
PrimaryKeyId orgId

The org id.

Returns
Type Description
Organization

GetOrganizationById(String)

Gets the organization by id.

Declaration
public virtual Organization GetOrganizationById(string orgId)
Parameters
Type Name Description
System.String orgId

The org id.

Returns
Type Description
Organization

GetOrganizationCreditCards(Organization)

Gets credit cards for an organisation.

Declaration
public IEnumerable<CreditCard> GetOrganizationCreditCards(Organization organization)
Parameters
Type Name Description
Organization organization

The organization.

Returns
Type Description
System.Collections.Generic.IEnumerable<CreditCard>

Organisations. Maximum number of items that will be retrieved can be configured in 'baf.data.metaobjects.config'.

Remarks

This method retrieves up to the number of items defined in "maxListObjects". It's possible to configure the maximum number of items that can be retrieved, by setting 'maxListObjects' in baf.data.metaobjects.config.

GetOrganizations()

Gets the organizations.

Declaration
public IEnumerable<Organization> GetOrganizations()
Returns
Type Description
System.Collections.Generic.IEnumerable<Organization>

Organisations. Maximum number of items that will be retrieved can be configured in 'baf.data.metaobjects.config'.

Remarks

This method retrieves up to the number of items defined in "maxListObjects". It's possible to configure the maximum number of organisations that can be retrieved, by setting 'maxListObjects' in baf.data.metaobjects.config.

GetOrganizationsByPattern(String)

Gets the organizations by pattern.

Declaration
public IEnumerable<Organization> GetOrganizationsByPattern(string pattern)
Parameters
Type Name Description
System.String pattern

The pattern.

Returns
Type Description
System.Collections.Generic.IEnumerable<Organization>

IsAdminContact(PrimaryKeyId)

Determines whether [is admin contact] [the specified contact pk].

Declaration
public bool IsAdminContact(PrimaryKeyId contactPk)
Parameters
Type Name Description
PrimaryKeyId contactPk

The contact pk.

Returns
Type Description
System.Boolean

true if [is admin contact] [the specified contact pk]; otherwise, false.