Пример #1
0
        /// <summary>
        /// Gets the number of units to sell from the user, then applies it to the inventory
        /// </summary>
        private void Sell()
        {
            Product.ProductType productType;
            //
            // Get the number of units to sell from the view
            //
            int numToSell = _consoleView.DisplayGetNumberOfUnitsToSell(out productType);

            //
            // Subtract that number from the product stock
            //
            if (numToSell > 0)
            {
                _salesPerson.CurrentStock[productType].SubtractProducts(numToSell);
                if (_salesPerson.CitiesVisited.Count > 0)
                {
                    _salesPerson.CitiesVisited.Last().SellProducts(numToSell);
                }
            }

            //
            // If there is a back order, warn the user
            //
            if (_salesPerson.CurrentStock[productType].OnBackOrder)
            {
                _consoleView.DisplayBackorderNotification(_salesPerson.CurrentStock[productType]);
            }
        }
Пример #2
0
        private void Sell()
        {
            int numberOfUnits = _consoleView.DisplayGetNumberOfUnitsToSell(_salesperson.CurrentStock);

            _salesperson.CurrentStock.SubtractProducts(numberOfUnits);

            if (_salesperson.CurrentStock.OnBackorder)
            {
                _consoleView.DisplayBackorderNotification(_salesperson.CurrentStock, numberOfUnits);
            }
        }