示例#1
0
        private void CargarEstante(out Estante est1, out Estante est2)
        {
            //const string filePath = "../../../Estante.txt";
            const string filexmlPath = "../../../Estante.xml";

            est1 = new Estante(4);
            est2 = new Estante(3);
            Harina h1 = new Harina(102, 37.5f, Producto.EMarcaProducto.Favorita,
                                   Harina.ETipoHarina.CuatroCeros);
            Harina h2 = new Harina(103, 40.25f, Producto.EMarcaProducto.Favorita,
                                   Harina.ETipoHarina.Integral);
            Galletita g1 = new Galletita(113, 33.65f, Producto.EMarcaProducto.Pitusas, 250f);
            Galletita g2 = new Galletita(111, 56f, Producto.EMarcaProducto.Diversión, 500f);
            Jugo      j1 = new Jugo(112, 25f, Producto.EMarcaProducto.Naranjú, Jugo.ESaborJugo.Pasable);
            Jugo      j2 = new Jugo(333, 33f, Producto.EMarcaProducto.Swift, Jugo.ESaborJugo.Asqueroso);
            Gaseosa   g  = new Gaseosa(j2, 2250f);

            if (!(est1 + h1))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est1 + g1))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est1 + g2))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est1 + g1))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est1 + j1))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est2 + h2))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est2 + j2))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est2 + g))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est2 + g1))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }

            //File.Delete(filePath);
            //GuardarEstante(filePath, est1);
            //GuardarEstante(filePath, est2);
            Estante.SerializarEstante(filexmlPath, est1);
            //SerializarEstante(filexmlPath, est2);
        }
