Exemple #1
0
 protected Producto(string nombre, string descripcion, double precio, double peso, eCategoria categoria)
 {
     this.nombre      = nombre;
     this.descripcion = descripcion;
     this.Precio      = precio;
     this.peso        = peso;
     this.categoria   = categoria;
 }
Exemple #2
0
 public Bebida(string nombre, string descripcion, double precio, double peso, eCategoria categoria, ETipo tipo) : base(nombre, descripcion, precio, peso, categoria)
 {
     this.nombre      = nombre;
     this.descripcion = descripcion;
     this.Precio      = precio;
     this.peso        = peso;
     this.categoria   = eCategoria.Cafeteria;
     this.Tipo        = tipo;
 }
        protected void repCategoria_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            Literal  litTitulo    = (Literal)e.Item.FindControl("litTitulo");
            Repeater repPromocion = (Repeater)e.Item.FindControl("repPromocion");

            if (litTitulo != null && repPromocion != null)
            {
                eCategoria        oItem      = (eCategoria)e.Item.DataItem;
                List <ePromocion> lPromocion = HttpServices.GetList_Promocion(oItem.id);

                if (lPromocion.Count > 0)
                {
                    litTitulo.Text          = oItem.titulo;
                    repPromocion.DataSource = lPromocion;
                    repPromocion.DataBind();
                }
                else
                {
                    e.Item.Visible = false;
                }
            }
        }
