Beispiel #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));
        }
Beispiel #2
0
 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("已投过票!");
 }