コード例 #1
0
        /// <summary>
        /// Agrega una remera a la db
        /// </summary>
        /// <param name="remera">Remera</param>
        /// <returns></returns>
        public bool AgregarRemera(Remera remera)
        {
            bool retorno = false;

            try
            {
                string command = "INSERT INTO Cuadros(sku, nombre, ubicacionArte, precio) " +
                                 "VALUES(@sku, @nombre, @ubicacionEstampa, @precio)";

                SqlCommand sqlCommand = new SqlCommand(command, this.sqlConnection);
                sqlCommand.Parameters.AddWithValue("sku", remera.Sku);
                sqlCommand.Parameters.AddWithValue("nombre", remera.Nombre);
                sqlCommand.Parameters.AddWithValue("ubicacionEstampa", remera.UbicacionEstampa);
                sqlCommand.Parameters.AddWithValue("precio", remera.Precio);


                this.sqlConnection.Open();
                sqlCommand.ExecuteNonQuery();
            }
            finally
            {
                if (sqlConnection != null &&
                    sqlConnection.State == System.Data.ConnectionState.Open)
                {
                    this.sqlConnection.Close();
                }
            }

            return(retorno);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Pantalon pantalon1 = new Pantalon(Etipo.Corto, "M", "pantalon1");
            Pantalon pantalon2 = new Pantalon(Etipo.Largo, "S", "pantalon2");
            Pantalon pantalon3 = new Pantalon(Etipo.Corto, "XL", "pantalon3");

            Remera remera1 = new Remera(EColores.Azul, "S", "remera1");
            Remera remera2 = new Remera(EColores.Negro, "S", "remera2");
            Remera remera3 = new Remera(EColores.Verde, "M", "remera3");

            Deposito <Articulo> depo = new Deposito <Articulo>(6);

            depo.Agregar(pantalon1);
            depo.Agregar(pantalon2);
            depo.Agregar(pantalon3);


            depo.Agregar(remera1);
            depo.Agregar(remera2);
            depo.Agregar(remera3);

            Console.WriteLine(depo);

            Console.ReadKey();
        }
コード例 #3
0
        public ActionResult NuevaRemera(Remera remera)
        {
            RemerasViewModel vm = new RemerasViewModel();

            new GestorRemeras().AgregarRemera(remera);
            vm.listaRemerasVer = new GestorRemeras().mostrarRemeras();
            return(View("MostrarRemeras", vm));
        }
コード例 #4
0
        public void ValidarEstampaException()
        {
            //Arange & Act
            Remera r1 = new Remera("RE0001", "El padrino frase", 1590f, @"\re0001\estampa");

            //Assert
            //Assert.IsNotNull(r1);
        }
コード例 #5
0
        public void InstanciarRemera()
        {
            //Arange & Act
            Remera r1 = new Remera("RE0001", "El padrino frase", 1590f, @"\re0001\estampa.ai");

            //Assert
            Assert.IsNotNull(r1);
        }
コード例 #6
0
        /// <summary>
        /// Borra un row recibiendo una remera (lo hace por el SKU, pq no puse el ID como atributo de remera)
        /// </summary>
        /// <param name="remera">Remera a borrar de la DB</param>
        /// <returns></returns>
        public bool BorrarRowPorRemera(Remera remera)
        {
            bool retorno = false;

            if (!(remera is null))
            {
                this.BorrarRowsDB(new List <string> {
                    remera.Sku
                }, "Sku");
                retorno = true;
            }
            return(retorno);
        }
コード例 #7
0
        //Declaro dos articulos e intento agregarlos al deposito
        public void TestAgregar()
        {
            //ARRANGE
            Pantalon            pantalon = new Pantalon(Etipo.Corto, "S", "AGF233");
            Remera              remera   = new Remera(EColores.Negro, "M", "SFH400");
            Deposito <Articulo> deposito = new Deposito <Articulo>(4);
            bool resultado1;
            bool resultado2;

            //ACT
            resultado1 = deposito.Agregar(pantalon);
            resultado2 = deposito.Agregar(remera);
            //ASSERT
            Assert.IsTrue(resultado1 && resultado2);
        }
コード例 #8
0
        //métodos que se encargan de agregar de forma manual cada producto a sus respectivos arrays
        private void cargarCamisetas()
        {
            Vestimenta r = new Remera("Remera Gucci", "Jersey de algodón negro \n \n Iridiscente Gucci vintage logo print \n \n Cuello redondo \n \n Ajuste de gran tamaño \n \n 100% algodón \n \n Hecho en Italia", "Logo Gucci Tradicional", 3500, 250, idProducto);

            r.Talles.Add("M");
            r.Talles.Add("XL");
            r.Talles.Add("XXL");    //se setean los talles y colores disponibles para ese producto

            r.Colores.Add("Negro");
            r.Colores.Add("Blanco");

            idProducto++;     //cada producto tendrá su identificador único

            camisetas.Add(r); //se agrega la instancia al array, con información del producto, modelo, descripción, talles, colores etc.

            r = new Remera("Remera Gucci", "Jersey de algodón blanco roto \n \n Impresión de la boca \n \n Estampado gucci \n \n Ajuste de gran tamaño \n \n 100% algodón \n \n Hecho en Italia ", "Logo Gucci con Boca", 2300, 100, idProducto);

            r.Talles.Add("XL");
            r.Talles.Add("XXL");

            r.Colores.Add("Blanco");

            idProducto++;

            camisetas.Add(r);

            r = new Remera("Remera Gucci", "Jersey de algodón lavado negro \n \n Logo vintage de gucci \n \n Aplique de leopardo bordado \n \n Ajuste de gran tamaño \n \n 100% algodón \n \n Hecho en Italia ", "Logo Gucci con Leopardo", 3200, 75, idProducto);

            r.Talles.Add("XL");

            r.Colores.Add("Blanco");
            r.Colores.Add("Negro");

            idProducto++;

            camisetas.Add(r);
        }
