Пример #1
0
        public ActionResult Add(Roles model)
        {
            try
            {
                Rol = new RolesManager();
                Mod = new ModuloManager();
                var result = Rol.Set(model);

                if (result != null)
                {
                    foreach (Modulos modulos in model.ListRol)
                    {
                        if (modulos.Selected)
                        {
                            Mod.Set(result.Id_Rol, modulos.Id_Modulos, 1);
                        }
                        else
                        {
                            Mod.Set(result.Id_Rol, modulos.Id_Modulos, 0);
                        }
                    }
                }
                ViewBag.Success = "Datos Guardados/Actualizados Satisfactoriamente";
                return(Content("Datos Guardados/Actualizados Satisfactoriamente"));
            }
            catch (Exception ex)
            {
                ViewBag.Error = ex.Message;
            }

            return(Content(ViewBag.Error));
        }
Пример #2
0
        public ActionResult Delete(Roles model)
        {
            try
            {
                Rol          = new RolesManager();
                Mod          = new ModuloManager();
                model.Activo = 0;
                var result = Rol.Set(model);

                ViewBag.Success = "Datos Actualizados Satisfactoriamente";
                return(Content("Datos Actualizados Satisfactoriamente"));
            }
            catch (Exception ex)
            {
                ViewBag.Error = ex.Message;
            }

            return(Content(ViewBag.Error));
        }
Пример #3
0
        public ActionResult GetSingleRole(int Id_Rol, string partial_view)
        {
            Rol = new RolesManager();
            Mod = new ModuloManager();
            var result      = Rol.Get(Id_Rol);
            var result_view = new Roles();

            if (result != null && result.Count > 0)
            {
                result_view         = result[0];
                result_view.ListRol = Mod.Get(Id_Rol);
            }
            else
            {
                result_view.ListRol = Mod.Get(0);
            }

            return(PartialView(partial_view, result_view));
        }
Пример #4
0
        protected bool getCookies()
        {
            HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];
            var        User       = "";

            if (authCookie != null)
            {
                FormsAuthenticationTicket authTicket =
                    FormsAuthentication.Decrypt(authCookie.Value);
                User = authTicket.Name;
                UsuarioManager userio  = new UsuarioManager();
                Usuarios       usuario = userio.GetUserByUserName(User);
                ViewBag.UserName = usuario.Usuario;
                ViewBag.SolicitudesPendientes = usuario.SolicitudesPendientes;
                ViewBag.CuotasPendientes      = usuario.CuotasPendientes;
                ViewBag.SolicitudesAprobadas  = usuario.SolicitudesAprobadas;
                Cedula = ViewBag.LoggedId = usuario.Cedula;
                ModuloManager modulo = new ModuloManager();
                ViewBag.PermissionsList = modulo.GetUserModule(usuario.Cedula);
                return(true);
            }
            return(false);
        }