Exemple #4
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;
 }
 public ProdHeladeria(string nombre, string descripcion, double precio, double peso, eCategoria categoria, ESabores sabor) : base(nombre, descripcion, precio, peso, categoria)
 {
     this.nombre      = nombre;
     this.descripcion = descripcion;
     this.Precio      = precio;
     this.peso        = peso;
     this.categoria   = categoria;
     this.Sabor       = sabor;
 }
        /// <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;
            }
        }
        public static string MenuPrincipal()
        {
            string presionada = "0";


            while (presionada.ToUpper() != "X")
            {
                Console.Write("1 Generar Pedido  2 Buscar producto  3 Agregar nuevo producto\n" +
                              "4 Modificar Producto   5 Eliminar producto  6 Mostrar todos los prods \n 7 salir \n");

                presionada = Console.ReadLine();
                switch (presionada)
                {
                case "1":
                    Pedido newPedido = new Pedido(1, Dummy.GetRandomClient(), DateTime.Now.ToString());

                    Console.Clear();

                    string desition = "";

                    while (desition != "X")
                    {
                        Console.WriteLine("Seleccione Categoria, Ingrese X para generar el ticket, intro para continuar");
                        desition = Console.ReadLine();
                        eCategoria auxCategoria = eCategoria.Cafeteria;
                        if (desition.ToUpper() == "X")
                        {
                            DesserializarEnMasa(newPedido.products);
                            Console.WriteLine("Confirmar pedido Y/N");
                            string confirmacion = Console.ReadLine();
                            if (confirmacion.ToUpper() == "Y")
                            {
                                TicketController <Pedido> .PrintTicket(newPedido);

                                PrintingAnimation();
                            }
                        }
                        else
                        {
                            int selection = GetEnumInConsole <eCategoria>(auxCategoria);


                            auxCategoria = (eCategoria)selection;
                            string name = "";

                            //Hacer que si busca no tire exception
                            switch (auxCategoria)
                            {
                            case eCategoria.Cafeteria:
                                DesserializarEnMasa(Dummy.Cafeteria);
                                //Añado el producto a el pedido dependiendo del nombre445rrrrr (colaboracion de scon)fggggggggggggggggggggggggggrrrrrrrrr
                                name = Console.ReadLine();
                                if (!string.IsNullOrEmpty(name))
                                {
                                    try
                                    {
                                        newPedido.products.Add(Dummy.Cafeteria.Where(p => p.nombre.ToUpper() == name.ToUpper()).First());
                                    }
                                    catch (InvalidOperationException e)
                                    {
                                        Console.WriteLine("No se encontro ese producto");
                                        name = Console.ReadLine();
                                        newPedido.products.Add(Dummy.Cafeteria.Where(p => p.nombre.ToUpper() == name.ToUpper()).First());
                                    }
                                }

                                else
                                {
                                    Console.WriteLine("Ingrese un nombre de producto");
                                }
                                break;

                            case eCategoria.Hamburguesa:
                                DesserializarEnMasa(Dummy.Hamburguesas);
                                name = Console.ReadLine();
                                if (name != "")
                                {
                                    try
                                    {
                                        newPedido.products.Add(Dummy.Hamburguesas.Where(p => p.nombre.ToUpper() == name.ToUpper()).First());
                                    }
                                    catch (InvalidOperationException e)
                                    {
                                        Console.WriteLine("No se encontro ese producto");
                                        name = Console.ReadLine();
                                        newPedido.products.Add(Dummy.Hamburguesas.Where(p => p.nombre.ToUpper() == name.ToUpper()).First());
                                    }
                                }

                                break;

                            case eCategoria.Pasteleria:
                                DesserializarEnMasa(Dummy.Pasteleria);
                                name = Console.ReadLine();
                                if (name != "")
                                {
                                    try
                                    {
                                        newPedido.products.Add(Dummy.Pasteleria.Where(p => p.nombre.ToUpper() == name.ToUpper()).First());
                                    }
                                    catch (InvalidOperationException e)
                                    {
                                        Console.WriteLine("No se encontro ese producto");
                                        name = Console.ReadLine();
                                        newPedido.products.Add(Dummy.Pasteleria.Where(p => p.nombre.ToUpper() == name.ToUpper()).First());
                                    }
                                }
                                break;

                            default:
                                break;
                            }
                        }
                    }
                    break;

                case "2":
                    FindProd();
                    break;


                case "3":
                    try
                    {
                        ProductosController.AddProducto(SerializeProd <Producto>());
                    }
                    catch (NullReferenceException e)
                    {
                        Console.WriteLine("Por favor ingrese datos validos");
                    }

                    break;

                case "4":
                    ShowAllProds();

                    List <string> res = FindProd();

                    ProductosController.UpdateProd(res[0], SerializeProd <Producto>());
                    break;

                case "5":
                    Console.Clear();
                    ShowAllProds();
                    List <string> response = FindProd();
                    ProductosController.DeleteProd(response[0], response[1]);
                    break;

                case "6":
                    Console.Clear();
                    ShowAllProds();
                    Console.ReadKey();
                    Console.Clear();
                    break;

                case "7":
                    Environment.Exit(0);
                    break;
                }
            }



            return(presionada);
        }
        public DataTable showCatalogo(eCategoria categoria)
        {
            // Bien... Tenemos que crear un adaptador para volcar los datos de la BD en un objeto DataSet
            MySqlDataReader reader;
            // Creamos nuestro queridisimo DataSet
            DataTable datos = new DataTable();
            try
            {
                string sql = "prendasal.SP_SHOW_CATALOGO";
                MySqlCommand cmd = new MySqlCommand(sql, conn.conection);
                cmd.CommandType = CommandType.StoredProcedure;
                MySqlParameter cat = cmd.Parameters.Add("cat", MySqlDbType.VarChar, 50);
                cat.Direction = ParameterDirection.Input;

                cat.Value = categoria.ToString();

                reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    datos.Load(reader);
                }
                reader.Close();
            }
            catch (Exception e)
            {
                MessageBox.Show("ERROR AL CONSULTAR CATALOGO", "ERROR EN CONSULTA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return datos;
        }
Exemple #9
0
        //public Hamburguesa(string nombre, string descripcion, double precio, double peso, eCategoria categoria,ECombo combo) : base(nombre, descripcion, precio, peso, categoria)
        //{
        //    this.nombre = nombre;
        //    this.descripcion = descripcion;
        //    this.Precio = precio;
        //    this.peso = peso;
        //    this.categoria = categoria;
        //    this.Combo = combo;
        //}

        public ProdHamburgueseria(string nombre, string descripcion, double precio, double peso, eCategoria categoria, ECombo combo, Bebida bebida) : base(nombre, descripcion, precio, peso, categoria)
        {
            this.nombre      = nombre;
            this.descripcion = descripcion;
            this.Precio      = precio;
            this.peso        = peso;
            this.categoria   = categoria;
            this.Combo       = combo;
            this.bebida      = bebida;
        }