Exemplo n.º 1
0
 public ProdCafeteria(string nombre, string descripcion, double precio, double peso, eCategoria categoria, EsubCategoria subCategoria) : base(nombre, descripcion, precio, peso, categoria)
 {
     this.nombre       = nombre;
     this.descripcion  = descripcion;
     this.Precio       = precio;
     this.peso         = peso;
     this.categoria    = categoria;
     this.subCategoria = subCategoria;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Makes all the procedure to add a product to a list
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns>the product in his child class</returns>
        public static Producto SerializeProd <T>() where T : Producto
        {
            //List<T> data = new List<T>();

            Console.Write("Nombre:  ");
            string name = Console.ReadLine();

            Console.Write("Descripcion:  ");
            string desc = Console.ReadLine();

            Console.Write("Precio:  ");
            double price = double.Parse(Console.ReadLine());

            Console.Write("Peso: ");
            double weight = double.Parse(Console.ReadLine());



            Console.WriteLine("Seleccione una categoria");

            eCategoria auxCategoria = eCategoria.Cafeteria;

            int selection = GetEnumInConsole <eCategoria>(auxCategoria);


            auxCategoria = (eCategoria)selection;


            switch (auxCategoria)
            {
            case eCategoria.Hamburguesa:

                //Ask if wants it in combo
                Console.WriteLine("Combo");
                ECombo combo = ECombo.Sin_Combo;
                selection = GetEnumInConsole <ECombo>(combo);
                combo     = (ECombo)selection;

                Console.Write("Bebida? Y/N");
                string desition = Console.ReadLine();

                if (desition.ToUpper() == "Y")
                {
                    DesserializarEnMasa(Dummy.Bebidas);
                    Console.Write("Nombre de la bebida: ");
                    desition = Console.ReadLine();
                    Bebida comboDrink = (Bebida)Dummy.Bebidas.Where(b => b.nombre.ToUpper() == desition.ToUpper()).FirstOrDefault();

                    ProdHamburgueseria toAdd = new ProdHamburgueseria(name, desc, price, weight, eCategoria.Hamburguesa, combo, comboDrink);
                    //ProductosController.AddProducto(toAdd);
                    return(toAdd);
                }
                else
                {
                    Bebida             comboDrink = (Bebida)Dummy.Bebidas.First(b => b.nombre.ToUpper() == "SIN BEBIDA");
                    ProdHamburgueseria toAdd      = new ProdHamburgueseria(name, desc, price, weight, eCategoria.Hamburguesa, combo, comboDrink);
                    //ProductosController.AddProducto(toAdd);
                    return(toAdd);
                }



                break;



            case eCategoria.Cafeteria:
                //Ask if wants it in combo
                Console.WriteLine("Sub categoria");
                EsubCategoria subCat = EsubCategoria.Cafe;
                selection = GetEnumInConsole <EsubCategoria>(subCat);
                subCat    = (EsubCategoria)selection;

                ProdCafeteria toAddCaf = new ProdCafeteria(name, desc, price, weight, auxCategoria, subCat);

                //ProductosController.AddProducto(toAddCaf);

                return(toAddCaf);

                break;

            case eCategoria.Pasteleria:
                ProdPasteleria toAddPast = new ProdPasteleria(name, desc, price, weight, auxCategoria);
                //ProductosController.AddProducto(toAddPast);
                return(toAddPast);

                break;

            case eCategoria.Postre:
                Console.WriteLine("Sub categoria");
                ESabores flavor = ESabores.Combinado;
                selection = GetEnumInConsole <ESabores>(flavor);
                flavor    = (ESabores)selection;

                ProdHeladeria toAddHel = new ProdHeladeria(name, desc, price, weight, auxCategoria, flavor);
                //ProductosController.AddProducto(toAddHel);
                return(toAddHel);

                break;

            default:
                return(null);

                break;
            }
        }