Ejemplo n.º 1
0
        /// <summary>
        /// Add new goods
        /// </summary>
        private static void addNewGoods()
        {
            string _name;
            double _price;
            int    _expirationCountDays;

            Console.Write("\tWrite Goods Name:");
            _name = Console.ReadLine();

            bool pr = false;

            do
            {
                Console.Write("\tWrite Goods Price:");
                pr = double.TryParse(Console.ReadLine(), out _price);
            } while (!pr);

            do
            {
                Console.Write("\tWrite Goods Expiration Days:");
                pr = int.TryParse(Console.ReadLine(), out _expirationCountDays);
            } while (!pr);

            try
            {
                GoodsLogic.AddGoods(new Goods(_name, _price, _expirationCountDays));
                Console.WriteLine("\tSuccessfully");
            }
            catch (Exception e)
            {
                Console.WriteLine("\tError. Something went wrong!)", e.Message);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// First Insert Goods for example
 /// </summary>
 private static void AddNEWListGoodsForExample()
 {
     GoodsLogic.AddGoods(new Goods("Bread", 10, 5));
     GoodsLogic.AddGoods(new Goods("Milk", 10, 10));
     GoodsLogic.AddGoods(new Goods("Eage", 10, 15));
 }