Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            cart = Serializacion.Cargar();
            BigSis sis = new BigSis();

            market = new List <Product>();
            SupplyStore();
            while (true)
            {
                PrintHeader();
                Console.WriteLine("¿Que quieres hacer?\n");
                Console.WriteLine("\t1. Ver Receta");
                Console.WriteLine("\t2. Comprar");
                Console.WriteLine("\t3. Ver carrito");
                Console.WriteLine("\t4. Pagar");
                Console.WriteLine("\t5. Salir");
                while (true)
                {
                    String answer = Console.ReadLine();
                    if (answer == "1")
                    {
                        ShowRecipe();
                        break;
                    }
                    else if (answer == "2")
                    {
                        WalkAround();
                        break;
                    }
                    else if (answer == "3")
                    {
                        PrintCart();
                        break;
                    }
                    else if (answer == "4")
                    {
                        Pay();
                        break;
                    }
                    else if (answer == "5")
                    {
                        Serializacion.Guardar(cart);
                        Environment.Exit(1);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public static void WalkAround()
        {
            BigSis sis = new BigSis();

            PrintHeader();
            Console.WriteLine("¿Que deseas comprar?\n\n");
            for (int i = 0; i < market.Count(); i++)
            {
                PrintProduct(i, market[i]);
            }
            while (true)
            {
                try
                {
                    int answer = Convert.ToInt32(Console.ReadLine());
                    if (answer >= market.Count())
                    {
                        continue;
                    }
                    AddToCart(market[answer]);

                    /*
                     * //Hermana revisa carro
                     *
                     * foreach (Product producto in cart)
                     * {
                     *  sis.ChequearCarrito(producto.aa);
                     *  sis.RetirarProducto(cart, market[answer]);
                     *
                     * }
                     * Console.WriteLine("holi");
                     * //reviso ya
                     */
                    break;
                }
                catch
                {
                    continue;
                }
            }
        }