public static decimal CalcOldPrice(Product product, BegemotProduct begemotProduct, BegemotSalePrice sale) { decimal oldPrice; if (sale == null) { oldPrice = begemotProduct.RetailPrice * Context.OldPriceCoefficient; } else { oldPrice = sale.RetailPriceOld * Context.OldPriceCoefficient; } return oldPrice; }
public static decimal CalcSelfPrice(BegemotProduct begemotProduct, BegemotSalePrice sale) { decimal price; if (sale != null) { price = sale.WholeSalePrice; } else { price = Context.WithBegemotDescount(begemotProduct.WholeSalePrice); } return price; }
public void Apply(Product product, BegemotProduct bproduct, BegemotSalePrice bsale) { var needAdd = !product.Sales.Any(s => s.Id == Id); if (needAdd) { product.Sales.Add(this); } product.RecalcPrice(bproduct, bsale); if (Style != null) { product.ReApplyStyle(); } }
public static decimal CalcPrice(Product product, BegemotProduct begemotProduct, BegemotSalePrice bsale, Sale sale) { decimal retPrice = CalcRetailPrice(begemotProduct, bsale); product.Price = retPrice; product.PriceOld = retPrice; if (sale != null) { decimal selfPrice = CalcSelfPrice(begemotProduct, bsale); retPrice = sale.CalcSalePrice(retPrice, selfPrice); product.Price = retPrice; } return retPrice; }
public void LoadFile(string filePath) { var parser = new BegemotParser(); var saleRows = parser.ParseSale(filePath); _data = new List<BegemotSalePrice>(); foreach (var saleRow in saleRows) { var salePrice = new BegemotSalePrice(); salePrice.Article = saleRow.Article; salePrice.RetailPrice = saleRow.RetailPrice; salePrice.WholeSalePrice = saleRow.WholeSalePrice; salePrice.RetailPriceOld = saleRow.RetailPriceOld; salePrice.WholeSalePriceOld = saleRow.WholeSalePriceOld; _data.Add(salePrice); } }
private static decimal CalcBegemotRetailPrice(BegemotProduct begemotProduct, BegemotSalePrice sale) { decimal price; if (sale != null) { price = sale.RetailPriceOld; } else { price = begemotProduct.RetailPrice; } return price; }
public void RecalcPrice(BegemotProduct bproduct, BegemotSalePrice bsale) { var sale = GetActiveSale(); PriceCalculator.CalcPrice(this, bproduct, bsale, sale); }
public decimal CalcMargin(BegemotProduct begemotProduct, BegemotSalePrice sale) { var selfPrice = PriceCalculator.CalcSelfPrice(begemotProduct, sale); var margin = Price - selfPrice; return margin; }
private static decimal CalcRetailPrice(BegemotProduct begemotProduct, BegemotSalePrice bsale) { // розничная цена decimal bRetPrice = CalcBegemotRetailPrice(begemotProduct, bsale); var price = bRetPrice * Context.OldPriceCoefficient; return price; }