示例#2
0
        //public void CargarEstante(Estante est1, Estante est2)
        public void CargarEstante(out Estante est1, out Estante est2)
        {
            //Console.Title = "Primer Parcial Laboratorio II - 2016 -";
            //Estante est1 = new Estante(4);//no se puede declarar igual a est1 y est2
            //Estante est2 = new Estante(3);
            Estante estante1 = new Estante(4);
            Estante estante2 = new Estante(3);
            Harina  h1       = new Harina(102, 37.5f, Producto.EMarcaProducto.Favorita,
                                          Harina.ETipoHarina.CuatroCeros);
            Harina h2 = new Harina(103, 40.25f, Producto.EMarcaProducto.Favorita,
                                   Harina.ETipoHarina.Integral);
            Galletita g1 = new Galletita(113, 33.65f, Producto.EMarcaProducto.Pitusas, 250f);
            Galletita g2 = new Galletita(111, 56f, Producto.EMarcaProducto.Diversión, 500f);
            Jugo      j1 = new Jugo(112, 25f, Producto.EMarcaProducto.Naranjú, Jugo.ESaborJugo.Pasable);
            Jugo      j2 = new Jugo(333, 33f, Producto.EMarcaProducto.Swift, Jugo.ESaborJugo.Asqueroso);
            Gaseosa   g  = new Gaseosa(j2, 2250f);

            if (!(estante1 + h1))
            {
                //Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(estante1 + g1))
            {
                // Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(estante1 + g2))
            {
                // Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(estante1 + g1))
            {
                // Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(estante1 + j1))
            {
                //Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(estante2 + h2))
            {
                //Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(estante2 + j2))
            {
                //Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(estante2 + g))
            {
                //Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(estante2 + g1))
            {
                //Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }

            est1 = estante1; //asisgno estante1 a est1 para out
            est2 = estante2; //asisgno estante2 a est2 para out
        }
示例#3
0
        private void CargarEstante(out Estante est1, out Estante est2)
        {
            Estante e1 = new Estante(4);
            Estante e2 = new Estante(3);
            Harina  h1 = new Harina(102, 37.5f, Producto.EMarcaProducto.Favorita,
                                    Harina.ETipoHarina.CuatroCeros);
            Harina h2 = new Harina(103, 40.25f, Producto.EMarcaProducto.Favorita,
                                   Harina.ETipoHarina.Integral);
            Galletita g1 = new Galletita(113, 33.65f, Producto.EMarcaProducto.Pitusas, 250f);
            Galletita g2 = new Galletita(111, 56f, Producto.EMarcaProducto.Diversión, 500f);
            Jugo      j1 = new Jugo(112, 25f, Producto.EMarcaProducto.Naranjú, Jugo.ESaborJugo.Pasable);
            Jugo      j2 = new Jugo(333, 33f, Producto.EMarcaProducto.Swift, Jugo.ESaborJugo.Asqueroso);
            Gaseosa   g  = new Gaseosa(j2, 2250f);

            if (!(e1 + h1))
            {
                // MessageBox.Show("No se pudo agregar el producto al estante!!!");
            }
            if (!(e1 + g1))
            {
                //MessageBox.Show("No se pudo agregar el producto al estante!!!");
            }
            if (!(e1 + g2))
            {
                //MessageBox.Show("No se pudo agregar el producto al estante!!!");
            }
            if (!(e1 + g1))
            {
                //MessageBox.Show("No se pudo agregar el producto al estante!!!");
            }
            if (!(e1 + j1))
            {
                //MessageBox.Show("No se pudo agregar el producto al estante!!!");
            }
            if (!(e2 + h2))
            {
                //MessageBox.Show("No se pudo agregar el producto al estante!!!");
            }
            if (!(e2 + j2))
            {
                //MessageBox.Show("No se pudo agregar el producto al estante!!!");
            }
            if (!(e2 + g))
            {
                //MessageBox.Show("No se pudo agregar el producto al estante!!!");
            }
            if (!(e2 + g1))
            {
                //MessageBox.Show("No se pudo agregar el producto al estante!!!");
            }

            est1 = e1;
            est2 = e2;
        }
示例#4
0
        public void  CargarEstante(out Estante est1, out Estante est2)
        {
            Estante est3 = new Estante(4);
            Estante est4 = new Estante(5);

            Harina h1 = new Harina(102, 37.5f, Producto.EMarcaProducto.Favorita, Harina.ETipoHarina.CuatroCeros);

            Harina h2 = new Harina(103, 40.25f, Producto.EMarcaProducto.Favorita, Harina.ETipoHarina.Integral);

            Galletita g1 = new Galletita(113, 33.65f, Producto.EMarcaProducto.Pitusas, 250f);
            Galletita g2 = new Galletita(111, 56f, Producto.EMarcaProducto.Diversión, 500f);

            Jugo j1 = new Jugo(112, 25f, Producto.EMarcaProducto.Naranjú, Jugo.ESaborJugo.Pasable);
            Jugo j2 = new Jugo(333, 33f, Producto.EMarcaProducto.Swift, Jugo.ESaborJugo.Asqueroso);


            if (!(est3 + h1))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est3 + g1))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est3 + g2))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est3 + g1))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est3 + j1))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est4 + h2))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est4 + j2))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }

            if (!(est4 + g1))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }

            est1 = est3;

            est2 = est4;
        }
示例#5
0
        public string MostrarLista()
        {
            StringBuilder sb = new StringBuilder();

            foreach (Producto p in this._productos)
            {
                if (p is Jugo)
                {
                    sb.AppendLine(((Jugo)p).MostrarJugo());
                }
                if (p is Galletita)
                {
                    sb.AppendLine(Galletita.MostrarGalletita((Galletita)p));
                }
                if (p is Gaseosa)
                {
                    sb.AppendLine(((Gaseosa)p).MostrarGaseosa());
                }
            }
            return(sb.ToString());
        }
示例#6
0
        private void button1_Click(object sender, EventArgs e)
        {
            if ((ETipoProducto)comboBoxSabor.SelectedItem == ETipoProducto.Jugo)
            {
                Jugo j = new Jugo(int.Parse(textBoxCode.Text), (EMarcaProducto)comboBoxMarca.SelectedItem,
                                  float.Parse(textBoxPrecio.Text), (ESaborJugo)comboBoxSabor.SelectedItem);
                this._productos.Add(j);
            }

            if ((ETipoProducto)comboBoxSabor.SelectedItem == ETipoProducto.Galletita)
            {
                Galletita Gt = new Galletita(int.Parse(textBoxCode.Text), (EMarcaProducto)comboBoxMarca.SelectedItem,
                                             float.Parse(textBoxPrecio.Text), float.Parse(textBoxLitroPeso.Text));
                comboBoxSabor.Text = "NO CARGAR";
                this._productos.Add(Gt);
            }
            if ((ETipoProducto)comboBoxSabor.SelectedItem == ETipoProducto.Gaseosa)
            {
                Gaseosa Gs = new Gaseosa(int.Parse(textBoxCode.Text), (EMarcaProducto)comboBoxMarca.SelectedItem,
                                         float.Parse(textBoxPrecio.Text), float.Parse(textBoxLitroPeso.Text));
                comboBoxSabor.Text = "NO CARGAR";
                this._productos.Add(Gs);
            }
        }
