Exemple #1
0
        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;
        }
Exemple #2
0
        public static decimal CalcSelfPrice(BegemotProduct begemotProduct, BegemotSalePrice sale)
        {
            decimal price;

            if (sale != null)
            {
                price = sale.WholeSalePrice;
            }
            else
            {
                price = Context.WithBegemotDescount(begemotProduct.WholeSalePrice);
            }

            return price;
        }
Exemple #3
0
        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();
            }
        }
Exemple #4
0
        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);
            }
        }
Exemple #6
0
        private static decimal CalcBegemotRetailPrice(BegemotProduct begemotProduct, BegemotSalePrice sale)
        {
            decimal price;

            if (sale != null)
            {
                price = sale.RetailPriceOld;
            }
            else
            {
                price = begemotProduct.RetailPrice;
            }

            return price;
        }
Exemple #7
0
 public void RecalcPrice(BegemotProduct bproduct, BegemotSalePrice bsale)
 {
     var sale = GetActiveSale();
     PriceCalculator.CalcPrice(this, bproduct, bsale, sale);
 }
Exemple #8
0
        public decimal CalcMargin(BegemotProduct begemotProduct, BegemotSalePrice sale)
        {
            var selfPrice = PriceCalculator.CalcSelfPrice(begemotProduct, sale);

            var margin = Price - selfPrice;

            return margin;
        }
Exemple #9
0
 private static decimal CalcRetailPrice(BegemotProduct begemotProduct, BegemotSalePrice bsale)
 {
     // розничная цена
     decimal bRetPrice = CalcBegemotRetailPrice(begemotProduct, bsale);
     var price = bRetPrice * Context.OldPriceCoefficient;
     return price;
 }