private void ImportRatings()
        {
            FRatings.Clear();
            TypeOfSportList games = new TypeOfSportList();

            database.ReadTypeOfSportList(games);
            foreach (TypeOfSport game in games.Values)
            {
                XmlExporter.RatingNode node = new XmlExporter.RatingNode();
                node.Game = game;
                TA.RatingSystem.PlayersRatingList ratings = new TA.RatingSystem.PlayersRatingList();
                database.ReadPlayerRatingList(game.Id, ratings);
                node.Ratings.AddRange(ratings.Values);
                FRatings.Add(game, node);
            }
        }
Пример #2
0
        private void SaveCompetitionPlayers(params object[] args)
        {
            if (args.Length != 2)
            {
                throw new Exception("Wrong param count");
            }
            CompetitionPlayerList playersToSave   = args[0] as CompetitionPlayerList;
            List <int>            playersToDelete = args[1] as List <int>;

#if FEDITION || STANDARD || FEDITION_PLUS || STANDARD_PLUS
            TA.RatingSystem.PlayersRatingList players_rating = TA.RatingSystem.Builder.RatingSystemBuilder.GetPlayersRating(FCompetition.Info.SportType.Id, FCompetition.Info.Date);
#endif
            foreach (CompetitionPlayerInfo player in playersToSave.Values)
            {
                player.CompetitionId = FCompetition.Info.Id;
#if FEDITION || STANDARD || FEDITION_PLUS || STANDARD_PLUS
                player.RatingBeforeCompetition = players_rating[player.Id].Rating;
#else
                player.RatingBeforeCompetition = 0;
#endif
                if (player.StartPoints == 0)
                {
                    player.StartPoints = LateStartPoints;
                }
                DatabaseManager.CurrentDb.CompetitionPlayerInfoSave(player);
                if (playersToDelete.Contains(player.Id))
                {
                    playersToDelete.Remove(player.Id);
                }
                if (!FCompetition.Players.ContainsKey(player.Id))
                {
                    FCompetition.Players.Add(player.Id, player);
                }
            }
            foreach (int playerId in playersToDelete)
            {
                DatabaseManager.CurrentDb.CompetitionPlayerInfoDelete(FCompetition.Info.Id, playerId);
                FCompetition.Players.Remove(playerId);
            }
            UpdatePlayersList();
        }
Пример #3
0
        private void SaveCompetitionPlayers(params object[] args)
        {
            if (args.Length != 2)
            {
                throw new Exception(Localizator.Dictionary.GetString("WRONG_PARAM_COUNT"));
            }
            CompetitionPlayerList playersToSave   = args[0] as CompetitionPlayerList;
            List <int>            playersToDelete = args[1] as List <int>;

#if FEDITION || STANDARD || FEDITION_PLUS || STANDARD_PLUS
            TA.RatingSystem.PlayersRatingList players_rating = TA.RatingSystem.Builder.RatingSystemBuilder.GetPlayersRating(FCompetition.Info.SportType.Id, FCompetition.Info.Date);
#endif
            int seedNo = 1;
            foreach (CompetitionPlayerInfo player in playersToSave.Values)
            {
                if (!FCompetition.NeedsPlayersDrawing)
                {
                    player.SeedNo = seedNo++;
                }
                player.CompetitionId = FCompetition.Info.Id;
#if FEDITION || STANDARD || FEDITION_PLUS || STANDARD_PLUS
                player.RatingBeforeCompetition = players_rating[player.Id].Rating;
#else
                player.RatingBeforeCompetition = 0;
#endif
                DatabaseManager.CurrentDb.CompetitionPlayerInfoSave(player);
                if (playersToDelete.Contains(player.Id))
                {
                    playersToDelete.Remove(player.Id);
                }
            }
            foreach (int playerId in playersToDelete)
            {
                DatabaseManager.CurrentDb.CompetitionPlayerInfoDelete(FCompetition.Info.Id, playerId);
            }
        }