Exemple #1
0
        public IVote VoteOnArtist(IVote vote)
        {
            IVote voteAdded = new Vote();

            IDataQuery query = new DataQuery();
            query.Where = string.Format("profileId={0} and songId={1} and battlId={2}", vote.ProfileId, vote.SongId, vote.BattlId);
            IVote result = _voteRepository.Find(query).FirstOrDefault();
            if (result != null)
            {
                vote.VoteId = result.VoteId;
                vote.Votes = result.Votes + 1;
                voteAdded = _voteRepository.Update(vote);
            }
            else
            {
                voteAdded = _voteRepository.Add(vote);
            }

            query.Where = string.Format("songId={0} and battlId={1}", vote.SongId, vote.BattlId);
            int resultTotal = CanGetVotesByWhere(query.Where).Sum(m => m.Votes);
            vote.Votes = resultTotal;

            return voteAdded;
        }
 public void BattlVote( Vote vote )
 {
     _battlTimer.BattlVote(vote);
 }
        public Vote VoteSong(Vote vote)
        {
            Vote retorno = (Vote)this.voteModel.VoteOnArtist(vote);

            return retorno;
        }
Exemple #4
0
        private bool VoteSong( Vote vote )
        {
            bool retorno = false;
            vote.Votes = 1;

            Database db = Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.CreateDatabase();

            IRepository<IVote> dal = new VoteRepository(db);
            IRepositoryBLL<IVote> votelRepoBll = new VoteRepositoryBLL(dal);
            IVoteBLL voteBLL = new VoteBLL(votelRepoBll);

            retorno = (voteBLL.VoteOnArtist(vote).VoteId > 0);

            return retorno;
        }
Exemple #5
0
 private void BroadcastBattlVoted( Vote vote )
 {
     Clients.All.updateBattlVotes(vote);
 }
Exemple #6
0
 public void BattlVote( Vote vote )
 {
     lock( _updateBattlLock )
     {
         if( BattlState == BattlState.Open )
         {
             if( VoteSong(vote) )
             {
                 BroadcastBattlVoted(vote);
             }
         }
     }
 }