/// <summary> /// ��ȡ����Ա����Ȩ�� /// </summary> /// <param name="groupID"></param> /// <param name="operatorID"></param> /// <returns></returns> public List<OperatorVote> GetOperVotes(string groupID, string operatorID) { List<OperatorVote> voteList = new List<OperatorVote>(); StringBuilder strSql = new StringBuilder(); strSql.Append("select gv.VoteType,p.Path from T_Group_vote gv "); strSql.Append("left join T_Poup p on p.ID=gv.PoupID "); strSql.Append("where gv.GroupID=@GroupID "); strSql.Append("union "); strSql.Append("select ov.VoteType,p.Path from T_OperatorVote ov "); strSql.Append("left join T_Poup p on p.ID=ov.PoupID "); strSql.Append("where ov.OperatorID=@OperatorID"); using (DBHelper db = DBHelper.Create()) { Dictionary<string, object> param = new Dictionary<string, object>(); param.Add("GroupID", groupID); param.Add("OperatorID", operatorID); using (DbDataReader sdr = db.ExecuteReader(strSql.ToString(), param)) { while (sdr != null && sdr.Read()) { OperatorVote ov = new OperatorVote(); string strVoteCount = sdr["VoteType"].ToString(); ov.PoupID = sdr["Path"].ToString(); if (!string.IsNullOrEmpty(strVoteCount)) { ov.VoteType = Convert.ToInt32(strVoteCount); } voteList.Add(ov); } } } return voteList; }
/// <summary> /// 增加一条数据 /// </summary> public void Add(OperatorVote model) { using (DBHelper db = DBHelper.Create()) { db.Insert<OperatorVote>(model); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Ajax.Model.OperatorVote model) { using (DBHelper db = DBHelper.Create()) { db.Update <OperatorVote>(model); return(true); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Ajax.Model.OperatorVote model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(Ajax.Model.OperatorVote model) { dal.Add(model); }