Exemple #1
0
        public ActionResult Update()
        {
            try
            {
                string RoleID      = Request["RoleID"];
                string Name        = Request["Name"];
                string Description = Request["Description"];
                string CompanyIDs  = Request["CompanyIDs"];
                string DeptIDs     = Request["DeptIDs"];
                string BankIDs     = Request["BankIDs"];

                SysService.UpdateRole(RoleID, Name, Description);

                var pageValues = Request.Params.AllKeys
                                 .Where(k => k.StartsWith("P") && k.Length == 6)
                                 .Select((r) => new RolePage
                {
                    RoleID      = RoleID,
                    PageID      = r,
                    DataFilter  = (r == "P01001") ? CompanyIDs : (r == "P01002") ? DeptIDs : (r == "P01017") ? BankIDs : "",
                    ActionValue = Convert.ToInt32(Request.Params[r])
                }).ToList();

                SysService.UpdateRolePages(RoleID, pageValues);

                Role role = new Role {
                    RoleID = RoleID, Name = Name, Description = Description
                };
                return(Json(ResultData.Create(role), "text/html"));
            }
            catch (Exception ex)
            {
                return(Json(ResultData.CreateError(ex.Message), "text/html"));
            }
        }
Exemple #2
0
        public ActionResult UpdateAuth()
        {
            try
            {
                var roleID     = Request["RoleID"];
                var pageValues = Request.Params.AllKeys
                                 .Where(k => k.StartsWith("P") && k.Length == 6)
                                 .Select((r) => new RolePage
                {
                    RoleID      = roleID,
                    PageID      = r,
                    ActionValue = Convert.ToInt32(Request.Params[r])
                }).ToList();
                SysService.UpdateRolePages(roleID, pageValues);

                return(Json(ResultData.Create(true), "textml"));
            }
            catch (Exception ex)
            {
                return(Json(ResultData.CreateError(ex.Message), "text/html"));
            }
        }