Table of Contents

Class Discount

Namespace
Dynamicweb.Ecommerce.Orders.Discounts
Assembly
Dynamicweb.Ecommerce.dll
Represents information about a discount.
public class Discount : DbObject
Inheritance
Discount
Inherited Members

Constructors

Discount()

Initializes a new instance of the Discount class.
public Discount()

Discount(IDataReader)

Initializes a new instance of the Discount class.
[Obsolete("This method is no longer used.")]
public Discount(IDataReader reader)

Parameters

reader IDataReader

Properties

Active

Gets or sets the value indicating whether instance is active.
public bool Active { get; set; }

Property Value

bool

Actual

Gets a value indicating whether this order time lays within "valid from - valid to" interval.
public bool Actual { get; }

Property Value

bool

AddFreeShipping

public bool AddFreeShipping { get; set; }

Property Value

bool

Amount

Gets or sets the fixed discount amount of the instance.
public double Amount { get; set; }

Property Value

double

AmountIncludesVat

public bool AmountIncludesVat { get; set; }

Property Value

bool

AmountProductFieldName

Gets or sets the name of amount product field of the discount.
public string AmountProductFieldName { get; set; }

Property Value

string

AnonymousUsers

public bool AnonymousUsers { get; set; }

Property Value

bool

AssignableFromProducts

Gets or sets the value indicating whether instance is assignable from products and groups.
public bool AssignableFromProducts { get; set; }

Property Value

bool

CampaignColor

public string CampaignColor { get; set; }

Property Value

string

CampaignImage

public string CampaignImage { get; set; }

Property Value

string

CampaignName

Gets or sets the default campaign name
public string CampaignName { get; set; }

Property Value

string

CheckForValidationReason

Gets the value which indicates that validation reason should be checked
public bool CheckForValidationReason { get; set; }

Property Value

bool

Country

Gets or sets the country of the discount.
public Country Country { get; set; }

Property Value

Country

CountryCode2

Gets or sets the country code of the country the discount is valid for Null is all countries.
public string CountryCode2 { get; set; }

Property Value

string

CreatedBy

public int CreatedBy { get; set; }

Property Value

int

CreatedDate

public DateTime? CreatedDate { get; set; }

Property Value

DateTime?

Currency

Gets or sets the currency of the discount.
public Currency Currency { get; set; }

Property Value

Currency

Exceptions

Exception
Thrown when DiscountType property is DiscountTypes.Percentage and the value is not set to null.

CurrencyCode

Gets or sets the currency code of the currency the fixed discount amount / loyalty point rate.
public string CurrencyCode { get; set; }

Property Value

string

Description

Gets or sets the default description of the instance.
public string Description { get; set; }

Property Value

string

DiscountApplyToProduct

Gets or sets the DiscountApplyToProduct of the instance.
public DiscountApplyToProduct DiscountApplyToProduct { get; set; }

Property Value

DiscountApplyToProduct

DiscountApplyType

Gets or sets the DiscountApplyType of the instance.
public DiscountApplyType DiscountApplyType { get; set; }

Property Value

DiscountApplyType

DiscountType

Gets or sets the DiscountType of the instance.
public DiscountTypes DiscountType { get; set; }

Property Value

DiscountTypes

ExcludedProductsAndGroupsIds

public string ExcludedProductsAndGroupsIds { get; set; }

Property Value

string

Extender

Gets a reference To the extender instance
public DiscountExtenderBase Extender { get; }

Property Value

DiscountExtenderBase

ExtenderSettings

Gets or sets the extender parameters.
public string ExtenderSettings { get; set; }

Property Value

string

ExtenderType

Gets Or sets the name of the extender type.
public string ExtenderType { get; set; }

Property Value

string

ExternalId

Gets or sets the external id
public string ExternalId { get; set; }

Property Value

string

HasProductRestrictions

public bool HasProductRestrictions { get; }

Property Value

bool

IsApplyDiscountOnce

public bool IsApplyDiscountOnce { get; set; }

Property Value

bool

Language

Gets or sets the language of the discount.
public Language Language { get; set; }

Property Value

Language

LanguageId

Gets or sets the ID of the language the discount is valid for Null is all languages.
public string LanguageId { get; set; }

Property Value

string

LoyaltyPointsRate

public double LoyaltyPointsRate { get; set; }

Property Value

double

MaximumLimits

public List<DiscountLimit> MaximumLimits { get; set; }

Property Value

List<DiscountLimit>

Name

Gets or sets the default name of the instance.
public string Name { get; set; }

Property Value

string

OnlyApplyToNonDiscountedItems

public bool OnlyApplyToNonDiscountedItems { get; set; }

Property Value

bool

OrderContextId

Gets or sets the order context id of the discount.
public string OrderContextId { get; set; }

Property Value

string

OrderFieldName

Gets or sets the name of order field of the discount.
public string OrderFieldName { get; set; }

Property Value

string

OrderFieldValue

Gets or sets the required value of the order field specified in the OrderFieldName property.
public string OrderFieldValue { get; set; }

Property Value

string

OrderTotalPrice

