コード例 #1
0
        public ActionResult Details(int id)
        {
            var model  = DaoRole.GetEntity("ROLE_ID", id);
            var orgall = DaoOrg.FindList();

            model.RoleORG = orgall.FirstOrDefault(obj => obj.ORG_ID == model.ORG_ID);
            return(View(model));
        }
コード例 #2
0
        public ActionResult RoleOrgTree(int?roleid)
        {
            var      orgall = DaoOrg.FindList();
            SYS_ROLE role   = null;

            if (roleid != null)
            {
                role = DaoRole.GetEntity("ROLE_ID", roleid);
            }
            return(Json(GenRoleOrgTree(orgall, role, string.Empty), JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
 public ActionResult Edit(int id)
 {
     try
     {
         var role = DaoRole.GetEntity("ROLE_ID", id);
         return(View(role));
     }
     catch (Exception ex)
     {
         LogHelper.ErrorLog("修改角色出错", ex);
         return(Redirect("/Home/Error"));
     }
 }
コード例 #4
0
        public ActionResult Edit(SYS_ROLE role, int id)
        {
            var extrole = DaoRole.GetEntity("ROLE_ID", id);
            var old     = DaoRole.GetEntity("ROLE_ID", role.ROLE_ID);

            try
            {
                if (string.IsNullOrEmpty(role.ROLE_NAM))
                {
                    ModelState.AddModelError("ROLE_NAM", "角色名称不能为空!");
                }
                if (string.IsNullOrEmpty(role.ORG_ID))
                {
                    ModelState.AddModelError("ORG_ID", "组织机构不能为空!");
                }
                if (!ModelState.IsValid)
                {
                    return(JsonResult(false, "修改失败!"));
                }
                role.MODIFY_ID    = UserState.UserID;
                role.MODIFY_DTIME = DateTime.Now;

                var rst = dao.UpdateObject(role, "ROLE_ID");
                if (rst > 0)
                {
                    return(JsonResult(true, "修改成功!", "AUTH", "", false));
                }
                else
                {
                    return(JsonResult(false, "修改失败!"));
                }
            }
            catch (Exception ex)
            {
                LogHelper.ErrorLog("修改角色出错", ex);
                ModelState.AddModelError("", "修改角色失败。" + ex.Message);
                return(JsonResult(false, "系统错误!"));
            }
        }
コード例 #5
0
 public ActionResult RoleFunc(int id)
 {
     TempData["role"] = DaoRole.GetEntity("ROLE_ID", id);
     return(View());
 }