Esempio n. 1
0
        public JsonResult GetInfo(string ID)
        {
            var       mql2   = RMS_MenusSet.SelectAll().Where(RMS_MenusSet.Id.Equal(ID));
            RMS_Menus Rmodel = MDBiz.GetEntity(mql2);

            //  groupsBiz.Add(rol);
            return(Json(Rmodel, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public JsonResult GetJson()
        {
            var sql = RMS_MenusSet.SelectAll();
            List <RMS_Menus> listAll  = MDBiz.GetOwnList <RMS_Menus>(sql);
            List <TreeMenus> listTree = MDBiz.GetTreeManus(listAll);

            return(Json(listTree));
        }
Esempio n. 3
0
        /// <summary>
        /// 获取某个角色的权限 数据不要乱改啊!!
        /// </summary>
        /// <param name="Id">角色的Id</param>
        /// <returns></returns>
        public string GetManeOP(string Id)
        {
            string menus = " [\n";

            var    sql       = RMS_MenusSet.SelectAll();
            string SysRoleId = ConfigurationManager.AppSettings["SysRoleId"].ToString();

            if (!UserData.RoleId.ToString().Equals(SysRoleId))//不是系统管理员的角色,只能返回自己的菜单
            {
                sql = RMS_MenusSet.SelectAll().Where(RMS_MenusSet.Id.In(RMS_RoleManusSet.Select(RMS_RoleManusSet.ManuId).Where(RMS_RoleManusSet.RoleId.Equal(UserData.RoleId))));
            }
            List <RMS_Menus>         list = RDBiz.GetOwnList <RMS_Menus>(sql);                                                                                                  //所有的菜单集
            List <RMS_Buttons>       listControlButtons  = RDBiz.GetOwnList <RMS_Buttons>(RMS_ButtonsSet.SelectAll());                                                          //所有的按钮
            List <RMS_RoleManus>     listRoleColumns     = RDBiz.GetOwnList <RMS_RoleManus>(RMS_RoleManusSet.SelectAll().Where(RMS_RoleManusSet.RoleId.Equal(Id)));             //这个角色已经添加的菜单
            List <V_RoleManuButtons> listRoleMenuButtons = RDBiz.GetOwnList <V_RoleManuButtons>(V_RoleManuButtonsSet.SelectAll().Where(V_RoleManuButtonsSet.RoleId.Equal(Id))); //这个角色已经添加的角色按钮

            for (int i = 0; i < list.Count; i++)
            {
                if (list.Find(p => p.Id == list[i].ParentManuId) == null)//此项没有父级
                {
                    menus += "{  \"MenuId\":\"" + list[i].Id + "\",";
                    menus += string.Format("  \"Name\":\"{0}\",", list[i].ManuName);
                    menus += string.Format("  \"iconCls\":\"{0}\",", list[i].Icon);
                    string        ControlId_Browse = "0";
                    RMS_RoleManus rcItem           = listRoleColumns.Find(p => p.ManuId.Equals(list[i].Id));

                    if (rcItem != null)
                    {
                        ControlId_Browse = "1";//如果存在
                    }
                    menus += string.Format("  \"ControlId_Browse\":\"{0}\",", ControlId_Browse);
                    foreach (RMS_Buttons dd in listControlButtons)//添加列的数据
                    {
                        string Ishave = "0";


                        V_RoleManuButtons rmbItem = listRoleMenuButtons.Find(p => p.Id.Equals(dd.Id) && p.ManuId.Equals(list[i].Id));

                        if (rmbItem != null)
                        {
                            Ishave = "1";//如果角色有此按钮存在
                        }

                        menus += string.Format("\"ControlId_{0}\":\"{1}\",", dd.Id, Ishave);
                    }
                    menus += GetSonTreeManu(list, list[i], listControlButtons, listRoleColumns, listRoleMenuButtons);//添加children
                    menus += "},";
                }
            }
            menus = menus.Substring(0, menus.Length - 1);
            menus = menus + "]";

            return(menus);
        }