Table of Contents

Class Discount

Namespace
Dynamicweb.Ecommerce.Discounts
Assembly
Dynamicweb.Ecommerce.dll
The class Discount represents information about discount.
[Obsolete("Sales discount functionality is obsolete. Use Dynamicweb.Ecommerce.Orders.Discounts.* instead.")]
[Serializable]
public sealed class Discount : IWithPrice
Inheritance
Discount
Implements
Inherited Members

Constructors

Discount(PriceContext, Product, string, long, IProductDiscount, string, string)

Initializes a new instance of the Discount class.
public Discount(PriceContext context, Product product, string unitId, long stockLocationId, IProductDiscount productDiscount, string salesDiscountName, string salesDiscountDescription)

Parameters

context PriceContext
The price context.
product Product
The product.
unitId string
The unit identifier.
stockLocationId long
productDiscount IProductDiscount
The product discount.
salesDiscountName string
Name of the sales discount.
salesDiscountDescription string
Sales discount description.
See Also

Discount(Product, IProductDiscount, string, string, Currency, Country)

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

Parameters

product Product
The product.
productDiscount IProductDiscount
The product discount.
salesDiscountName string
Name of the sales discount.
salesDiscountDescription string
Sales discount description.
currency Currency
country Country
See Also

Discount(Product, IProductDiscount, string, string, Currency, Country, string, int, string)

Initializes a new instance of the Discount class.
[Obsolete("Use constructor overload which takes a PriceContext")]
public Discount(Product product, IProductDiscount productDiscount, string salesDiscountName, string salesDiscountDescription, Currency currency, Country country, string unitId, int userId, string shopId)

Parameters

product Product
The product.
productDiscount IProductDiscount
The product discount.
salesDiscountName string
Name of the sales discount.
salesDiscountDescription string
Sales discount description.
currency Currency
country Country
unitId string
The unit used to determine price from pricematrix rules for product
userId int
The user used to determine price from pricematrix rules for product
shopId string
The Shop used to determine price from pricematrix rules for product
See Also

Discount(ref Product, ref IProductDiscount, ref SalesDiscount)

Initializes a new instance of the Discount class.
[Obsolete("Use constructor overload which takes a PriceContext")]
public Discount(ref Product product, ref IProductDiscount productDiscount, ref SalesDiscount salesDiscount)

Parameters

product Product
The product.
productDiscount IProductDiscount
The product discount.
salesDiscount SalesDiscount
The sales discount.
See Also

Discount(ref Product, ref IProductDiscount, ref string)

Initializes a new instance of the Discount class.
[Obsolete("Use constructor overload which takes a PriceContext")]
public Discount(ref Product product, ref IProductDiscount productDiscount, ref string salesDiscountName)

Parameters

product Product
The product.
productDiscount IProductDiscount
The product discount.
salesDiscountName string
Name of the sales discount.
See Also

Discount(ref Product, ref IProductDiscount, ref string, ref string)

Initializes a new instance of the Discount class.
[Obsolete("Use constructor overload which takes a PriceContext")]
public Discount(ref Product product, ref IProductDiscount productDiscount, ref string salesDiscountName, ref string salesDiscountDescription)

Parameters

product Product
The product.
productDiscount IProductDiscount
The product discount.
salesDiscountName string
Name of the sales discount.
salesDiscountDescription string
Sales discount description.
See Also

Properties

ApplyType

public string ApplyType { get; set; }

Property Value

string
See Also

CampaignColor

Gets the campaign color.
public string CampaignColor { get; set; }

Property Value

string
The campaign color.
See Also

CampaignImage

Gets the campaign image.
public string CampaignImage { get; set; }

Property Value

string
The campaign image.
See Also

CampaignName

Gets the campaign name.
public string CampaignName { get; set; }

Property Value

string
The campaign name.
See Also

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

Description

Gets the description.
public string Description { get; }

Property Value

string
The description.
See Also

ID

Gets the ID.
public string ID { get; }

Property Value

string
The discount ID.
See Also

Name

Gets the name.
public string Name { get; }

Property Value

string
The name.
See Also

Price

Gets the price.
public PriceInfo Price { get; }

Property Value

PriceInfo
The price.
See Also

Product

Gets the product.
public Product Product { get; }

Property Value

Product
The product.
See Also

ShopId

Gets the shop Id.
public string ShopId { get; }

Property Value

string
See Also

StockLocationId

Gets the stock location Id.
public long StockLocationId { get; }

Property Value

long
See Also

Type

Gets the type.
public DiscountType Type { get; }

Property Value

DiscountType
The discount type.
See Also

UnitId

Gets the unit Id.
public string UnitId { get; }

Property Value

string
See Also

UserId

Gets the user Id.
public int UserId { get; }

Property Value

int
See Also

ValidFrom

Gets or sets the valid from date.
public DateTime? ValidFrom { get; set; }

Property Value

DateTime?
The valid from date. Null if it is not set
See Also

ValidTo

Gets or sets the valid to date.
public DateTime? ValidTo { get; set; }

Property Value

DateTime?
The valid to date. Null if it is not set
See Also

Methods

GetValue(bool, CalculationType, bool)

Gets the value.
public double GetValue(bool includeVat, CalculationType calculationType, bool doRounding)

Parameters

includeVat bool
if set to true [include vat].
calculationType CalculationType
Type of the calculation.
doRounding bool
if set to true [do rounding].

Returns

double
System.Double.

Exceptions

InvalidOperationException
Thrown when Discount value cannot be determined
See Also

RenderDiscount(ref Discount, ref Template)

Renders the discount.
public static void RenderDiscount(ref Discount discount, ref Template template)

Parameters

discount Discount
template Template
The template.
See Also

See Also

To top