80 lines
3.7 KiB
C#
80 lines
3.7 KiB
C#
namespace Netina.Domain.Entities.Discounts;
|
|
|
|
public partial class Discount
|
|
{
|
|
public static Discount Create(string code,string description, int discountPercent, long discountAmount, bool hasCode, DiscountAmountType amountType, DiscountType type,
|
|
int count,bool immortal, DateTime startDate, DateTime expireDate, long priceFloor, bool hasPriceFloor, long priceCeiling,
|
|
bool hasPriceCeiling, bool isInfinity, long useCount, bool isForInvitation,
|
|
bool isForFirstPurchase, bool isSpecialOffer)
|
|
{
|
|
return new Discount(code,
|
|
description,
|
|
discountPercent,
|
|
discountAmount,
|
|
hasCode,
|
|
amountType,
|
|
type,
|
|
count,
|
|
startDate,
|
|
expireDate,
|
|
priceFloor,
|
|
hasPriceFloor,
|
|
priceCeiling,
|
|
hasPriceCeiling,
|
|
isInfinity,
|
|
useCount,
|
|
isForInvitation,
|
|
isSpecialOffer,
|
|
isForFirstPurchase,
|
|
immortal);
|
|
}
|
|
|
|
public bool IsExpired()
|
|
=> !Immortal && ExpireDate.Date < DateTime.Today.Date;
|
|
|
|
public void SetCorporate(Guid marketerId)
|
|
{
|
|
IsForSaleCooperation = true;
|
|
MarketerId = marketerId;
|
|
}
|
|
}
|
|
|
|
public partial class BrandDiscount
|
|
{
|
|
public static BrandDiscount Create(string code, string description, int discountPercent, long discountAmount, bool hasCode, DiscountAmountType amountType, DiscountType type,
|
|
int count, bool immortal, DateTime startDate, DateTime expireDate, long priceFloor, bool hasPriceFloor, long priceCeiling,
|
|
bool hasPriceCeiling, bool isInfinity, long useCount, bool isForInvitation,
|
|
bool isForFirstPurchase, bool isSpecialOffer, Guid brandId)
|
|
{
|
|
return new BrandDiscount(code, description, discountPercent, discountAmount, hasCode, amountType, type, count, immortal, startDate,
|
|
expireDate, priceFloor, hasPriceFloor, priceCeiling, hasPriceCeiling, isInfinity, useCount,
|
|
isForInvitation, isForFirstPurchase, isSpecialOffer, brandId);
|
|
}
|
|
}
|
|
|
|
public partial class ProductDiscount
|
|
{
|
|
public static ProductDiscount Create(string code, string description, int discountPercent, long discountAmount, bool hasCode, DiscountAmountType amountType, DiscountType type,
|
|
int count, bool immortal, DateTime startDate, DateTime expireDate, long priceFloor, bool hasPriceFloor, long priceCeiling,
|
|
bool hasPriceCeiling, bool isInfinity, long useCount, bool isForInvitation,
|
|
bool isForFirstPurchase, bool isSpecialOffer, Guid productId)
|
|
{
|
|
return new ProductDiscount(code,description, discountPercent, discountAmount, hasCode, amountType, type, count,immortal, startDate,
|
|
expireDate, priceFloor, hasPriceFloor, priceCeiling, hasPriceCeiling, isInfinity, useCount,
|
|
isForInvitation, isForFirstPurchase, isSpecialOffer, productId);
|
|
}
|
|
}
|
|
|
|
public partial class CategoryDiscount
|
|
{
|
|
public static CategoryDiscount Create(string code, string description, int discountPercent, long discountAmount, bool hasCode, DiscountAmountType amountType, DiscountType type,
|
|
int count, bool immortal, DateTime startDate, DateTime expireDate, long priceFloor, bool hasPriceFloor, long priceCeiling,
|
|
bool hasPriceCeiling, bool isInfinity, long useCount, bool isForInvitation,
|
|
bool isForFirstPurchase, bool isSpecialOffer, Guid categoryId)
|
|
{
|
|
return new CategoryDiscount(code,description, discountPercent, discountAmount, hasCode, amountType, type, count,immortal, startDate,
|
|
expireDate, priceFloor, hasPriceFloor, priceCeiling, hasPriceCeiling, isInfinity, useCount,
|
|
isForInvitation, isForFirstPurchase,isSpecialOffer, categoryId);
|
|
}
|
|
}
|