CustomerService
Describes the CustomerService
These routines provide a way to generate new customer records. In Merchello, we have two types of customers. Anonymous customers are everyday shoppers who have not authenticated the site and use the AnonymousCustomer class. Authenticated shoppers (members in the Umbraco world) use the Customer class.
The CustomerService is exposed through the MerchelloContext
var customerService = MerchelloContext.Current.Services.CustomerService;
Class
public class CustomerService : PageCachedServiceBase<ICustomer>,
ICustomerService, IPageCachedService<ICustomer>, IService, IStaticCollectionService<ICustomer>
Constructors
Name | Description |
---|---|
CustomerService() | Initializes a new instance of the CustomerService class. |
CustomerService(ILogger) | Initializes a new instance of the CustomerService class. |
CustomerService(RepositoryFactory, ILogger, IAnonymousCustomerService, ICustomerAddressService, IInvoiceService, IPaymentService) | Initializes a new instance of the CustomerService class. |
CustomerService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IAnonymousCustomerService, ICustomerAddressService, IInvoiceService, IPaymentService) | Initializes a new instance of the CustomerService class. |
CustomerService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IEventMessagesFactory, IAnonymousCustomerService, ICustomerAddressService, IInvoiceService, IPaymentService) | Initializes a new instance of the CustomerService class. |
Public Methods
Name | Description |
---|---|
AddToCollection(Guid, Guid) | Add a customer to a collection. |
AddToCollection(ICustomer, IEntityCollection) | Add a customer to a collection. |
AddToCollection(ICustomer, Guid) | Add a customer to a collection. |
CreateAnonymousCustomerWithKey | Creates an IAnonymousCustomer and saves it to the database |
CreateCustomer | Creates a customer without saving to the database |
CreateCustomerWithKey(String) | Creates a customer with the Umbraco login name |
CreateCustomerWithKey(String, String, String, String) | Creates a customer and saves the record to the database |
CustomerCount | Gets the total customer count. |
Delete(IAnonymousCustomer) | Deletes a single IAnonymousCustomer |
Delete(IEnumerable(IAnonymousCustomer)) | Deletes a collection of IAnonymousCustomer objects |
Delete(ICustomerAddress) | Delete(ICustomerAddress) |
Delete(ICustomerAddress) | Deletes a single ICustomer |
Delete(IEnumerable(ICustomer), Boolean) | Deletes a collection ICustomer |
ExistsInCollection | Determines if an customer exists in a collection. |
GetAddressByKey | Gets an address by it's key |
GetAnyByKey | Gets an ICustomer or IAnonymousCustomer by its 'UniqueId' |
GetByCustomerKey(Guid) | Gets a collection of ICustomerAddress by the customer ke |
GetByCustomerKey(Guid, AddressType) | Gets a collection of ICustomerAddress by the customer key filtered by an AddressType |
GetByKey | Gets a customer by its unique id |
GetByKeys | Gets a list of customer give a list of unique keys |
GetByLoginName | Gets a list of customer give a list of unique keys |
GetDefaultCustomerAddress | Gets the default customer address of a certain type |
GetFromCollection(Guid, Int64, Int64, String, SortDirection) | Gets a page of customers from a collection. |
GetFromCollection(Guid, String, Int64, Int64, String, SortDirection) | Gets a page of customers from a collection with a search term. |
GetPage | Gets a page of customers. |
RemoveFromCollection(Guid, Guid) | Removes a customer from a collection |
RemoveFromCollection(ICustomer, IEntityCollection) | Removes a customer from a collection |
RemoveFromCollection(ICustomer, Guid) | Removes a customer from a collection |
Save(ICustomerAddress) | Saves a single ICustomerAddress |
Save(IEnumerable(ICustomerAddress)) | Saves a collection ICustomerAddress |
Save(IAnonymousCustomer, Boolean) | Saves a single IAnonymousCustomer |
Save(ICustomer, Boolean) | Saves a single ICustomer |
Save(IEnumerable(ICustomer), Boolean) | Saves a collection of ICustomer |
Events
Name | Description |
---|---|
Creating | Occurs before create |
Created | Occurs after create |
Deleting | Occurs before delete |
Deleted | Occurs after delete |
Saving | Occurs before saving |
Saved | Occurs after saved |
Interface on GitHub
Updated less than a minute ago