示例#7
0
        static void Main(string[] args)
        {
            Console.Title = "Primer Parcial Laboratorio II - 2016 -";
            Estante est1 = new Estante(4);
            Estante est2 = new Estante(3);
            Harina  h1   = new Harina(102, 37.5f, Producto.EMarcaProducto.Favorita,
                                      Harina.ETipoHarina.CuatroCeros);
            Harina h2 = new Harina(103, 40.25f, Producto.EMarcaProducto.Favorita,
                                   Harina.ETipoHarina.Integral);
            Galletita g1 = new Galletita(113, 33.65f, Producto.EMarcaProducto.Pitusas, 250f);
            Galletita g2 = new Galletita(111, 56f, Producto.EMarcaProducto.Diversión, 500f);
            Jugo      j1 = new Jugo(112, 25f, Producto.EMarcaProducto.Naranjú, Jugo.ESaborJugo.Pasable);
            Jugo      j2 = new Jugo(333, 33f, Producto.EMarcaProducto.Swift, Jugo.ESaborJugo.Asqueroso);
            Gaseosa   g  = new Gaseosa(j2, 2250f);

            if (!(est1 + h1))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est1 + g1))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est1 + g2))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est1 + g1))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est1 + j1))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est2 + h2))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est2 + j2))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est2 + g))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est2 + g1))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            Console.WriteLine("Valor total Estante1: {0}", est1.ValorEstanteTotal);
            Console.WriteLine("Valor Estante1 sólo de Galletitas: {0}",
                              est1.GetValorEstante(Producto.ETipoProducto.Galletita));
            Console.WriteLine("Contenido Estante1:\n{0}", Estante.MostrarEstante(est1));
            Console.WriteLine("Estante ordenado por Código de Barra....");
            //est1.GetProductos().Sort(Program.OrdenarProductos);
            Console.WriteLine(Estante.MostrarEstante(est1));
            est1 = est1 - Producto.ETipoProducto.Galletita;
            Console.WriteLine("Estante1 sin Galletitas: {0}", Estante.MostrarEstante(est1));
            Console.WriteLine("Contenido Estante2:\n{0}", Estante.MostrarEstante(est2));
            est2 -= Producto.ETipoProducto.Todos;
            Console.WriteLine("Contenido Estante2:\n{0}", Estante.MostrarEstante(est2));
            Console.ReadLine();
        }
示例#8
0
        static void Main(string[] args)
        {
            Estante est1 = new Estante(3);
            Estante est2 = new Estante(2);

            Producto  p  = new Producto(222, EMarcaProducto.Manaos, 50.25f);
            Galletita g1 = new Galletita(113, 33.65f, EMarcaProducto.Pitusas, 250f);
            Galletita g2 = new Galletita(111, 56f, EMarcaProducto.Diversión, 500f);
            Jugo      j1 = new Jugo(112, 25f, EMarcaProducto.Naranjú, ESaborJugo.Pasable);
            Jugo      j2 = new Jugo(333, 33f, EMarcaProducto.Swift, ESaborJugo.Asqueroso);
            Gaseosa   g  = new Gaseosa(p, 2250f);

            if (!(est1 + g1))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est1 + g2))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est1 + g1))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est1 + j1))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }

            if (!(est2 + g))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est2 + p))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }
            if (!(est2 + j2))
            {
                Console.WriteLine("No se pudo agregar el producto al estante!!!");
            }

            Console.WriteLine(est1.ValorEstanteTotal);
            Console.WriteLine(est1.GetValorEstante(ETipoProducto.Galletita));
            Console.WriteLine(Estante.MostrarEstante(est1));

            Console.WriteLine("Estante ordenado....");
            est1.GetProductos().Sort(Program.OrdenarProductos);
            Console.WriteLine(Estante.MostrarEstante(est1));


            est1 = est1 - ETipoProducto.Galletita;
            Console.WriteLine(Estante.MostrarEstante(est1));

            Console.ReadLine();

            Console.WriteLine(Estante.MostrarEstante(est2));
            est2 -= ETipoProducto.Todos;
            Console.WriteLine(Estante.MostrarEstante(est2));

            Console.ReadLine();
        }
