示例#1
0
        public JsonResult Fetch(string Id)
        {
            if (Id == null)
            {
                Id = 0.ToString();
            }

            List <ModuleModel> model = ModuleData.GetModel(Convert.ToInt32(Id));

            Role _role  = RoleData.ListAll().Where(o => o.RoleId == Convert.ToInt32(Id)).SingleOrDefault();
            int  RoleId = Convert.ToInt32(Id);

            ViewBag.RoleDetails = RoleDetailData.GetById(Convert.ToInt32(Id));
            ViewBag.Roles       = RoleData.ListAll();
            ViewBag.Modules     = ModuleData.GetList();
            string[] mId        = new string[model.Count];
            string[] mName      = new string[model.Count];
            string[] misAllowed = new string[model.Count];
            for (int i = 0; i < model.Count; i++)
            {
                mId[i]        = model[i].ModuleId.ToString();
                mName[i]      = model[i].Name.ToString();
                misAllowed[i] = model[i].IsAllowed.ToString();
            }


            return(this.Json(new { id = mId, name = mName, isallowed = misAllowed }, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public ActionResult SaveDetails(string[] id, string[] names, string[] status, string roleid)
        {
            int  RoleId = Convert.ToInt32(roleid);
            bool data   = RoleDetailData.Save(roleid, id, names, status);

            return(this.Json(data, JsonRequestBehavior.AllowGet));
        }
示例#3
0
        // GET: RoleDetail

        // GET: RoleDetails
        //[eProcAuthorize]

        public ActionResult Update(string Id)
        {
            if (Id == null)
            {
                Id = 0.ToString();
            }
            List <Role> model = RoleData.ListAll();
            // List<ModuleModel> model = ModuleData.GetModel(Convert.ToInt32(Id));
            Role _role  = RoleData.ListAll().Where(o => o.RoleId == Convert.ToInt32(Id)).SingleOrDefault();
            int  RoleId = Convert.ToInt32(Id);

            ViewBag.RoleDetails = RoleDetailData.GetById(Convert.ToInt32(Id));
            ViewBag.Roles       = RoleData.ListAll();
            // ViewBag.Modules = ModuleData.GetModel(Convert.ToInt32(Id));
            return(View(model));
        }
示例#4
0
        public JsonResult Fetch(string Id)
        {
            if (Id == null)
            {
                Id = 0.ToString();
            }
            UserRole ur = UserRoleData.GetByUserId(Convert.ToInt32(Id));

            if (ur == null)
            {
                return(this.Json(new { result = "false" }, JsonRequestBehavior.AllowGet));
            }
            int RoleId = ur.RoleId;

            List <ModuleModel> model = ModuleData.GetModel(RoleId);

            //List<UserRight> model = UserRightData.GetList().Where(o=>o.UserId==Convert.ToInt32(Id)).ToList();

            ViewBag.RoleDetails = RoleDetailData.GetById(Convert.ToInt32(Id));
            ViewBag.Roles       = RoleData.ListAll();
            ViewBag.Modules     = ModuleData.GetList();
            string[] mId                = new string[model.Count];
            string[] mName              = new string[model.Count];
            string[] misAllowed         = new string[model.Count];
            string[] misAllowedOverride = new string[model.Count];
            for (int i = 0; i < model.Count; i++)
            {
                mId[i]   = model[i].ModuleId.ToString();
                mName[i] = model[i].Name.ToString();
                UserRight right = UserRightData.FindUserRight(Convert.ToInt32(Id), model[i].ModuleId);
                misAllowed[i] = model[i].IsAllowed.ToString();
                if (right == null)
                {
                    misAllowedOverride[i] = model[i].IsAllowed.ToString();
                }
                else
                {
                    misAllowedOverride[i] = right.IsAllowed.ToString();
                }
            }


            return(this.Json(new { id = mId, name = mName, isallowed = misAllowed, isallowed2 = misAllowedOverride }, JsonRequestBehavior.AllowGet));
        }