Class Voucher
- Namespace
- Dynamicweb.Ecommerce.Orders.SalesDiscounts
- Assembly
- Dynamicweb.Ecommerce.dll
The class Voucher represents base for discounts on voucher codes.
[Obsolete("Use Dynamicweb.Ecommerce.Orders.Vouchers.Voucher instead.")]
public class Voucher : Voucher
- Inheritance
-
Voucher
- Inherited Members
Constructors
Voucher(IDataReader)
Initializes a new instance of the Voucher class.
public Voucher(IDataReader dataReader)
Parameters
dataReader
IDataReader- The data reader.
Voucher(string, int)
Initializes a new instance of the Voucher class.
public Voucher(string code, int voucherListId)
Parameters
Properties
ID
[Obsolete("Use Id instead.")]
public int ID { get; set; }
Property Value
VoucherAccessUserId
ID of the user who used the voucher
[Obsolete("Use UserId instead.")]
public int? VoucherAccessUserId { get; set; }
Property Value
- int?
Methods
CheckVouchers(List<string>)
Checks the vouchers in the database
public static List<string> CheckVouchers(List<string> vouchers)
Parameters
Returns
Delete()
public void Delete()
Delete(int)
public void Delete(int id)
Parameters
id
int
Fill(IDataReader)
Fills this instance with data from given reader
public void Fill(IDataReader reader)
Parameters
reader
IDataReader- The reader.
GenerateVoucher(int, int)
Generate Voucher
public static string GenerateVoucher(int listId, int numberOfSymbols = 8)
Parameters
listId
int- ID of the list to generate voucher for.
numberOfSymbols
int- optional. Voucher length, in characters.
Returns
- string
- The voucher code
Remarks
If list not exist in db - return null
GenerateVouchers(int, int, int)
Generate Vouchers
public static void GenerateVouchers(int number, int listId, int numberOfSymbols = 8)
Parameters
number
int- Number of vouchers
listId
int- ID of the list to generate vouchers for
numberOfSymbols
int- Number of symbols in voucher code
GetAllVouchers()
Get all vouchers
public static IEnumerable<Voucher> GetAllVouchers()
Returns
GetAllVouchersForList(int)
Get the collection of vouchers for specific List
public static IEnumerable<Voucher> GetAllVouchersForList(int listId)
Parameters
listId
int- List ID
Returns
GetDiscountForVoucher()
Get discount for current voucher
public SalesDiscount GetDiscountForVoucher()
Returns
GetDiscountForVoucher(int)
[Obsolete("Use GetDiscountForVoucher(voucherCode As string) instead")]
public static SalesDiscount GetDiscountForVoucher(int voucherCode)
Parameters
voucherCode
int
Returns
GetDiscountForVoucher(string)
Get the discount by voucher code
public static SalesDiscount GetDiscountForVoucher(string voucherCode)
Parameters
voucherCode
string- Voucher code
Returns
GetVoucherByCode(string)
Get Voucher by Voucher Code
public static Voucher GetVoucherByCode(string voucherCode)
Parameters
voucherCode
string
Returns
GetVoucherByCode(string, int)
Get Voucher by Voucher Code
public static Voucher GetVoucherByCode(string voucherCode, int listId)
Parameters
Returns
IsValid(string, int)
Check If voucher is valid and can be applied
public static bool IsValid(string voucherCode, int listId)
Parameters
Returns
Load(int)
public void Load(int id)
Parameters
id
int
RenderVoucherMail(Voucher, string, string)
Renders the mail template for the vouchers
public static string RenderVoucherMail(Voucher voucher, string userName, string userEmail)
Parameters
voucher
Voucher- Voucher object
userName
string- User Name
userEmail
string- User email to send voucher to
Returns
Save()
public void Save()
UpdateVouchersOrderId(string, string)
Update Voucher Code with Order
public static void UpdateVouchersOrderId(string orderId, string newOrderId)