示例#9
0
        static void Main(string[] args)
        {
            #region instancias
            Estante e1 = new Estante(4);
            Estante e2 = new Estante(6);


            Jugo j1 = new Jugo(1245, EMarcaProducto.Diversion, 2.50f, ESaborJugo.Asqueroso);
            Jugo j2 = new Jugo(4512, EMarcaProducto.Manaos, 2.50f, ESaborJugo.Pasable);
            Jugo j3 = new Jugo(5487, EMarcaProducto.Naranju, 2.50f, ESaborJugo.Rico);
            Jugo j4 = new Jugo(5487, EMarcaProducto.Pitusas, 2.50f, ESaborJugo.Asqueroso);

            Galletita g1 = new Galletita(4578, EMarcaProducto.Diversion, 10.00f, 500f);
            Galletita g2 = new Galletita(5469, EMarcaProducto.Manaos, 10.00f, 1000f);
            Galletita g3 = new Galletita(5214, EMarcaProducto.Naranju, 10.00f, 200f);
            Galletita g4 = new Galletita(5987, EMarcaProducto.Pitusas, 10.00f, 100f);

            Gaseosa gs1 = new Gaseosa(4515, EMarcaProducto.Diversion, 5.00f, 600f);
            Gaseosa gs2 = new Gaseosa(4578, EMarcaProducto.Manaos, 5.00f, 550f);
            Gaseosa gs3 = new Gaseosa(5548, EMarcaProducto.Swift, 5.00f, 550f);
            Gaseosa gs4 = new Gaseosa(3256, EMarcaProducto.Pitusas, 5.00f, 550f);
            #endregion

            if (e1 + j1)
            {
                e1.Productos.Add(j1);
            }
            if (e1 + j2)
            {
                e1.Productos.Add(j2);
            }
            if (e1 + g1)
            {
                e1.Productos.Add(g1);
            }
            if (e1 + gs1)
            {
                e1.Productos.Add(gs1);
            }
            if (e1 + gs2)
            {
                e1.Productos.Add(gs2);
            }

            Console.Write("Valor total del estante: ");
            Console.WriteLine(e1.ValorEstanteTotal.ToString());

            Console.ReadKey();
            Console.Clear();

            Console.Write("Valor solo de gaseosas: ");
            Console.WriteLine(e1.GetValorEstante(ETipoProducto.Gaseosa));

            Console.Write("Valor solo de Jugos: ");
            Console.WriteLine(e1.GetValorEstante(ETipoProducto.Jugo));

            Console.Write("Valor solo de galletitas: ");
            Console.WriteLine(e1.GetValorEstante(ETipoProducto.Galletita));

            Console.ReadKey();
            Console.Clear();

            Console.WriteLine(e1.MostrarEstante(e1));

            Console.ReadKey();
            Console.Clear();

            Console.WriteLine("Ordeno por codigo");
            e1.Productos.Sort(e1.OrdenarPorCodigo);
            Console.WriteLine(e1.MostrarEstante(e1));

            Console.ReadKey();
            Console.Clear();

            Console.WriteLine("Quito un jugo y muestro de nuevo el estante");
            e1 -= j2;
            Console.WriteLine(e1.MostrarEstante(e1));

            Console.ReadKey();
            Console.Clear();

            Console.WriteLine("Quito todos los jugos");
            e1 -= ETipoProducto.Jugo;
            Console.WriteLine(e1.MostrarEstante(e1));

            Console.ReadKey();
            Console.Clear();
        }