public ActionResult GetPoupList(Poup poup) { List <object> list = new PoupRule().GetPoupList(poup, ""); // 暂时不添加任何验证,默认返回全部菜单节点 return(Json(list, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(Poup model) { using (DBHelper db = DBHelper.Create()) { db.Insert <Poup>(model); } }
/// <summary> /// 新增菜单节点 /// </summary> /// <param name="poup"></param> /// <returns></returns> public object AddPoup(Poup poup) { using (DBHelper db = DBHelper.Create()) { Dictionary <string, object> param = new Dictionary <string, object>(); string selectCode = "select max(Value) from T_Poup where PID = @PID or ID = @ID"; param.Add("PID", poup.PID); param.Add("ID", poup.ID); string code = db.ExcuteScular(selectCode, param).ToString(); string selectPCode = "select Value from T_Poup where ID = @ID"; param.Clear(); param.Add("ID", poup.PID); string PCode = db.ExcuteScular(selectPCode, param).ToString(); code = (Convert.ToInt32(code) + 1).ToString(); string id = Guid.NewGuid().ToString().Replace("-", ""); Poup myPoup = new Poup() { ID = id, Name = poup.Name, IsValid = 1, Path = poup.Path, PID = poup.PID, PValue = "", Value = code }; try { db.Insert <Poup>(myPoup); return(id); } catch (System.Exception ex) { return(null); throw ex; } } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Poup model) { using (DBHelper db = DBHelper.Create()) { db.Update <Poup>(model); return(true); } }
public ActionResult AddPoup(Poup poup) { // o为新增菜单节点的ID object o = new PoupRule().AddPoup(poup); if (o != null) { return(GetPoup(o.ToString())); } else { return(null); } }
/// <summary> /// 获取菜单节点 /// </summary> /// <returns></returns> public List <object> GetPoupList(Poup poup, string userID) { using (DBHelper db = DBHelper.Create()) { if (poup.PID == null) { string sql = "select * from t_poup order by value asc"; return(db.GetDynaminObjectList(sql, null)); } else { string sql = "select * from t_poup where PID = @PID order by value asc"; Dictionary <string, object> param = new Dictionary <string, object>(); param.Add("PID", poup.PID); return(db.GetDynaminObjectList(sql, param)); } } }
/// <summary> /// 获取指定角色的所有权限 /// </summary> /// <param name="groupID"></param> /// <returns></returns> public List <Model.Poup> GetAllVoteByGroupID(string groupID) { List <Model.Poup> poupList = new List <Poup>(); string strSql = @"select gv.poupID from T_group g left join t_group_vote gv on g.ID=gv.GroupID where g.ID=@GroupID"; SqlParameter parame = new SqlParameter("@GroupID", SqlDbType.VarChar); Dictionary <string, object> param = new Dictionary <string, object>(); param.Add("GroupID", groupID); using (DBHelper db = DBHelper.Create()) { using (DbDataReader sdr = db.ExecuteReader(strSql, param)) { while (sdr != null && sdr.Read()) { Model.Poup p = new Poup(); p.ID = sdr["poupID"].ToString(); poupList.Add(p); } } } return(poupList); }
/// <summary> /// 获取菜单节点 /// </summary> /// <returns></returns> public List <object> GetPoupList(Poup poup, string userID) { return(dal.GetPoupList(poup, userID)); }
/// <summary> /// 新增菜单节点 /// </summary> /// <param name="poup"></param> /// <returns></returns> public object AddPoup(Poup poup) { return(dal.AddPoup(poup)); }