Table of Contents

Class DiscountCollection

Namespace
Dynamicweb.Ecommerce.Discounts
Assembly
Dynamicweb.Ecommerce.dll
Represents a collection of discounts.
[Obsolete("Sales discount functionality is obsolete. Use Dynamicweb.Ecommerce.Orders.Discounts.* instead.")]
[Serializable]
public sealed class DiscountCollection : Collection<Discount>, IList<Discount>, ICollection<Discount>, IReadOnlyList<Discount>, IReadOnlyCollection<Discount>, IEnumerable<Discount>, IList, ICollection, IEnumerable, IWithPrice
Inheritance
DiscountCollection
Implements
Inherited Members
Extension Methods

Constructors

DiscountCollection(PriceContext, Product, string, long)

Initializes a new instance of the DiscountCollection class.
public DiscountCollection(PriceContext context, Product product, string unitId, long stockLocationId)

Parameters

context PriceContext
Price context.
product Product
Product.
unitId string
Unit identifier.
stockLocationId long
Stock location identifier.
See Also

DiscountCollection(Product, Currency, Country)

Initializes a new instance of the DiscountCollection class.
[Obsolete("Use constructor overload which takes a PriceContext")]
public DiscountCollection(Product product, Currency currency, Country country)

Parameters

product Product
The product.
currency Currency
The currency.
country Country
The country.
See Also

DiscountCollection(Product, Currency, Country, string)

Initializes a new instance of the DiscountCollection class.
[Obsolete("Use constructor overload which takes a PriceContext")]
public DiscountCollection(Product product, Currency currency, Country country, string unitId)

Parameters

product Product
The product.
currency Currency
The currency.
country Country
The country.
unitId string
See Also

DiscountCollection(Product, Currency, Country, string, string)

Initializes a new instance of the DiscountCollection class.
[Obsolete("Use constructor overload which takes a PriceContext")]
public DiscountCollection(Product product, Currency currency, Country country, string unitId, string shopId)

Parameters

product Product
The product.
currency Currency
The currency.
country Country
The country.
unitId string
shopId string
See Also

DiscountCollection(ref Product)

Initializes a new instance of the DiscountCollection class.
[Obsolete("Use constructor overload which takes a PriceContext")]
public DiscountCollection(ref Product product)

Parameters

product Product
The product.
See Also

Properties

Country

Gets the country.
public Country Country { get; }

Property Value

Country
See Also

Currency

Gets the currency.
public Currency Currency { get; }

Property Value

Currency
See Also

Difference

Gets the difference.
public double Difference { get; }

Property Value

double
The difference.
See Also

HasDiscounts

Gets a value indicating whether this instance has discounts.
public bool HasDiscounts { get; }

Property Value

bool
true if this instance has discounts; otherwise, false.
See Also

Price

Returns the price for the product when discounts are subtracted.
public PriceInfo Price { get; }

Property Value

PriceInfo
The price.
See Also

PriceWithDifference

Gets the price with difference.
public double PriceWithDifference { get; }

Property Value

double
The price with difference.
See Also

TotalDiscount

Gets the total discount.
public PriceInfo TotalDiscount { get; }

Property Value

PriceInfo
The total discount.
See Also

Methods

ClearCache()

Clears the cache.
public static void ClearCache()
See Also

GetTotal(bool, CalculationType, bool)

Returns the total discount in a number of different ways.
public double GetTotal(bool includeVat, CalculationType calculateAs, bool doRounding)

Parameters

includeVat bool
Should VAT be included in the returned discount
calculateAs CalculationType
Indicates wheter the result should be returned as an amount or as a percentage of the original product price
doRounding bool
Should the result be rounded. If the propertys return result is percentage and rounding is in effect, the result will be with two decimals

Returns

double
System.Double.

Exceptions

InvalidOperationException
Thrown when Unable to parse calculated percent from discount total/product price
ArgumentException
Thrown when calculateAs is not known as discount calculation type
See Also

GetTotalDiscount()

Gets the total discount.
public PriceInfo GetTotalDiscount()

Returns

PriceInfo
The total discount.
See Also

See Also

To top