Example #1
0
        /// <summary>
        /// Used to return the quantity of drinks as a string.
        /// </summary>
        /// <param name="typeDrink"></param>
        /// <param name="Drinks"></param>
        /// <returns></returns>
        public string QuantityOfDrinks(string typeDrink, List <Drinks> Drinks)
        {
            Drinks drink = new Drinks();

            drink = Drinks.Find(p => p.Description == typeDrink);
            return(drink.Quantity.ToString());
        }
Example #2
0
        /// <summary>
        /// Recduce the quanity of a drink within a list of Drinks.
        /// </summary>
        /// <param name="TypeDrink"></param>
        /// <param name="Drinks"></param>
        public void ReduceQuantity(string TypeDrink, ref List <Drinks> Drinks)
        {
            Drinks drink = new Drinks();

            drink = Drinks.Find(p => p.Description == TypeDrink);
            drink.Quantity--;
        }
Example #3
0
        /// <summary>
        /// Used to update the quanity of a specific DrinkType and return string of new quantity
        /// </summary>
        /// <param name="DrinkType"></param>
        /// <returns></returns>
        private string UpdateDrinkQuantity(string DrinkType)
        {
            Drinks drink = new Drinks();

            drink.ReduceQuantity(DrinkType, ref Drinks);
            return(drink.QuantityOfDrinks(DrinkType, Drinks));
        }
Example #4
0
 /// <summary>
 /// Add Drink to a list<drinks>
 /// </summary>
 /// <param name="description"></param>
 /// <param name="quantity"></param>
 /// <param name="price"></param>
 /// <param name="VendingMachine"></param>
 public void LoadVendingMachine(string description, int quantity, decimal price, ref List<Drinks> VendingMachine)
 {
     Drinks Drink = new Drinks();
     Drink.Description = description;
     Drink.Quantity = quantity;
     Drink.Price = price;
     VendingMachine.Add(Drink);
 }
Example #5
0
 /// <summary>
 /// Used to load the machine with all the intial values
 /// </summary>
 /// <param name="Drinks"></param>
 private void FillUpVendingMachine(ref List<Drinks> Drinks)
 {
     Drinks Drink = new Drinks();
     Drink.LoadVendingMachine("Cola", 20, 1m,ref Drinks);
     Drink.LoadVendingMachine("RootBeer", 20, 1m, ref Drinks);
     Drink.LoadVendingMachine("LemonLimeSoda", 20, 1m, ref Drinks);
     Drink.LoadVendingMachine("GrapeSoda", 20, 1.5m, ref Drinks);
     Drink.LoadVendingMachine("CreamSoda", 20, 1.5m, ref Drinks);
 }
Example #6
0
 /// <summary>
 /// Used to display the Quantity of all Drinks in machine.
 /// </summary>
 /// <param name="Drinks"></param>
 private void DisplayQuantityofDrinks(ref List<Drinks> Drinks)
 {
     Drinks Drink = new Drinks();
     lblDrinksLeftCola.Text = Drink.QuantityOfDrinks("Cola", Drinks);
     lblDrinksLeftRootBeer.Text = Drink.QuantityOfDrinks("RootBeer", Drinks);
     lblDrinksLeftLemonLime.Text = Drink.QuantityOfDrinks("LemonLimeSoda", Drinks);
     lblDrinksLeftGrapeSoda.Text = Drink.QuantityOfDrinks("GrapeSoda", Drinks);
     lblDrinksLeftCreamSoda.Text = Drink.QuantityOfDrinks("CreamSoda", Drinks);
 }
Example #7
0
        /// <summary>
        /// Add Drink to a list<drinks>
        /// </summary>
        /// <param name="description"></param>
        /// <param name="quantity"></param>
        /// <param name="price"></param>
        /// <param name="VendingMachine"></param>
        public void LoadVendingMachine(string description, int quantity, decimal price, ref List <Drinks> VendingMachine)
        {
            Drinks Drink = new Drinks();

            Drink.Description = description;
            Drink.Quantity    = quantity;
            Drink.Price       = price;
            VendingMachine.Add(Drink);
        }
