public ActionResult AddPoup(Poup poup) { // o为新增菜单节点的ID object o = new PoupRule().AddPoup(poup); if (o != null) { return GetPoup(o.ToString()); } else { return null; } }
public ActionResult DeletePoup(string ID) { if (ID == "00000000000000000000000000000000") { throw new Exception("错误:不允许删除系统根节点"); } PoupRule rule = new PoupRule(); try { return Json(rule.DeletePoup(ID), JsonRequestBehavior.AllowGet); } catch { } return null; }
/// <summary> /// 获取菜单数据(用于grid控件绑定,角色权限设置时使用) /// </summary> /// <returns></returns> public ActionResult GetMenuGridJson() { if (MyTicket.CurrentTicket == null) { return RedirectToAction("Index"); } PoupRule poup = new PoupRule(); List<Poup> poupList = poup.GetMenuJson(); var showList = from poupInfo in poupList.Where(p => string.IsNullOrEmpty(p.PID) == false) select new { ID = poupInfo.ID, Name = string.Format("<labe id='{0}'>{1}</label>", poupInfo.ID, poupInfo.Name), Vote1 = "<input type='checkbox' value='1' pID='{0}'/>", Vote2 = "<input type='checkbox' value='2' pID='{0}'/>", Vote3 = "<input type='checkbox' value='4' pID='{0}'/>", Vote4 = "<input type='checkbox' value='8' pID='{0}'/>" }; return Json(new { total = showList.ToList().Count, rows = showList }, JsonRequestBehavior.AllowGet); }
public ActionResult GetPoupList(Poup poup) { List<object> list = new PoupRule().GetPoupList(poup, ""); // 暂时不添加任何验证,默认返回全部菜单节点 return Json(list, JsonRequestBehavior.AllowGet); }