Beispiel #1
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));
        }
Beispiel #2
0
        public string SaveRoleOP(string RoleManus, string RoleManuButtons, string RoleId)
        {
            Guid          roleid = Guid.Parse(RoleId);
            List <string> manu   = RoleManus.Split('_').ToList();
            int           res    = 0;
            var           mql2   = RMS_RoleManusSet.RoleId.Equal(roleid);
            int           f      = RMBiz.Remove <RMS_RoleManusSet>(mql2);

            for (int i = 0; i < manu.Count; i++)
            {
                if (!string.IsNullOrEmpty(manu[i]))
                {
                    RMS_RoleManus item = new RMS_RoleManus();
                    item.Id     = Guid.NewGuid();
                    item.RoleId = roleid;
                    item.ManuId = Guid.Parse(manu[i]);
                    RMBiz.Add(item);
                    res++;
                }
            }


            List <string> ManuButtons = RoleManuButtons.Split('_').ToList();
            var           mql         = RMS_RoleManuButtonsSet.RoleId.Equal(roleid);
            int           ff          = RMBBiz.Remove <RMS_RoleManuButtonsSet>(mql);

            for (int i = 0; i < ManuButtons.Count; i++)
            {
                RMS_RoleManuButtons item = new RMS_RoleManuButtons();
                item.Id = Guid.NewGuid();
                string[] data = ManuButtons[i].Split(':');
                if (!string.IsNullOrEmpty(data[0]) && !string.IsNullOrEmpty(data[1]))
                {
                    item.RoleId = roleid;
                    var             sql   = RMS_MenuButtonsSet.SelectAll().Where(RMS_MenuButtonsSet.ManuId.Equal(Guid.Parse(data[0])).And(RMS_MenuButtonsSet.ButtonId.Equal(Guid.Parse(data[1]))));
                    RMS_MenuButtons bItem = MBBiz.GetEntity(sql);
                    if (bItem != null)
                    {
                        item.MenuButtonsId = bItem.Id;
                    }

                    RMBBiz.Add(item);
                    res++;
                }
            }
            if (res == manu.Count + ManuButtons.Count)
            {
                return("ok");
            }
            else
            {
                return("Nok");
            }
        }
        /// <summary>
        /// //添加单按钮
        /// </summary>
        /// <param name="btnId"></param>
        /// <param name="ManuId"></param>
        /// <returns></returns>
        public JsonResult AddManuBtn(string BtnId, string ManuId, string OrderNo)
        {
            var             mql2 = RMS_MenuButtonsSet.SelectAll().Where(RMS_MenuButtonsSet.ButtonId.Equal(BtnId).And(RMS_MenuButtonsSet.ManuId.Equal(ManuId)));
            RMS_MenuButtons item = MBDBiz.GetEntity(mql2);

            if (item != null)
            {
                item.OrderNo         = int.Parse(OrderNo);
                item.WhereExpression = RMS_MenuButtonsSet.Id.Equal(item.Id);
                //  spmodel.GroupId = GroupId;
                if (MBDBiz.Update(item) > 0)
                {
                    return(Json("OK", JsonRequestBehavior.AllowGet));
                }
            }
            item          = new RMS_MenuButtons();
            item.Id       = Guid.NewGuid();
            item.ButtonId = Guid.Parse(BtnId);
            item.ManuId   = Guid.Parse(ManuId);
            item.OrderNo  = int.Parse(OrderNo);
            MBDBiz.Add(item);
            return(Json("OK", JsonRequestBehavior.AllowGet));
        }
Beispiel #4
0
        /// <summary>
        /// 获取每个菜单有的按钮
        /// </summary>
        /// <returns></returns>
        public JsonResult GetMenuButtonsData()
        {
            List <RMS_MenuButtons> listMenuButtons = RDBiz.GetOwnList <RMS_MenuButtons>(RMS_MenuButtonsSet.SelectAll());//所有的菜单的按钮

            return(Json(listMenuButtons));
        }