Example #8
0
        /// <summary>
        /// Used to load the machine with all the intial values
        /// </summary>
        /// <param name="Drinks"></param>
        private void FillUpVendingMachine(ref List <Drinks> Drinks)
        {
            Drinks Drink = new Drinks();

            Drink.LoadVendingMachine("Cola", 20, 1m, ref Drinks);
            Drink.LoadVendingMachine("RootBeer", 20, 1m, ref Drinks);
            Drink.LoadVendingMachine("LemonLimeSoda", 20, 1m, ref Drinks);
            Drink.LoadVendingMachine("GrapeSoda", 20, 1.5m, ref Drinks);
            Drink.LoadVendingMachine("CreamSoda", 20, 1.5m, ref Drinks);
        }
Example #9
0
        /// <summary>
        /// Used to display the Quantity of all Drinks in machine.
        /// </summary>
        /// <param name="Drinks"></param>
        private void DisplayQuantityofDrinks(ref List <Drinks> Drinks)
        {
            Drinks Drink = new Drinks();

            lblDrinksLeftCola.Text      = Drink.QuantityOfDrinks("Cola", Drinks);
            lblDrinksLeftRootBeer.Text  = Drink.QuantityOfDrinks("RootBeer", Drinks);
            lblDrinksLeftLemonLime.Text = Drink.QuantityOfDrinks("LemonLimeSoda", Drinks);
            lblDrinksLeftGrapeSoda.Text = Drink.QuantityOfDrinks("GrapeSoda", Drinks);
            lblDrinksLeftCreamSoda.Text = Drink.QuantityOfDrinks("CreamSoda", Drinks);
        }
Example #10
0
        /// <summary>
        /// Used to update the total sales value based on specific DrinkType
        /// </summary>
        /// <param name="DrinkType"></param>
        /// <returns></returns>
        private string UpdateTotalSales(string DrinkType)
        {
            Drinks drink = new Drinks();

            //Find drink within the list of Drinks
            drink = Drinks.Find(p => p.Description == DrinkType);
            //Convert Total Sales to decimal
            decimal total = decimal.Parse(lblTotalSales.Text, System.Globalization.NumberStyles.Currency);

            //Calculate new total
            total = total + drink.Price;
            return(total.ToString("c"));
        }
Example #11
0
 /// <summary>
 /// Used to update the total sales value based on specific DrinkType
 /// </summary>
 /// <param name="DrinkType"></param>
 /// <returns></returns>
 private string UpdateTotalSales(string DrinkType )
 {
     Drinks drink = new Drinks();
     //Find drink within the list of Drinks
     drink = Drinks.Find(p => p.Description == DrinkType);
     //Convert Total Sales to decimal
     decimal total = decimal.Parse(lblTotalSales.Text,System.Globalization.NumberStyles.Currency);
     //Calculate new total
     total = total + drink.Price;
     return total.ToString("c");
 }
Example #12
0
 /// <summary>
 /// Used to update the quanity of a specific DrinkType and return string of new quantity
 /// </summary>
 /// <param name="DrinkType"></param>
 /// <returns></returns>
 private string UpdateDrinkQuantity(string DrinkType)
 {
     Drinks drink = new Drinks();
     drink.ReduceQuantity(DrinkType, ref Drinks);
     return drink.QuantityOfDrinks(DrinkType, Drinks);
 }
Example #13
0
 /// <summary>
 /// Recduce the quanity of a drink within a list of Drinks.
 /// </summary>
 /// <param name="TypeDrink"></param>
 /// <param name="Drinks"></param>
 public void ReduceQuantity(string TypeDrink, ref List<Drinks> Drinks)
 {
     Drinks drink = new Drinks();
     drink = Drinks.Find(p => p.Description == TypeDrink);
     drink.Quantity--;
 }
Example #14
0
 /// <summary>
 /// Used to return the quantity of drinks as a string.
 /// </summary>
 /// <param name="typeDrink"></param>
 /// <param name="Drinks"></param>
 /// <returns></returns>
 public string QuantityOfDrinks(string typeDrink, List<Drinks> Drinks)
 {
     Drinks drink = new Drinks();
     drink = Drinks.Find(p => p.Description == typeDrink);
     return drink.Quantity.ToString();
 }