示例#1
0
        public JsonResult GetCasillasList(int seccion)
        {
            var sBLL     = new SeccionBLL();
            var casillas = sBLL.RetrieveBySeccion(seccion);

            return(Json(new SelectList(casillas, "idSeccion", "casilla"), JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public JsonResult CalculatePCIUD(int total, string idSeccion)
        {
            PCIUDModel model = new PCIUDModel();

            double pciud   = 0.0;
            var    sBLL    = new SeccionBLL();
            var    seccion = sBLL.RetrieveByIdSeccion(idSeccion);
            double listaN  = seccion.listaNominal;

            if (seccion != null)
            {
                pciud = (total / listaN) * 100;
            }

            model.pciud        = pciud;
            model.listaNominal = seccion.listaNominal;

            return(Json(model, JsonRequestBehavior.AllowGet));
        }
示例#3
0
        public ActionResult Register(string id, string message)
        {
            var sBLL = new SeccionBLL();

            RCasilla casilla = new RCasilla();

            Guid g = Guid.NewGuid();

            casilla.idRegistroCasilla = g.ToString();
            casilla.tipoEleccion      = id;
            casilla.fecha             = DateTime.Now;
            casilla.idUsuario         = idUsuario;
            casilla.Editable          = false;

            var secciones = sBLL.RetrieveSeccions();

            ViewBag.seccion = new SelectList(secciones);
            ViewBag.casilla = new SelectList(Enumerable.Empty <SelectListItem>());
            string tipo = "";

            ViewBag.Message = message;

            if (id == "A")
            {
                tipo = "PRESIDENTE MUNICIPAL";
            }
            else
            if (id == "D")
            {
                tipo = "DIPUTADOS LOCALES";
            }
            else
            if (id == "F")
            {
                tipo = "DIPUTADOS FEDERALES";
            }
            else
            if (id == "S")
            {
                tipo = "SENADORES";
            }
            else
            if (id == "P")
            {
                tipo = "PRESIDENTES";
            }
            else
            {
                return(View("Index"));
            }

            ViewBag.Tipo = tipo;

            var oRR = new EstadoCasillaRepository();
            List <EstadoCasilla> estados = new List <EstadoCasilla>();

            if (Rol != null)
            {
                if (Rol == "A")
                {
                    estados = oRR.RetrieveAllEstadosCasilla();
                }

                if (Rol == "C")
                {
                    estados = oRR.RetrieveAllEstadosCasillaCapturista();
                }
            }

            ViewBag.status = new SelectList(estados, "idEstado", "descripcion", "A");

            return(View(casilla));
        }
示例#4
0
        public ActionResult Update(RCasilla casilla)
        {
            var rcBLL = new RCasillaBLL();

            if (ModelState.IsValid)
            {
                try
                {
                    rcBLL.Update(casilla);
                    return(RedirectToAction("Register", "Home", new { id = casilla.tipoEleccion, message = "El registro se ha actualizado correctamente." }));
                }catch
                {
                    var sBLL = new SeccionBLL();

                    var secciones = sBLL.RetrieveSeccions();
                    var casillas  = sBLL.RetrieveBySeccion(casilla.Seccione.seccion);
                    ViewBag.seccion = new SelectList(secciones, casilla.Seccione.seccion);
                    ViewBag.casilla = new SelectList(casillas, "idSeccion", "casilla", casilla.Seccione.casilla);
                    string tipo = "", id = casilla.tipoEleccion;

                    if (id == "A")
                    {
                        tipo = "PRESIDENTE MUNICIPAL";
                    }
                    else
                    if (id == "D")
                    {
                        tipo = "DIPUTADOS LOCALES";
                    }
                    else
                    if (id == "F")
                    {
                        tipo = "DIPUTADOS FEDERALES";
                    }
                    else
                    if (id == "S")
                    {
                        tipo = "SENADORES";
                    }
                    else
                    if (id == "P")
                    {
                        tipo = "PRESIDENTES";
                    }
                    else
                    {
                        return(View("Index"));
                    }

                    ViewBag.Tipo = tipo;

                    var oRR = new EstadoCasillaRepository();
                    List <EstadoCasilla> estados = new List <EstadoCasilla>();

                    if (Rol != null)
                    {
                        if (Rol == "A")
                        {
                            estados = oRR.RetrieveAllEstadosCasilla();
                        }

                        if (Rol == "C")
                        {
                            estados = oRR.RetrieveAllEstadosCasillaCapturista();
                        }
                    }

                    ViewBag.status = new SelectList(estados, "idEstado", "descripcion", casilla.status);

                    return(View());
                }
            }
            else
            {
                var sBLL = new SeccionBLL();

                var secciones = sBLL.RetrieveSeccions();
                var casillas  = sBLL.RetrieveBySeccion(casilla.Seccione.seccion);
                ViewBag.seccion = new SelectList(secciones, casilla.Seccione.seccion);
                ViewBag.casilla = new SelectList(casillas, "idSeccion", "casilla", casilla.Seccione.casilla);
                string tipo = "", id = casilla.tipoEleccion;

                if (id == "A")
                {
                    tipo = "PRESIDENTE MUNICIPAL";
                }
                else
                if (id == "D")
                {
                    tipo = "DIPUTADOS LOCALES";
                }
                else
                if (id == "F")
                {
                    tipo = "DIPUTADOS FEDERALES";
                }
                else
                if (id == "S")
                {
                    tipo = "SENADORES";
                }
                else
                if (id == "P")
                {
                    tipo = "PRESIDENTES";
                }
                else
                {
                    return(View("Index"));
                }

                ViewBag.Tipo = tipo;

                var oRR = new EstadoCasillaRepository();
                List <EstadoCasilla> estados = new List <EstadoCasilla>();

                if (Rol != null)
                {
                    if (Rol == "A")
                    {
                        estados = oRR.RetrieveAllEstadosCasilla();
                    }

                    if (Rol == "C")
                    {
                        estados = oRR.RetrieveAllEstadosCasillaCapturista();
                    }
                }

                ViewBag.status = new SelectList(estados, "idEstado", "descripcion", casilla.status);

                return(View());
            }
        }
示例#5
0
        public ActionResult Update(string idRCasilla)
        {
            var sBLL  = new SeccionBLL();
            var rcBLL = new RCasillaBLL();

            RCasilla casilla = rcBLL.RetrieveByIdRCasilla(idRCasilla);

            casilla.Editable = false;

            Guid g = Guid.NewGuid();

            var secciones = sBLL.RetrieveSeccions();
            var casillas  = sBLL.RetrieveBySeccion(casilla.Seccione.seccion);

            ViewBag.seccion = new SelectList(secciones, casilla.Seccione.seccion);
            ViewBag.casilla = new SelectList(casillas, "idSeccion", "casilla", casilla.Seccione.casilla);
            string tipo = "", id = casilla.tipoEleccion;

            if (id == "A")
            {
                tipo = "PRESIDENTE MUNICIPAL";
            }
            else
            if (id == "D")
            {
                tipo = "DIPUTADOS LOCALES";
            }
            else
            if (id == "F")
            {
                tipo = "DIPUTADOS FEDERALES";
            }
            else
            if (id == "S")
            {
                tipo = "SENADORES";
            }
            else
            if (id == "P")
            {
                tipo = "PRESIDENTES";
            }
            else
            {
                return(View("Index"));
            }

            var oRR = new EstadoCasillaRepository();
            List <EstadoCasilla> estados = new List <EstadoCasilla>();

            if (Rol != null)
            {
                if (Rol == "A")
                {
                    estados = oRR.RetrieveAllEstadosCasilla();
                }

                if (Rol == "C")
                {
                    estados = oRR.RetrieveAllEstadosCasillaCapturista();
                }
            }

            ViewBag.status = new SelectList(estados, "idEstado", "descripcion", casilla.status);

            ViewBag.Tipo = tipo;

            return(PartialView("_Update", casilla));
        }
示例#6
0
        public ActionResult Register(RCasilla rCasilla)
        {
            var rcBLL = new RCasillaBLL();

            if (ModelState.IsValid)
            {
                Guid g = Guid.NewGuid();
                rCasilla.idRegistroCasilla = g.ToString();
                rCasilla.fecha             = DateTime.Now;
                rcBLL.Create(rCasilla);
                return(RedirectToAction("Register", new { id = rCasilla.tipoEleccion, message = "El registro se guardó exitosamente." }));
            }
            else
            {
                var sBLL      = new SeccionBLL();
                var secciones = sBLL.RetrieveSeccions();
                ViewBag.seccion = new SelectList(secciones);
                ViewBag.casilla = new SelectList(Enumerable.Empty <SelectListItem>());
                string tipo = "";

                if (rCasilla.tipoEleccion == "A")
                {
                    tipo = "PRESIDENTE MUNICIPAL";
                }
                else
                if (rCasilla.tipoEleccion == "D")
                {
                    tipo = "DIPUTADOS LOCALES";
                }
                else
                if (rCasilla.tipoEleccion == "F")
                {
                    tipo = "DIPUTADOS FEDERALES";
                }
                else
                if (rCasilla.tipoEleccion == "S")
                {
                    tipo = "SENADORES";
                }
                else
                if (rCasilla.tipoEleccion == "P")
                {
                    tipo = "PRESIDENTES";
                }
                else
                {
                    return(View("Index"));
                }

                ViewBag.Tipo = tipo;

                var oRR = new EstadoCasillaRepository();
                List <EstadoCasilla> estados = new List <EstadoCasilla>();

                if (Rol != null)
                {
                    if (Rol == "A")
                    {
                        estados = oRR.RetrieveAllEstadosCasilla();
                    }

                    if (Rol == "C")
                    {
                        estados = oRR.RetrieveAllEstadosCasillaCapturista();
                    }
                }

                ViewBag.status = new SelectList(estados, "idEstado", "descripcion", "A");

                return(View());
            }
        }