コード例 #1
0
 public TournamentLight AddTournament(TournamentInformation tournamentAddData)
 {
     Logger.Trace("Add new tournament");
     return(InvokeOperations.InvokeOperation(() =>
     {
         tournamentRepository.AddTournament(tournamentAddData);
         var tournament = tournamentRepository.GetTournamentCommonInformation(tournamentAddData.IdName);
         Task.Factory.StartNew(() => tournamentProcessor.GenerateRounds(tournamentAddData.IdName));
         return new TournamentLight
         {
             Id = tournament.Tournament.id_name,
             IsStarted = tournament.Tournament.date_start >= DateTime.Now,
             Name = tournament.Tournament.name,
             SmallLogo = tournament.Tournament.small_logo,
             TypeId = tournament.Type.id,
             TypeName = tournament.Type.name
         };
     }));
 }
コード例 #2
0
        public TournamentLight EditTournament(TournamentInformation tournamentEditData)
        {
            Logger.Trace("Add new tournament");
            return(InvokeOperations.InvokeOperation(() =>
            {
                tournamentRepository.EditTournament(tournamentEditData);

                var tournament = tournamentRepository.GetTournamentCommonInformation(tournamentEditData.IdName);

                return new TournamentLight
                {
                    Id = tournament.Tournament.id_name,
                    IsStarted = tournament.Tournament.date_start >= DateTime.Now,
                    Name = tournament.Tournament.name,
                    SmallLogo = tournament.Tournament.small_logo,
                    TypeId = tournament.Type.id,
                    TypeName = tournament.Type.name
                };
            }));
        }
コード例 #3
0
        public TournamentInformation GetTournamentInformation(string tournamentId)
        {
            Logger.Trace("Get tournament information {0}", tournamentId);
            return(InvokeOperations.InvokeOperation(() =>
            {
                var accountTypes = accountService.GetAccountTypes();
                if (!accountTypes.IsSuccess)
                {
                    throw new OperationException(accountTypes.Error, accountTypes.Code);
                }

                var tournamentInformation = tournamentRepository.GetTournamentInformation(tournamentId);
                var tournament = tournamentRepository.GetTournament(tournamentId);

                var information = new TournamentInformation
                {
                    Name = tournament.name,
                    FullDescription = tournament.full_description,
                    ShortDescription = tournament.short_description,
                    BigLogo = tournament.big_logo,
                    SmallLogo = tournament.small_logo,
                    EntryFee = tournament.entry_fee,
                    DateStart = tournament.date_start,
                    DayInterval = tournament.day_interval,
                    TimeDuration = tournament.time_duration,
                    IsDemo = tournament.isdemo,
                    TypeId = tournament.type_id,
                    BaseDeposit = tournament.base_deposit,
                    IdName = tournament.id_name,
                    AccountTypes = new List <AccountType>(),
                    Ratings = new List <RatingPrice>()
                };

                foreach (var accountInformation in tournamentInformation.Where(x => x.AccountType != null))
                {
                    if (information.AccountTypes.Any(x => x.Id == accountInformation.AccountType.account_type_id))
                    {
                        continue;
                    }

                    information.AccountTypes.Add(new AccountType
                    {
                        Id = accountInformation.AccountType.account_type_id,
                        Name = accountTypes.Result[accountInformation.AccountType.account_type_id]
                    });
                }

                foreach (var ratingInformation in tournamentInformation.Where(x => x.RatingPrice != null))
                {
                    if (information.Ratings.Any(x => x.Id == ratingInformation.RatingPrice.id))
                    {
                        continue;
                    }

                    information.Ratings.Add(new RatingPrice
                    {
                        Id = ratingInformation.RatingPrice.id,
                        Award = ratingInformation.RatingPrice.award,
                        Rank = ratingInformation.RatingPrice.rank,
                    });
                }

                return information;
            }));
        }