Gets or sets the order total price condition. Default value is 0.00
public double OrderTotalPrice { get; set; }

Property Value

double

OrderTotalPriceCondition

Gets or sets the conditional operator for comparing the order total price.
public OrderTotalPriceCondition OrderTotalPriceCondition { get; set; }

Property Value

OrderTotalPriceCondition

OrderTotalPriceCurrencyCode

Gets or sets the order total price condition currency
public string OrderTotalPriceCurrencyCode { get; set; }

Property Value

string

Payment

Gets or sets the payment of the discount.
public Payment Payment { get; set; }

Property Value

Payment

PaymentId

Gets or sets the Id of the payment the discount is valid for Null is all payments.
public string PaymentId { get; set; }

Property Value

string

Percentage

Gets or sets the discount percentage of the instance.
public double Percentage { get; set; }

Property Value

double

Priority

public int Priority { get; set; }

Property Value

int

ProductAsDiscount

Gets or sets the product and/or product variant that acts as a discount.
public Product ProductAsDiscount { get; set; }

Property Value

Product

ProductIdByDiscount

Gets or sets the ID of the product that acts as a discount.
public string ProductIdByDiscount { get; set; }

Property Value

string

ProductQuantification

Gets or sets the product quantification the discount uses when validating product quantities.
public ProductQuantification ProductQuantification { get; set; }

Property Value

ProductQuantification

ProductQuantity

Gets or sets the product quantity required for the discount to be valid.
public double ProductQuantity { get; set; }

Property Value

double

ProductsAndGroupsIds

public string ProductsAndGroupsIds { get; set; }

Property Value

string

ProductVariantIdByDiscount

Gets or sets the ID of the product variant of the product that acts as a discount.
public string ProductVariantIdByDiscount { get; set; }

Property Value

string

Shipping

Gets or sets the shipping of the discount.
public Shipping Shipping { get; set; }

Property Value

Shipping

ShippingAmount

Gets or sets the amount if the discount is a shipping discount.
public double ShippingAmount { get; set; }

Property Value

double
The shipping amount.

ShippingCurrency

Gets or sets the currency code of the shpping amount if the discount is a shipping discount.
public string ShippingCurrency { get; set; }

Property Value

string
The shipping currency.

ShippingId

Gets or set the ID of the shipping the discount is valid for Null is all shipping.
public string ShippingId { get; set; }

Property Value

string

Shop

Gets or sets the shop of the discount.
public Shop Shop { get; set; }

Property Value

Shop

ShopId

Gets or sets the ID of the shop the discount is valid for Null is all shops.
public string ShopId { get; set; }

Property Value

string

StopFurtherProcessing

public bool StopFurtherProcessing { get; set; }

Property Value

bool

Translations

Gets the translations.
public TranslationCollection<DiscountTranslation> Translations { get; }

Property Value

TranslationCollection<DiscountTranslation>

UpdatedBy

public int UpdatedBy { get; set; }

Property Value

int

UpdatedDate

public DateTime? UpdatedDate { get; set; }

Property Value

DateTime?

UsePerCustomer

public int UsePerCustomer { get; set; }

Property Value

int

User

Gets or sets the user of the discount.
public User User { get; set; }

Property Value

User

UserCustomerNumber

Gets or sets the customer number the discount is valid for Null is all customer numbers.
public string UserCustomerNumber { get; set; }

Property Value

string

UserGroup

Gets or sets the user group of the discount.
public Group UserGroup { get; set; }

Property Value

Group

UserGroupId

Gets or sets the Id of the user group the discount is valid for Null is all user groups.
public int? UserGroupId { get; set; }

Property Value

int?

UserId

Gets or sets the ID of the user the discount is valid for Null is all users.
public int? UserId { get; set; }

Property Value

int?

ValidFrom

Gets or sets the date and time from when the instance is valid.
public DateTime? ValidFrom { get; set; }

Property Value

DateTime?

ValidTo

Gets or sets the data and time to which the instance is valid.
public DateTime? ValidTo { get; set; }

Property Value

DateTime?

VoucherList

Gets or set the voucher list of the discount.
[Obsolete("Use GetVoucherList or SetVoucherList instead.")]
public VoucherList VoucherList { get; set; }

Property Value

VoucherList

Exceptions

Exception
Thrown when the OrderFieldName property is not set to “OrderVoucherCode” and the value of this property is not set to null.

VoucherListId

Gets or sets the ID of the voucher list to use when OrderFieldName is “OrderVoucherCode”.
public int? VoucherListId { get; set; }

Property Value

int?

Exceptions

Exception
Trown when OrderFieldName property is not set to “OrderVoucherCode” and value is not set to null.

Methods

ClearCache()

Clears the cache.
[Obsolete("Use Ecommerce.Services.Discounts.ClearCache instead.")]
public static void ClearCache()

Delete()

Deletes the object.
[Obsolete("Use Ecommerce.Services.Discounts.Delete instead.")]
public void Delete()

Delete(Discount)

Deletes the instance of an OrderDiscount on the database.
[Obsolete("Use Ecommerce.Services.Discounts.Delete instead.")]
public static void Delete(Discount orderDiscount)

