Ejemplo n.º 1
0
        /// <summary>
        /// Method that allows manager to stock the shelves and prompts them accordingly
        /// </summary>
        private void StockShelves()
        {
            _location = validation.ValidateString("Enter the store's name:");
            _address  = validation.ValidateAddress("Enter the store's address in format CityName, ST");
            try{
                _store = _storeLoBL.GetStore(_address, _location);
                if (_store == null)
                {
                    Console.WriteLine("Store Not Found, please add the store");
                    return;
                }
                //_storeLoBL.RemoveStore(_address,_location);
                string breed  = validation.ValidateString("Enter breed of the dog");
                char   gender = validation.ValidateGender("Enter gender of the dog either m or f");
                double price  = validation.ValidateDouble("Enter price of the dog in the form dollars.cents");
                Dog    dog    = new Dog(breed, gender, price);
                int    quant  = validation.ValidateInt("How many? Just enter a number");

                Console.WriteLine(_store.ToString());
                _storeLoBL.AddItem(_store, dog, quant);
                //_storeLoBL.AddStoreLocation(_store);
                Console.WriteLine("Thanks!");
            }catch (Exception e) {
                Log.Error(e.Message);
                Console.WriteLine("Error while stocking");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Over-arching order method that gives customer the tools to perform an order
        /// </summary>
        private void OrderDog()
        {
            string input;
            bool   repeat = true;

            do
            {
                Console.WriteLine("What store would you like to buy from?");
                Console.WriteLine("[0] View list of stores");
                Console.WriteLine("[1] I know what store I want to order from");
                input = Console.ReadLine();
                switch (input)
                {
                case "0":
                    foreach (StoreLocation s in ViewStoreList())
                    {
                        Console.WriteLine(s.ToString());
                    }
                    repeat = false;
                    break;

                case "1":
                    repeat = false;
                    break;

                default:
                    Console.WriteLine("Invalid input");
                    break;
                }
            }while(repeat);
            repeat = true;
            do
            {
                Console.WriteLine("Enter the store you'd like to buy from");
                Console.WriteLine("[0] View list of stores");
                Console.WriteLine("[1] I know what store I want to order from");
                input = Console.ReadLine();
                switch (input)
                {
                case "0":
                    foreach (StoreLocation s in ViewStoreList())
                    {
                        Console.WriteLine(s.ToString());
                    }
                    repeat = false;
                    break;

                case "1":
                    repeat = false;
                    break;

                default:
                    Console.WriteLine("Invalid input");
                    break;
                }
            }while(repeat);

            ViewStoreInv();
            repeat        = true;
            _runningCount = 0;
            //string storeLocation = validation.ValidateString("Enter the store's name:");
            //string storeAddress = validation.ValidateAddress("Enter the store's address in format CityName, ST");
            _dogOrder = new DogOrder(_dogBuyer, 0, _storeLoBL.GetStore(_address, _location));
            do
            {
                char   gender   = validation.ValidateGender("Enter the gender of dog you'd like to purchase");
                string breed    = validation.ValidateString("Enter the breed of the Dog you'd like to purchase");
                int    quant    = validation.ValidateInt("Enter how many you would like to purchase");
                Item   lineItem = _storeLoBL.FindItem(new StoreLocation(_address, _location), new Dog(breed, gender, 1000.0), quant);
                if (lineItem != null)
                {
                    _dogOrder.AddItemToOrder(lineItem);
                    _dogOrder.Total += ((double)quant * lineItem.Dog.Price);
                }
                else
                {
                    Console.WriteLine("Not a valid item");
                }
                Console.WriteLine("Enter c to complete order or any other character to continue");
                if (Console.ReadLine().Equals("c"))
                {
                    repeat = false;
                }
                //get all the items you want to order
            }while(repeat);
            if (_orBL.AddOrder(_dogOrder) == null)
            {
                Console.WriteLine("If you're seeing this, something went terribly wrong");
            }
            //send the list of items to the database and remove them from the store's inventory
        }