Ejemplo n.º 1
0
        public ActionResult DeleteRoles(FASM_EN.User.Roles eRoles)
        {
            string message = "";

            try
            {
                if (eRoles.RoleId > 0)
                {
                    FASM_Enums.InfoMessages DeleteResult = RolesBI.DeleteRoles(eRoles.RoleId);
                    switch (DeleteResult)
                    {
                    case FASM_Enums.InfoMessages.Success:
                        message = "Successfully Deleted!";
                        break;

                    case FASM_Enums.InfoMessages.Failed:
                        message = "Still in Use!";
                        break;
                    }
                    return(new JsonResult {
                        Data = message, JsonRequestBehavior = JsonRequestBehavior.AllowGet
                    });
                }
            }
            catch (Exception ex)
            {
                ViewBag.CatchedMsg = ex.Message;
            }
            return(View());
        }
Ejemplo n.º 2
0
        public ActionResult CreateRoles(FASM_EN.User.Roles eRoles)
        {
            string message = "";

            if (ModelState.IsValid)
            {
                try
                {
                    FASM_Enums.InfoMessages SaveResult = RolesBI.SaveRoles(ref eRoles);
                    switch (SaveResult)
                    {
                    case FASM_Enums.InfoMessages.Success:
                        message = FASM_Msg.SuccessfulSaved;
                        break;

                    case FASM_Enums.InfoMessages.AlreadyExist:
                        message = "Sorry! the role name already exist";
                        break;
                    }
                    return(Json(new { msg = message, JsonRequestBehavior.AllowGet }));
                }
                catch (Exception ex)
                {
                    ViewBag.CatchedMsg = ex.Message;
                }
            }

            return(View(eRoles));
        }
Ejemplo n.º 3
0
        public ActionResult IndexRoles()
        {
            ViewBag.AllowAdd          = this.HasPermission(ControllerName.Accounts + "-CreateRoles");
            ViewBag.AllowEdit         = this.HasPermission(ControllerName.Accounts + "-EditRoles");
            ViewBag.AllowDelete       = this.HasPermission(ControllerName.Accounts + "-DeleteRoles");
            ViewBag.AssignPermissions = this.HasPermission(ControllerName.Accounts + "-ViewPermissions");

            FASM_EN.User.Roles eRoles = new FASM_EN.User.Roles();
            eRoles.dtRoles = RolesBI.GetRoles();
            return(View(eRoles));
        }
Ejemplo n.º 4
0
        public ActionResult ViewRoles()
        {
            Users eUsers = new Users();
            int   UserId = Convert.ToInt32(Url.RequestContext.RouteData.Values["Id"]);

            ViewBag.UserId = UserId; eUsers.UserId = UserId;
            UsersBI.LoadUsers(ref eUsers);
            ViewBag.Username = eUsers.Username;
            FASM_EN.User.Roles eRoles = new FASM_EN.User.Roles();
            eRoles.dtRoles = RolesBI.ShowRoles(UserId);
            return(View(eRoles));
        }
Ejemplo n.º 5
0
        public ActionResult ViewPermissions()
        {
            FASM_EN.User.Roles eRoles = new FASM_EN.User.Roles();
            int RoleId = Convert.ToInt32(Url.RequestContext.RouteData.Values["Id"]);

            ViewBag.RoleId = RoleId; eRoles.RoleId = RoleId;
            RolesBI.LoadRoles(ref eRoles);
            ViewBag.RoleName = eRoles.RoleName;
            Permissions ePermissions = new Permissions();

            ePermissions.dtPermissions = PermissionsBI.GetPermissions(RoleId);
            return(View(ePermissions));
        }
Ejemplo n.º 6
0
        public ActionResult EditRoles(FASM_EN.User.Roles eRoles)
        {
            if (eRoles.isLoad == false)
            {
                eRoles.RoleId = Convert.ToInt32(Request.Params["RoleId"]);
                RolesBI.LoadRoles(ref eRoles);
                return(PartialView(eRoles));
            }
            else
            {
                string message = "";
                if (ModelState.IsValid)
                {
                    try
                    {
                        FASM_Enums.InfoMessages Results = RolesBI.SaveRoles(ref eRoles);

                        switch (Results)
                        {
                        case FASM_Enums.InfoMessages.Success:
                            message = FASM_Msg.Updated;
                            break;

                        case FASM_Enums.InfoMessages.AlreadyExist:
                            message = "Sorry! the role name already exist";
                            break;
                        }
                        return(Json(new { msg = message, JsonRequestBehavior.AllowGet }));
                    }
                    catch (Exception ex)
                    {
                        ViewBag.CatchedMsg = ex.Message;
                    }
                }
            }

            return(View(eRoles));
        }