예제 #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
        }
        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.Diversion, 500f); Jugo j1 = new Jugo(112, 25f, Producto.EMarcaProducto.Naranju, 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(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 - ETipoProducto.Galletita; Console.WriteLine("Estante1 sin Galletitas: {0}", Estante.MostrarEstante(est1));

            Console.WriteLine("Contenido Estante2:\n{0}", Estante.MostrarEstante(est2)); est2 -= ETipoProducto.Todos; Console.WriteLine("Contenido Estante2:\n{0}", Estante.MostrarEstante(est2));

            Console.ReadLine();
        }
예제 #4
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;
        }
예제 #5
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;
        }