Parameters

orderDiscount Discount

Delete(DiscountCollection)

Deletes the instances of OrderDiscounts in the OrderDiscountCollection on the database.
[Obsolete("Use Ecommerce.Services.Discounts.Delete instead.")]
public static void Delete(DiscountCollection orderDiscounts)

Parameters

orderDiscounts DiscountCollection

Delete(string)

Deletes the instances of OrderDiscounts in the OrderDiscountCollection on the database.
[Obsolete("Use Ecommerce.Services.Discounts.Delete instead.")]
public static void Delete(string orderDiscountIDs)

Parameters

orderDiscountIDs string

Fill(IDataReader)

Fills the specified data reader.
[Obsolete("This method is no longer used.")]
public override void Fill(IDataReader reader)

Parameters

reader IDataReader
The data reader.

FillRow(DataRow)

Fills the data row.
[Obsolete("This method is no longer used.")]
protected override void FillRow(DataRow row)

Parameters

row DataRow
The data row.

GetCampaignName(string)

Gets the translated campaign name in specified language
public string GetCampaignName(string languageId)

Parameters

languageId string

Returns

string

GetDescription(string)

Gets the translated description in specified language
public string GetDescription(string languageId)

Parameters

languageId string

Returns

string

GetDiscountById(long)

Gets the discount from the cache with the specified Id.
[Obsolete("Use Ecommerce.Services.Discounts.GetDiscount instead.")]
public static Discount GetDiscountById(long id)

Parameters

id long

Returns

Discount
Returns an Discount instance.

GetDiscounts()

Gets all discounts from the cache.
[Obsolete("Use Ecommerce.Services.Discounts.GetDiscounts instead.")]
public static DiscountCollection GetDiscounts()

Returns

DiscountCollection
Returns an DiscountCollection.

GetDiscounts(DiscountApplyType)

Gets the discounts with specified OrderDiscount.OrderDiscountType from the cache.
[Obsolete("Use Ecommerce.Services.Discounts.GetDiscounts instead.")]
public static DiscountCollection GetDiscounts(DiscountApplyType orderDiscountType)

Parameters

orderDiscountType DiscountApplyType

Returns

DiscountCollection
Returns an DiscountCollection.

GetDiscounts(int, int, SortBy, SortDirection)

Gets the discounts from the cache sorted by the specified comparer in the specified zero-indexed range.
[Obsolete("Use Ecommerce.Services.Discounts.GetDiscounts instead.")]
public static Tuple<int, DiscountCollection> GetDiscounts(int rangeStart, int rangeEnd, SortBy sortBy, SortDirection sortDirection)

Parameters

rangeStart int
rangeEnd int
sortBy SortBy
sortDirection SortDirection

Returns

Tuple<int, DiscountCollection>
Returns a Tuple<T1, T2>.

GetName(string)

Gets the translated name in specified language
public string GetName(string languageId)

Parameters

languageId string

Returns

string

GetOrderDiscounts()

Get the discounts with the OrderDiscount.OrderDiscountType.OrderDiscount.
[Obsolete("Use Ecommerce.Services.Discounts.GetDiscounts instead.")]
public static DiscountCollection GetOrderDiscounts()

Returns

DiscountCollection
Returns an DiscountCollection.

GetOrderLineDiscounts()

Get the discounts with the OrderDiscount.OrderDiscountType.OrderLineDiscount.
[Obsolete("Use Ecommerce.Services.Discounts.GetDiscounts instead.")]
public static DiscountCollection GetOrderLineDiscounts()

Returns

DiscountCollection
Returns an DiscountCollection.

GetVoucherList()

Gets the voucher list of the discount.
public VoucherList GetVoucherList()

Returns

VoucherList

Save()

Saves current data to the database.
[Obsolete("Use Ecommerce.Services.Discounts.Save instead.")]
public override void Save()

Save(Discount)

Saves the instance of an OrderDiscount.
[Obsolete("Use Ecommerce.Services.Discounts.Save instead.")]
public static void Save(Discount orderDiscount)

Parameters

orderDiscount Discount

Save(DiscountCollection)

Saves the instances of OrderDiscounts in the OrderDiscountCollection to the database.
[Obsolete("Use Ecommerce.Services.Discounts.Save instead.")]
public static void Save(DiscountCollection orderDiscounts)

Parameters

orderDiscounts DiscountCollection

SetCampaignName(string, string)

Sets the translated campaign name in specified language
public void SetCampaignName(string languageId, string campaignName)

Parameters

languageId string
campaignName string

SetDescription(string, string)

Sets the translated description in specified language
public void SetDescription(string languageId, string description)

Parameters

languageId string
description string

SetName(string, string)

Sets the translated name in specified language
public void SetName(string languageId, string name)

Parameters

languageId string
name string

SetVoucherList(VoucherList)

Set the voucher list of the discount.
public void SetVoucherList(VoucherList voucherList)

Parameters

voucherList VoucherList

Exceptions

Exception
Thrown when the OrderFieldName property is not set to “OrderVoucherCode” and the value of this property is not set to null.
To top