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
Actual
Gets a value indicating whether this order time lays within "valid from - valid to" interval.
public bool Actual { get; }
Property Value
AddFreeShipping
public bool AddFreeShipping { get; set; }
Property Value
Amount
Gets or sets the fixed discount amount of the instance.
public double Amount { get; set; }
Property Value
AmountIncludesVat
public bool AmountIncludesVat { get; set; }
Property Value
AmountProductFieldName
Gets or sets the name of amount product field of the discount.
public string AmountProductFieldName { get; set; }
Property Value
AnonymousUsers
public bool AnonymousUsers { get; set; }
Property Value
AssignableFromProducts
Gets or sets the value indicating whether instance is assignable from products and groups.
public bool AssignableFromProducts { get; set; }
Property Value
CampaignColor
public string CampaignColor { get; set; }
Property Value
CampaignImage
public string CampaignImage { get; set; }
Property Value
CampaignName
Gets or sets the default campaign name
public string CampaignName { get; set; }
Property Value
CheckForValidationReason
Gets the value which indicates that validation reason should be checked
public bool CheckForValidationReason { get; set; }
Property Value
Country
Gets or sets the country of the discount.
public Country Country { get; set; }
Property Value
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
CreatedBy
public int CreatedBy { get; set; }
Property Value
CreatedDate
public DateTime? CreatedDate { get; set; }
Property Value
Currency
Gets or sets the currency of the discount.
public Currency Currency { get; set; }
Property Value
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
Description
Gets or sets the default description of the instance.
public string Description { get; set; }
Property Value
DiscountApplyToProduct
Gets or sets the DiscountApplyToProduct of the instance.
public DiscountApplyToProduct DiscountApplyToProduct { get; set; }
Property Value
DiscountApplyType
Gets or sets the DiscountApplyType of the instance.
public DiscountApplyType DiscountApplyType { get; set; }
Property Value
DiscountType
Gets or sets the DiscountType of the instance.
public DiscountTypes DiscountType { get; set; }
Property Value
ExcludedProductsAndGroupsIds
public string ExcludedProductsAndGroupsIds { get; set; }
Property Value
Extender
Gets a reference To the extender instance
public DiscountExtenderBase Extender { get; }
Property Value
ExtenderSettings
Gets or sets the extender parameters.
public string ExtenderSettings { get; set; }
Property Value
ExtenderType
Gets Or sets the name of the extender type.
public string ExtenderType { get; set; }
Property Value
ExternalId
Gets or sets the external id
public string ExternalId { get; set; }
Property Value
HasProductRestrictions
public bool HasProductRestrictions { get; }
Property Value
IsApplyDiscountOnce
public bool IsApplyDiscountOnce { get; set; }
Property Value
Language
Gets or sets the language of the discount.
public Language Language { get; set; }
Property Value
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
LoyaltyPointsRate
public double LoyaltyPointsRate { get; set; }
Property Value
MaximumLimits
public List<DiscountLimit> MaximumLimits { get; set; }
Property Value
Name
Gets or sets the default name of the instance.
public string Name { get; set; }
Property Value
OnlyApplyToNonDiscountedItems
public bool OnlyApplyToNonDiscountedItems { get; set; }
Property Value
OrderContextId
Gets or sets the order context id of the discount.
public string OrderContextId { get; set; }
Property Value
OrderFieldName
Gets or sets the name of order field of the discount.
public string OrderFieldName { get; set; }
Property Value
OrderFieldValue
Gets or sets the required value of the order field specified in the OrderFieldName property.
public string OrderFieldValue { get; set; }
Property Value
OrderTotalPrice
Gets or sets the order total price condition. Default value is 0.00
public double OrderTotalPrice { get; set; }
Property Value
OrderTotalPriceCondition
Gets or sets the conditional operator for comparing the order total price.
public OrderTotalPriceCondition OrderTotalPriceCondition { get; set; }
Property Value
OrderTotalPriceCurrencyCode
Gets or sets the order total price condition currency
public string OrderTotalPriceCurrencyCode { get; set; }
Property Value
Payment
Gets or sets the payment of the discount.
public Payment Payment { get; set; }
Property Value
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
Percentage
Gets or sets the discount percentage of the instance.
public double Percentage { get; set; }
Property Value
Priority
public int Priority { get; set; }
Property Value
ProductAsDiscount
Gets or sets the product and/or product variant that acts as a discount.
public Product ProductAsDiscount { get; set; }
Property Value
ProductIdByDiscount
Gets or sets the ID of the product that acts as a discount.
public string ProductIdByDiscount { get; set; }
Property Value
ProductQuantification
Gets or sets the product quantification the discount uses when validating product quantities.
public ProductQuantification ProductQuantification { get; set; }
Property Value
ProductQuantity
Gets or sets the product quantity required for the discount to be valid.
public double ProductQuantity { get; set; }
Property Value
ProductsAndGroupsIds
public string ProductsAndGroupsIds { get; set; }
Property Value
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
Shipping
Gets or sets the shipping of the discount.
public Shipping Shipping { get; set; }
Property Value
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
Shop
Gets or sets the shop of the discount.
public Shop Shop { get; set; }
Property Value
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
StopFurtherProcessing
public bool StopFurtherProcessing { get; set; }
Property Value
Translations
Gets the translations.
public TranslationCollection<DiscountTranslation> Translations { get; }
Property Value
UpdatedBy
public int UpdatedBy { get; set; }
Property Value
UpdatedDate
public DateTime? UpdatedDate { get; set; }
Property Value
UsePerCustomer
public int UsePerCustomer { get; set; }
Property Value
User
Gets or sets the user of the discount.
public User User { get; set; }
Property Value
UserCustomerNumber
Gets or sets the customer number the discount is valid for Null is all customer numbers.
public string UserCustomerNumber { get; set; }
Property Value
UserGroup
Gets or sets the user group of the discount.
public Group UserGroup { get; set; }
Property Value
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
ValidTo
Gets or sets the data and time to which the instance is valid.
public DateTime? ValidTo { get; set; }
Property Value
VoucherList
Gets or set the voucher list of the discount.
[Obsolete("Use GetVoucherList or SetVoucherList instead.")]
public VoucherList VoucherList { get; set; }
Property Value
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
GetDescription(string)
Gets the translated description in specified language
public string GetDescription(string languageId)
Parameters
languageId
string
Returns
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
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
intrangeEnd
intsortBy
SortBysortDirection
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
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
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
SetDescription(string, string)
Sets the translated description in specified language
public void SetDescription(string languageId, string description)
Parameters
SetName(string, string)
Sets the translated name in specified language
public void SetName(string languageId, string name)
Parameters
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.