Пример #1
0
        private int GetCostForItems(StockKeepingUnit stockControlUnit, int numberOfUnits)
        {
            if (stockControlUnit.HasMultibuyOffer && numberOfUnits > 1)
            {
                int cost = numberOfUnits / stockControlUnit.MultibuyUnitsRequired * stockControlUnit.MultibuyPrice;
                cost += numberOfUnits % stockControlUnit.MultibuyUnitsRequired * stockControlUnit.UnitPrice;

                return cost;
            }

            return stockControlUnit.UnitPrice * numberOfUnits;
        }
Пример #2
0
        public void Scan(string sku)
        {
            StockKeepingUnit stockControlUnit = stockControl.GetStockControlUnit(sku);

            if (basket.ContainsKey(stockControlUnit))
            {
                basket[stockControlUnit]++;
            }
            else
            {
                basket.Add(stockControlUnit, 1);
            }
        }