Guides

InvoiceService

The Invoice service allows you to manage invoices.

Instantiating

The InvoiceService is exposed through the MerchelloContext

var invoiceService = MerchelloContext.Current.Services.InvoiceService;

Class

public class InvoiceService : PageCachedServiceBase<IInvoice>, 
    IInvoiceService, IStaticCollectionService<IInvoice>, IPageCachedService<IInvoice>, 
    IService

Constructors

NameDescription
InvoiceService()Initializes a new instance of the InvoiceService class.
InvoiceService(ILogger)Initializes a new instance of the InvoiceService class.

Public Methods

NameDescription
AddToCollection(Guid, Guid)Add an invoice to a collection.
AddToCollection(IInvoice, IEntityCollection)Add an invoice to a collection.
AddToCollection(IInvoice, Guid)Add an invoice to a collection.
CountInvoicesGets the total count of all IInvoice
CreateInvoice(Guid, Boolean)Creates a IInvoice without saving it to the database
CreateInvoice(Guid, Int32, Boolean)Creates a IInvoice with an assigned invoice number without saving it to the database
Delete(IInvoice, Boolean)Deletes a single IInvoice
Delete(IEnumerable(IInvoice), Boolean)Deletes a collection IInvoice
ExistsInCollectionDetermines if an invoice exists in a collection.
GetAllInvoiceStatusesReturns a collection of all IInvoiceStatus
GetByInvoiceNumberGets a IInvoice given it's unique 'InvoiceNumber'
GetByKeyGets a IInvoice given it's unique 'key' (GUID)
GetByKeysGets list of IInvoice objects given a list of Keys
GetDistinctCurrencyCodesGets distinct currency codes used in invoices
GetFromCollection(Guid, Int64, Int64, String, SortDirection)Gets invoices from a collection
GetFromCollection(Guid, String, Int64, Int64, String, SortDirection)Gets invoices from a collection
GetInvoicesByCustomerKeyGetInvoicesByDateRange
GetInvoicesByDateRangeGetInvoicesByDateRange
GetInvoicesByPaymentKeyGets a collection of IInvoice objects that are associated with a IPayment by the payments 'key'
GetPageGets a page of invoices
RemoveFromCollection(Guid, Guid)Removes an invoice from a collection
RemoveFromCollection(IInvoice, IEntityCollection)Removes an invoice from a collection
RemoveFromCollection(IInvoice, Guid)Removes an invoice from a collection
Save(IInvoice, Boolean)Saves a single IInvoice
Save(IEnumerable(IInvoice), Boolean)Saves a collection of IInvoice
SumInvoiceTotalsGets the totals of invoices in a date range for a specific currency code.
SumLineItemTotalsBySkuGets the total of line items for a give SKU invoiced in a specific currency across the date range.

Events

NameDescription
CreatingOccurs before create
CreatedOccurs after create
DeletingOccurs before deleting
DeletedOccurs after deleted
SavingOccurs before saving
SavedOccurs after saved
StatusChangingOccurs before invoice status change
StatusChangedOccurs after invoice status change

Interface on GitHub

https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IInvoiceService.cs