Esempio n. 1
0
        public string GetAllTourneys(UserInfo _data)
        {
            TourneyManager tm = new TourneyManager();
            TournamentList tl = tm.GetAllTourneys(_data.username);

            return(JsonConvert.SerializeObject(tl));
        }
Esempio n. 2
0
        public void GetAllTourneysTest()
        {
            string         username = GetRandomAlphaNumeric();
            TourneyManager test     = new TourneyManager();
            TournamentList tl       = test.GetAllTourneys(username);

            Assert.IsNotNull(tl);
        }
Esempio n. 3
0
        private bool OpenDatabase()
        {
            TreeNode node = new TreeNode();

            node.Text = Localizator.Dictionary.GetString("PLAYER_LIST");// "Список игроков";

            node.Tag = new PlayerList();
            mainTreeView.Nodes.Add(node);
#if FEDITION || DEBUG
            node      = new TreeNode();
            node.Text = Localizator.Dictionary.GetString("RATING_LISTS");// "Рейтинговые листы";
            mainTreeView.Nodes.Add(node);
            DatabaseManager.CurrentDb.ReadTypeOfSportList(Globals.Games);
            foreach (TypeOfSport sport in Globals.Games.Values)
            {
                TreeNode child = new TreeNode();
                child.Text = sport.Name;
                child.Tag  = sport;
                node.Nodes.Add(child);
            }
#endif
            node      = new TreeNode();
            node.Text = Localizator.Dictionary.GetString("TOURNAMENTS");// "Турниры";
            node.Tag  = 3;
            mainTreeView.Nodes.Add(node);
            TournamentList tourns = new TournamentList();
            DatabaseManager.CurrentDb.ReadTournamentList(tourns);
            CompetitionList comps = new CompetitionList();
            foreach (Tournament tour in tourns.Values)
            {
                TreeNode child = new TreeNode();
                child.Text = String.Format("{0} - {1}", tour.Info.DateBegin.ToString("dd.MM.yyyy"), tour.Info.Name);
                child.Tag  = tour;
                node.Nodes.Add(child);
                DatabaseManager.CurrentDb.ReadCompetitionList(tour);
                foreach (Competition comp in tour.Competitions.Values)
                {
                    TreeNode sub_child = new TreeNode();
                    sub_child.Text = comp.Info.Name;
                    sub_child.Tag  = comp;
                    DatabaseManager.CurrentDb.ReadCompetitionPlayersList(comp, CompetitionPlayerList.SortByField.SeedNo);
                    DatabaseManager.CurrentDb.ReadCompetitionMatchesList(comp);
                    child.Nodes.Add(sub_child);
                }
            }
            mainTreeView.ExpandAll();
            return(true);
        }
        private void ImportTournaments()
        {
            FTournaments.Clear();
            TournamentList tours = new TournamentList();

            database.ReadTournamentList(tours);
            foreach (Tournament tour in tours.Values)
            {
                database.ReadCompetitionList(tour);
                foreach (Competition comp in tour.Competitions.Values)
                {
                    database.ReadCompetitionPlayersList(comp, CompetitionPlayerList.SortByField.SeedNo);
                    database.ReadCompetitionMatchesList(comp);
                }
                FTournaments.Add(tour);
            }
        }
Esempio n. 5
0
        public ActionResult AllTournaments(TournamentList model)
        {
            var tournaments = _tournamentProvider.GetAllTournamentsOrderBy();

            foreach (var tournament in tournaments)
            {
                var tournamentViewModel = new TournamentViewModel
                {
                    IdTournament    = tournament.Id_champ,
                    TournamentName  = tournament.Title,
                    StartDate       = tournament.Date,
                    IsActive        = tournament.Is_active,
                    NumberOfRequest = _tournamentProvider.NumberOfRequest(tournament.Id_champ)
                };
                model.TournamentsList.Add(tournamentViewModel);
            }
            return(View(model));
        }
        public IApiResponseParsingResult ParseResponse(ParseApiResponse message)
        {
            var responseType = ApiResponseType.Unknown;

            try
            {
                object response;

                var responseXml = DynamicXml.Parse(message.Data);
                responseType = responseXml.GetName();

                switch (responseType)
                {
                case ApiResponseType.CompetitorProfile:
                    response = CompetitorProfile.Parse(responseXml);
                    break;

                case ApiResponseType.FixtureChanges:
                    response = FixtureChangeList.Parse(responseXml);
                    break;

                case ApiResponseType.FixturesFixture:
                    response = FixtureList.Parse(responseXml);
                    break;

                case ApiResponseType.MatchSummary:
                    response = MatchSummary.Parse(responseXml);
                    break;

                case ApiResponseType.MarketDescriptions:
                    response = MarketDescriptionList.Parse(responseXml);
                    break;

                case ApiResponseType.MatchTimeline:
                    response = MatchTimeline.Parse(responseXml);
                    break;

                case ApiResponseType.PlayerProfile:
                    response = PlayerProfile.Parse(responseXml);
                    break;

                case ApiResponseType.RaceTournamentInfo:
                case ApiResponseType.SimpleTournamentInfo:
                case ApiResponseType.StandardTournamentInfo:
                case ApiResponseType.TournamentInfo:
                    response = TournamentInfo.Parse(responseXml);
                    break;

                case ApiResponseType.Response:
                    response = Response.Parse(responseXml);
                    break;

                case ApiResponseType.Schedule:
                    response = Schedule.Parse(responseXml);
                    break;

                case ApiResponseType.SportCategories:
                    response = SportCategoriesList.Parse(responseXml);
                    break;

                case ApiResponseType.Sports:
                    response = SportList.Parse(responseXml);
                    break;

                case ApiResponseType.SportTournaments:
                    response = SportTournamentList.Parse(responseXml);
                    break;

                case ApiResponseType.Tournaments:
                    response = TournamentList.Parse(responseXml);
                    break;

                case ApiResponseType.VenueSummary:
                    response = VenueSummary.Parse(responseXml);
                    break;

                default:
                    throw new NotSupportedException(
                              $"Message of specified type ['{responseType}'] can not be parsed.");
                }

                return(new ApiResponseParsed
                {
                    Language = message.Language,
                    Response = response,
                    RequestId = message.RequestId,
                    EventId = message.EventId,
                    ProductType = message.ProductType
                });
            }
            catch (Exception e)
            {
                throw;
                //return new ApiResponseParsingFailed(
                //    failureReason: e,
                //    requestId: message.RequestId,
                //    responseData: message.Data,
                //    responseType: responseType
                //);
            }
        }
Esempio n. 7
0
 public TournamentViewModel()
 {
     Tournaments = new TournamentList();
 }