C# Class Nop.Services.Discounts.DiscountService

Discount service
Inheritance: IDiscountService
Show file Open project: emilianionascu/NopCommerce

Public Methods

Method Description
DeleteDiscount ( Discount discount ) : void

Delete discount

DeleteDiscountRequirement ( DiscountRequirement discountRequirement ) : void

Delete discount requirement

DeleteDiscountUsageHistory ( Nop.Core.Domain.Discounts.DiscountUsageHistory discountUsageHistory ) : void

Delete discount usage history record

DiscountService ( ICacheManager cacheManager, IRepository discountRepository, IRepository discountRequirementRepository, IRepository discountUsageHistoryRepository, IPluginFinder pluginFinder, IEventPublisher eventPublisher ) : System

Ctor

GetAllDiscountUsageHistory ( int discountId, int customerId, int pageIndex, int pageSize ) : IPagedList

Gets all discount usage history records

GetAllDiscounts ( DiscountType discountType, string couponCode = "", bool showHidden = false ) : IList

Gets all discounts

GetDiscountByCouponCode ( string couponCode, bool showHidden = false ) : Discount

Get discount by coupon code

GetDiscountById ( int discountId ) : Discount

Gets a discount

GetDiscountUsageHistoryById ( int discountUsageHistoryId ) : Nop.Core.Domain.Discounts.DiscountUsageHistory

Gets a discount usage history record

InsertDiscount ( Discount discount ) : void

Inserts a discount

InsertDiscountUsageHistory ( Nop.Core.Domain.Discounts.DiscountUsageHistory discountUsageHistory ) : void

Insert discount usage history record

IsDiscountValid ( Discount discount, Customer customer ) : bool

Check discount requirements

IsDiscountValid ( Discount discount, Customer customer, string couponCodeToValidate ) : bool

Check discount requirements

LoadAllDiscountRequirementRules ( ) : IList

Load all discount requirement rules

LoadDiscountRequirementRuleBySystemName ( string systemName ) : IDiscountRequirementRule

Load discount requirement rule by system name

UpdateDiscount ( Discount discount ) : void

Updates the discount

UpdateDiscountUsageHistory ( Nop.Core.Domain.Discounts.DiscountUsageHistory discountUsageHistory ) : void

Update discount usage history record

Protected Methods

Method Description
CheckDiscountLimitations ( Discount discount, Customer customer ) : bool

Checks discount limitation for customer

Method Details

CheckDiscountLimitations() protected method

Checks discount limitation for customer
protected CheckDiscountLimitations ( Discount discount, Customer customer ) : bool
discount Nop.Core.Domain.Discounts.Discount Discount
customer Nop.Core.Domain.Customers.Customer Customer
return bool

DeleteDiscount() public method

Delete discount
public DeleteDiscount ( Discount discount ) : void
discount Nop.Core.Domain.Discounts.Discount Discount
return void

DeleteDiscountRequirement() public method

Delete discount requirement
public DeleteDiscountRequirement ( DiscountRequirement discountRequirement ) : void
discountRequirement Nop.Core.Domain.Discounts.DiscountRequirement Discount requirement
return void

DeleteDiscountUsageHistory() public method

Delete discount usage history record
public DeleteDiscountUsageHistory ( Nop.Core.Domain.Discounts.DiscountUsageHistory discountUsageHistory ) : void
discountUsageHistory Nop.Core.Domain.Discounts.DiscountUsageHistory Discount usage history record
return void

DiscountService() public method

Ctor
public DiscountService ( ICacheManager cacheManager, IRepository discountRepository, IRepository discountRequirementRepository, IRepository discountUsageHistoryRepository, IPluginFinder pluginFinder, IEventPublisher eventPublisher ) : System
cacheManager ICacheManager Cache manager
discountRepository IRepository Discount repository
discountRequirementRepository IRepository Discount requirement repository
discountUsageHistoryRepository IRepository Discount usage history repository
pluginFinder IPluginFinder Plugin finder
eventPublisher IEventPublisher Event published
return System

GetAllDiscountUsageHistory() public method

Gets all discount usage history records
public GetAllDiscountUsageHistory ( int discountId, int customerId, int pageIndex, int pageSize ) : IPagedList
discountId int Discount identifier
customerId int Customer identifier
pageIndex int Page index
pageSize int Page size
return IPagedList

GetAllDiscounts() public method

Gets all discounts
public GetAllDiscounts ( DiscountType discountType, string couponCode = "", bool showHidden = false ) : IList
discountType DiscountType Discount type; null to load all discount
couponCode string Coupon code to find (exactl match)
showHidden bool A value indicating whether to show hidden records
return IList

GetDiscountByCouponCode() public method

Get discount by coupon code
public GetDiscountByCouponCode ( string couponCode, bool showHidden = false ) : Discount
couponCode string Coupon code
showHidden bool A value indicating whether to show hidden records
return Nop.Core.Domain.Discounts.Discount

GetDiscountById() public method

Gets a discount
public GetDiscountById ( int discountId ) : Discount
discountId int Discount identifier
return Nop.Core.Domain.Discounts.Discount

GetDiscountUsageHistoryById() public method

Gets a discount usage history record
public GetDiscountUsageHistoryById ( int discountUsageHistoryId ) : Nop.Core.Domain.Discounts.DiscountUsageHistory
discountUsageHistoryId int Discount usage history record identifier
return Nop.Core.Domain.Discounts.DiscountUsageHistory

InsertDiscount() public method

Inserts a discount
public InsertDiscount ( Discount discount ) : void
discount Nop.Core.Domain.Discounts.Discount Discount
return void

InsertDiscountUsageHistory() public method

Insert discount usage history record
public InsertDiscountUsageHistory ( Nop.Core.Domain.Discounts.DiscountUsageHistory discountUsageHistory ) : void
discountUsageHistory Nop.Core.Domain.Discounts.DiscountUsageHistory Discount usage history record
return void

IsDiscountValid() public method

Check discount requirements
public IsDiscountValid ( Discount discount, Customer customer ) : bool
discount Nop.Core.Domain.Discounts.Discount Discount
customer Nop.Core.Domain.Customers.Customer Customer
return bool

IsDiscountValid() public method

Check discount requirements
public IsDiscountValid ( Discount discount, Customer customer, string couponCodeToValidate ) : bool
discount Nop.Core.Domain.Discounts.Discount Discount
customer Nop.Core.Domain.Customers.Customer Customer
couponCodeToValidate string Coupon code to validate
return bool

LoadAllDiscountRequirementRules() public method

Load all discount requirement rules
public LoadAllDiscountRequirementRules ( ) : IList
return IList

LoadDiscountRequirementRuleBySystemName() public method

Load discount requirement rule by system name
public LoadDiscountRequirementRuleBySystemName ( string systemName ) : IDiscountRequirementRule
systemName string System name
return IDiscountRequirementRule

UpdateDiscount() public method

Updates the discount
public UpdateDiscount ( Discount discount ) : void
discount Nop.Core.Domain.Discounts.Discount Discount
return void

UpdateDiscountUsageHistory() public method

Update discount usage history record
public UpdateDiscountUsageHistory ( Nop.Core.Domain.Discounts.DiscountUsageHistory discountUsageHistory ) : void
discountUsageHistory Nop.Core.Domain.Discounts.DiscountUsageHistory Discount usage history record
return void