示例#1
0
        public static bool Vote(int voteId, string itemIds)
        {
            bool flag;

            if (VoteHelper.IsVote(voteId))
            {
                throw new Exception("已投过票!");
            }
            VoteInfo vote = VoteHelper.GetVote((long)voteId);

            if (vote.IsMultiCheck)
            {
                if (vote.MaxCheck <= 0)
                {
                    flag = true;
                }
                else
                {
                    int    maxCheck = vote.MaxCheck;
                    char[] chrArray = new char[] { ',' };
                    flag = maxCheck >= itemIds.Split(chrArray).Count <string>();
                }
                if (!flag)
                {
                    throw new Exception(string.Format("对不起!您最多能选{0}项...", vote.MaxCheck));
                }
            }
            return((new VoteDao()).Vote(voteId, itemIds));
        }
示例#2
0
文件: VoteHelper.cs 项目: zwkjgs/XKD
 public static bool Vote(int voteId, string itemIds)
 {
     if (!VoteHelper.IsVote(voteId))
     {
         VoteInfo vote = VoteHelper.GetVote((long)voteId);
         if (vote.IsMultiCheck)
         {
             if (vote.MaxCheck > 0 && vote.MaxCheck < itemIds.Split(new char[]
             {
                 ','
             }).Count <string>())
             {
                 throw new Exception(string.Format("对不起!您最多能选{0}项...", vote.MaxCheck));
             }
         }
         return(new VoteDao().Vote(voteId, itemIds));
     }
     throw new Exception("已投过票!");
 }