예제 #1
0
        /*
         * Johan Sebastian Piza Acosta
         * Evento que selecciona un género del combobox
         */
        private void CbGeneros_SelectedIndexChanged(object sender, EventArgs e)
        {
            int g = cbGeneros.SelectedIndex;

            if (g >= 1)
            {
                cbTallas.Enabled = true;
                genero           = (Genero)cbGeneros.SelectedItem;
                var tallaDao = new TallaDao(db);
                var tallas   = tallaDao.GetTallas();
                cbTallas.Items.Clear();
                cbTallas.Items.Add("Seleccione una talla");
                cbTallas.Items.AddRange(tallas.ToArray());
            }
        }
예제 #2
0
        public ActionResult Compras()
        {
            if (Session["factura"] == null)
            {
                Session["factura"] = new Factura {
                    DetallesFactura = new List <DetalleFactura>(),
                    Cliente         = (Cliente)Session["cliente"]
                };
            }
            var ligaIdStr   = Request.Form.Get("liga");
            var ligaId      = ligaIdStr == null ? null : new int?(Convert.ToInt32(ligaIdStr));
            var tallaIdStr  = Request.Form.Get("talla");
            var tallaId     = tallaIdStr == null ? null : new int?(Convert.ToInt32(tallaIdStr));
            var generoIdStr = Request.Form.Get("genero");
            var generoId    = generoIdStr == null ? null : new int?(Convert.ToInt32(generoIdStr));

            var ligaDao = new LigaDao(db);
            var ligas   = ligaDao.GetLigas();

            var tallaDao = new TallaDao(db);
            var tallas   = tallaDao.GetTallas();

            var generoDao = new GeneroDao(db);
            var generos   = generoDao.GetGeneros();

            var tallaGeneroDao   = new TallaGeneroDao(db);
            var tarjetasCamiseta = ligaId != null && tallaId != null && generoId != null?
                                   tallaGeneroDao.GetTarjetaCamiseta(ligaId.Value, tallaId.Value, generoId.Value)
                                       : new List <TarjetaCamiseta>();

            ViewBag.Ligas    = ligas;
            ViewBag.Tallas   = tallas;
            ViewBag.Generos  = generos;
            ViewBag.LigaId   = ligaId;
            ViewBag.TallaId  = tallaId;
            ViewBag.GeneroId = generoId;

            ViewBag.TarjetasCamiseta = tarjetasCamiseta;

            return(View());
        }
예제 #3
0
        public ActionResult DatosReportes()
        {
            var tallaIdStr  = Request.Form.Get("tallas");
            var tallaId     = tallaIdStr == null ? null : new int?(Convert.ToInt32(tallaIdStr));
            var generoIdStr = Request.Form.Get("generos");
            var generoId    = generoIdStr == null ? null : new int?(Convert.ToInt32(generoIdStr));

            var tallaDao = new TallaDao(db);
            var tallas   = tallaDao.GetTallas();

            var generoDao = new GeneroDao(db);
            var generos   = generoDao.GetGeneros();

            var tallaCamisetaDao = new TallaCamisetaDao(db);
            List <DatosReporte> datosReporte;

            if (tallaId != null && generoId != null)
            {
                var tallaGenero = new TallaGenero {
                    TallaId  = tallaId.Value,
                    GeneroId = generoId.Value
                };
                datosReporte = tallaCamisetaDao.calcularVentas(tallaGenero);
            }
            else
            {
                datosReporte = new List <DatosReporte>();
            }

            ViewBag.Tallas       = tallas;
            ViewBag.Generos      = generos;
            ViewBag.TallaId      = tallaId;
            ViewBag.GeneroId     = generoId;
            ViewBag.DatosReporte = datosReporte;

            return(View());
        }