コード例 #9
0
        static void Main(string[] args)
        {
            Pantalon pantalon1 = new Pantalon(Etipo.Corto, "M", "pantalon1");
            Pantalon pantalon2 = new Pantalon(Etipo.Largo, "S", "pantalon2");
            Pantalon pantalon3 = new Pantalon(Etipo.Corto, "XL", "pantalon3");

            Remera remera1 = new Remera(EColores.Azul, "S", "remera1");
            Remera remera2 = new Remera(EColores.Negro, "S", "remera1");
            Remera remera3 = new Remera(EColores.Verde, "M", "remera3");

            Deposito depo = new Deposito(6);

            depo += pantalon1;
            depo += pantalon2;
            depo += pantalon3;

            depo += remera1;
            depo += remera2;
            depo += remera3;

            Console.WriteLine(depo);

            Console.ReadKey();
        }
コード例 #10
0
        static void Main(string[] args)
        {
            //INSTANCIO UN NUEVO NEGOCIO Y LE AGREGO DOS VENTAS ACTUALES
            Negocio n1 = new Negocio("Quality Artworks");
            Venta   v1 = new Venta("Federico", "Davila");
            Venta   v2 = new Venta("Ariel", "Bruschini");

            n1.Ventas.Add(v1);
            n1.Ventas.Add(v2);

            // GENERO ALGUNOS PRODUCTOS DE STOCK (O SEA, LOS PRODUCTOS QUE ESTAN EN EL CATALOGO PARA QUE EL CLIENTE ELIJA)
            // EXISTEN CUADROS Y REMERAS, QUE AMBOS HERREDAN DE PRODUCTOS.
            Remera r1  = new Remera("RE0001", "El Padrino", 1590, "RE0001.ai");
            Remera r2  = new Remera("RE0002", "Bataman", 1590, "RE0002.ai");
            Remera r3  = new Remera("RE0003", "El Hombre arana", 1590, "RE0003.ai");
            Remera r4  = new Remera("RE0004", "Programador fracasado", 1590, "RE0004.ai");
            Cuadro c1  = new Cuadro("CU0001", "Beatles a Hard Days Night", 2800, "CU0001.jpg", "50x40");
            Cuadro c2  = new Cuadro("CU0002", "La noche de los muertos vivos", 2800, "CU0002.jpg", "50x40");
            Cuadro c3  = new Cuadro("CU0003", "Pink Floyd", 2800, "CU0003.jpg", "50x40");
            bool   rta = false;

            try
            {
                //// AGREGO PRODUCTOS AL NEGOCIO (EN LA VERSION FINAL SE AGREGARIAN DESDE LA DB)
                rta = n1 + r1;
                rta = n1 + r2;
                rta = n1 + r3;
                rta = n1 + r4;
                rta = n1 + r1; // NO DEBE CARGARLO
                rta = n1 + c1;
                rta = n1 + c2;
                rta = n1 + c3;
                rta = n1 + c1; // NO DEBE CARGARLO

                // SE REALIZA LA VENTA AGREGANDO PRODUCTOS A CADA VENTA INSTANCIADA
                // SE DEBE INSTANCIAR UNA NUEVA REMERA PQ SE NECESITA SI O SI ESPECIFICAR TALLE Y COLOR EN LA VENTA
                // PORQUE EN EL CATALOGO DE REMERAS NO ES NECESARIO TENER TALLE Y COLOR YA QUE SE HACEN A PEDIDO
                rta = v1 + new Remera(r1, Remera.ETalle.L, Remera.EColor.Blanco);
                rta = v1 + new Remera(r2, Remera.ETalle.M, Remera.EColor.Rojo);
                rta = v1 + new Remera(r4, Remera.ETalle.XL, Remera.EColor.Azul);
                rta = v1 + c1;
                rta = v1 + c2;

                rta = v2 + new Remera(r2, Remera.ETalle.M, Remera.EColor.Rojo);
                rta = v2 + new Remera(r4, Remera.ETalle.XL, Remera.EColor.Azul);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            // ESTO GENERA UN INFORME INTERNO PARA QUE LOS EMPLEADOS SEPAN QUE PRODUCTOS DEBEN HACER (SIN CONOCER PRECIO DE VENTA).
            // ES SOLO PARA ESO INTERNO DE LA EMPRESA.
            InformeProduccion informe = new InformeProduccion();

            informe.GenerarInformeDeProduccion(@"D:\informe.txt", n1.Ventas);

            // EXISTE UN METODO PARA GENERAR LA FACTURA QUE USA LA SOBRECARGA DEL TOSTRING DE CADA VENTA.
            Console.WriteLine(n1.Ventas[0].ToString());
            Console.ReadKey();
        }