November Happy Hour will be moved to Thursday December 5th.

Class CustomerContext

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

Inheritance
System.Object
CustomerContext
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Mediachase.Commerce.Customers
Assembly: Mediachase.Commerce.dll
Version: 12.17.2
Syntax
public class CustomerContext

Constructors

CustomerContext()

Declaration
public CustomerContext()

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.

GetContactForUser(MembershipUser)

Gets the contact for user.

Declaration
public virtual CustomerContact GetContactForUser(MembershipUser user)
Parameters
Type Name Description
System.Web.Security.MembershipUser user

The user.

Returns
Type Description
CustomerContact

GetContacts()

Gets the customer contacts.

Declaration
[Obsolete("This method is slow and has limitation to only first 1000 objects. Use other overload which paging instead. Will remain at least until November 2019.")]
public IEnumerable<CustomerContact> GetContacts()
Returns
Type Description
System.Collections.Generic.IEnumerable<CustomerContact>

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.

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>

GetUserForContact(ContactEntity)

Gets the user for contact.

Declaration
public MembershipUser GetUserForContact(ContactEntity customerContact)
Parameters
Type Name Description
ContactEntity customerContact

The customer contact.

Returns
Type Description
System.Web.Security.MembershipUser

GetUserForContactId(PrimaryKeyId)

Gets the user for contact id.

Declaration
public MembershipUser GetUserForContactId(PrimaryKeyId customerContactId)
Parameters
Type Name Description
PrimaryKeyId customerContactId

The customer contact id.

Returns
Type Description
System.Web.Security.MembershipUser

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.