示例#1
0
 /// <summary>
 /// 增加一条投票选项数据
 /// </summary>
 /// <param name="voteItem">投票选项模型变量</param>
 public static int AddVoteItem(VoteItemInfo voteItem)
 {
     voteItem.ID = dal.AddVoteItem(voteItem);
     //VoteBLL.ChangeVoteCount(VoteBLL.GetLastClassID(voteItem.VoteID), ChangeAction.Plus);
     VoteBLL.ChangeVoteCountByGeneral(voteItem.ID.ToString(), ChangeAction.Plus);
     return(voteItem.ID);
 }
示例#2
0
        /// <summary>
        /// 删除多条投票选项数据
        /// </summary>
        /// <param name="strID">投票选项的主键值,以,号分隔</param>
        public static void DeleteVoteItem(string strID)
        {
            // VoteRecordBLL.DeleteVoteRecordByItemID(strID);
            VoteBLL.ChangeVoteCountByGeneral(strID, ChangeAction.Minus);
            int[] itemIdS = Array.ConvertAll <string, int>((strID + ",").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), k => Convert.ToInt32(k));
            dal.DeleteVoteItem(itemIdS);
            //删除该项对应的评论

            UserMessageBLL.DeleteUserMessageByUserID(itemIdS);
        }
示例#3
0
        /// <summary>
        /// 更新一条投票选项数据
        /// </summary>
        /// <param name="voteItem">投票选项模型变量</param>
        public static void UpdateVoteItem(VoteItemInfo voteItem)
        {
            VoteItemInfo tempVoteItem = ReadVoteItem(voteItem.ID);

            dal.UpdateVoteItem(voteItem);
            if (voteItem.VoteID != tempVoteItem.VoteID)
            {
                int[] voteIds = Array.ConvertAll <string, int>(tempVoteItem.VoteID.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries), k => Convert.ToInt32(k));
                foreach (int _vid in voteIds)
                {
                    VoteBLL.ChangeVoteCount(_vid, ChangeAction.Minus);
                }
                voteIds = Array.ConvertAll <string, int>(voteItem.VoteID.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries), k => Convert.ToInt32(k));
                foreach (int _vid in voteIds)
                {
                    VoteBLL.ChangeVoteCount(_vid, ChangeAction.Plus);
                }
            }
        }