コード例 #1
0
        /// <summary>
        /// 获取列
        /// </summary>
        /// <returns></returns>
        public string GetBtnColumn()
        {
            string             menus = " [\n";
            var                sql   = RMS_ButtonsSet.SelectAll();
            List <RMS_Buttons> list  = RDBiz.GetOwnList <RMS_Buttons>(sql);

            if (list != null)
            {
                menus += "{  ";

                menus += "title:\"名称\",field:\"Name\", width: 100";
                menus += "},";
                menus += "{  ";

                menus += "title:\"浏览\",field:\"ControlId_Browse\", width: 30,editor:{type:'checkbox',options:{on:'1',off:'0'}}, formatter: formatCheck";
                menus += "},";

                foreach (RMS_Buttons item in list)
                {
                    menus += "{  ";

                    menus += "title:\"" + item.ButtonName + "\",field:\"ControlId_" + item.Id + "\", width: 30,editor:{type:'checkbox',options:{on:'1',off:'0'}}, formatter: formatCheck";
                    menus += "},";
                }
            }

            menus = menus.Substring(0, menus.Length - 1);
            menus = menus + "]";

            return(menus);
        }
コード例 #2
0
        public JsonResult GetInfo(string ID)
        {
            var         mql2   = RMS_ButtonsSet.SelectAll().Where(RMS_ButtonsSet.Id.Equal(ID));
            RMS_Buttons Rmodel = OPBiz.GetEntity(mql2);

            //  groupsBiz.Add(rol);
            return(Json(Rmodel, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        public JsonResult GetOneOut(string ManuId)//获取菜单未添加的按钮
        {
            //DataSet ds = OPBiz.ExecuteSqlToDataSet(" select * from RMS_Buttons where Id not in( select Id from Function_Buttons where Id='" + ManuId + "')");
            //return Json(ds.Tables[0], JsonRequestBehavior.AllowGet);
            var mql = RMS_ButtonsSet.SelectAll().Where(RMS_ButtonsSet.Id.NotIn(RMS_MenuButtonsSet.Select(RMS_MenuButtonsSet.ButtonId).Where(RMS_MenuButtonsSet.ManuId.Equal(ManuId))));
            List <RMS_Buttons> Rmodel = BDBiz.GetOwnList <RMS_Buttons>(mql);

            return(Json(Rmodel, JsonRequestBehavior.AllowGet));
        }
コード例 #4
0
        /// <summary>
        /// 获取某个角色的权限 数据不要乱改啊!!
        /// </summary>
        /// <param name="Id">角色的Id</param>
        /// <returns></returns>
        public string GetManeOP(string Id)
        {
            string                   menus = " [\n";
            var                      sql   = RMS_MenusSet.SelectAll();
            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);
        }