コード例 #1
0
        /// <summary>
        /// add the next city location to the list of cities
        /// </summary>
        private City Travel()
        {
            // instantiate new city object
            City _city = new City();

            _city.CityName = _consoleView.DisplayGetNextCity();

            // instantiate a new list of products
            _city.SalesInfo = new List <Product>();

            foreach (Product product in _salesperson.CurrentStock)
            {
                // add products in inventory to city salesInfo list
                _city.SalesInfo.Add(new Product(product.Type, 0, 0));
            }

            //
            // do not add empty strings to list for city names
            if (_city.CityName != "")
            {
                _salesperson.CitiesVisited.Add(_city);
            }

            return(_city);
        }
コード例 #2
0
        /// <summary>
        /// add the next city location to the list of cities
        /// </summary>
        private void Travel()
        {
            string nextCity = _consoleView.DisplayGetNextCity();

            //
            // do not add empty strings to list for city names
            //
            if (nextCity != "")
            {
                _salesperson.CitiesVisited.Add(nextCity);
            }
        }
コード例 #3
0
        /// <summary>
        /// add the next city location to the list of cities
        /// </summary>
        private void Travel()
        {
            string nextCity = _consoleView.DisplayGetNextCity(_salesperson);

            _salesperson.CitiesVisited.Add(nextCity);
        }