Beispiel #1
0
        public JsonResult DesbloquearEditable(string idRegistroCasilla)
        {
            bool Result  = false;
            var  rBLL    = new RCasillaBLL();
            var  casilla = rBLL.RetrieveByIdRCasilla(idRegistroCasilla);

            casilla.Editable = true;
            try
            {
                rBLL.Update(casilla);
                Result = true;
            }
            catch
            {
                Result = false;
            }

            return(Json(Result, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
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());
            }
        }