public FlowDocument PrintModernAbstract()
        {
            var rg      = new PentamindStandingsGenerator();
            var results = rg.GetModernAbstractStandings(null);

            return(Print(results, "Modern Abstract WC Standings"));
        }
        public FlowDocument PrintEuro()
        {
            var rg      = new PentamindStandingsGenerator();
            var results = rg.GetEuroStandings(null);

            return(Print(results, "Eurogames WC Standings"));
        }
예제 #3
0
        public void FreezeBackgammon()
        {
            var context                     = DataEntitiesProvider.Provide();
            var currentOlympiad             = context.Olympiad_Infoes.First(x => x.Current);
            var pentamindStandingsGenerator = new PentamindStandingsGenerator();

            // Next a Modern Abstract one
            var modernAbstractStandings = pentamindStandingsGenerator.GetBackgammonStandings(null);
            int rank = 1;

            foreach (var standing in modernAbstractStandings.Standings)
            {
                if (!standing.IsValid)
                {
                    continue;
                }

                var contestant = context.Contestants.FirstOrDefault(x => x.Mind_Sport_ID == standing.ContestantId);
                var evt        = context.Events.FirstOrDefault(x => x.OlympiadId == currentOlympiad.Id && x.Code == "BACC");
                var entry      = context.Entrants.FirstOrDefault(x => x.OlympiadId == currentOlympiad.Id &&
                                                                 x.Game_Code == "BACC" && x.Mind_Sport_ID == standing.ContestantId);
                if (entry == null)
                {
                    entry = Entrant.NewEntrant(evt.EIN, "BACC", currentOlympiad.Id, contestant, 0m);
                    context.Entrants.Add(entry);
                }
                entry.Score = standing.TotalScoreStr;
                entry.Rank  = rank;
                entry.Medal = MedalForRank(rank);
                rank++;
                context.SaveChanges();
            }
        }
        public FlowDocument PrintSenior()
        {
            var rg      = new PentamindStandingsGenerator();
            var results = rg.GetSeniorStandings(null);

            return(Print(results, "Senior Pentamind Standings"));
        }
예제 #5
0
        public void FreezePentamind()
        {
            var context         = DataEntitiesProvider.Provide();
            var currentOlympiad = context.Olympiad_Infoes.First(x => x.Current);

            // First of all, for each pentamind qualifier make a PEWC entry
            var pentamindStandingsGenerator = new PentamindStandingsGenerator();
            var standings = pentamindStandingsGenerator.GetStandings(null);
            int rank      = 1;

            foreach (var standing in standings.Standings)
            {
                if (!standing.IsValid)
                {
                    continue;
                }

                var contestant = context.Contestants.FirstOrDefault(x => x.Mind_Sport_ID == standing.ContestantId);
                var evt        = context.Events.FirstOrDefault(x => x.OlympiadId == currentOlympiad.Id && x.Code == "PEWC");
                var entry      = context.Entrants.FirstOrDefault(x => x.OlympiadId == currentOlympiad.Id &&
                                                                 x.Game_Code == "PEWC" && x.Mind_Sport_ID == standing.ContestantId);
                if (entry == null)
                {
                    entry = Entrant.NewEntrant(evt.EIN, "PEWC", currentOlympiad.Id, contestant, 0m);
                    context.Entrants.Add(entry);
                }
                entry.Score = standing.TotalScoreStr;
                entry.Rank  = rank;
                entry.Medal = MedalForRank(rank);
                rank++;
                context.SaveChanges();
            }

            rank = 1;
            foreach (var standing in standings.Standings.Where(x => x.IsInWomensPenta))
            {
                if (!standing.IsValid)
                {
                    continue;
                }

                var contestant = context.Contestants.FirstOrDefault(x => x.Mind_Sport_ID == standing.ContestantId);
                var evt        = context.Events.FirstOrDefault(x => x.OlympiadId == currentOlympiad.Id && x.Code == "PEWO");
                var entry      = context.Entrants.FirstOrDefault(x => x.OlympiadId == currentOlympiad.Id &&
                                                                 x.Game_Code == "PEWO" && x.Mind_Sport_ID == standing.ContestantId);
                if (entry == null)
                {
                    entry = Entrant.NewEntrant(evt.EIN, "PEWO", currentOlympiad.Id, contestant, 0m);
                    context.Entrants.Add(entry);
                }
                entry.Score = standing.TotalScoreStr;
                entry.Rank  = rank;
                entry.Medal = MedalForRank(rank);
                rank++;
                context.SaveChanges();
            }

            rank = 1;
            foreach (var standing in standings.Standings.Where(x => x.IsJunior))
            {
                if (!standing.IsValid)
                {
                    continue;
                }

                var contestant = context.Contestants.FirstOrDefault(x => x.Mind_Sport_ID == standing.ContestantId);
                var evt        = context.Events.FirstOrDefault(x => x.OlympiadId == currentOlympiad.Id && x.Code == "PEJR");
                var entry      = context.Entrants.FirstOrDefault(x => x.OlympiadId == currentOlympiad.Id &&
                                                                 x.Game_Code == "PEJR" && x.Mind_Sport_ID == standing.ContestantId);
                if (entry == null)
                {
                    entry = Entrant.NewEntrant(evt.EIN, "PEJR", currentOlympiad.Id, contestant, 0m);
                    context.Entrants.Add(entry);
                }
                entry.Score = standing.TotalScoreStr;
                entry.Rank  = rank;
                entry.Medal = MedalForRank(rank);
                rank++;
                context.SaveChanges();
            }

            rank = 1;
            foreach (var standing in standings.Standings.Where(x => x.IsSenior))
            {
                if (!standing.IsValid)
                {
                    continue;
                }

                var contestant = context.Contestants.FirstOrDefault(x => x.Mind_Sport_ID == standing.ContestantId);
                var evt        = context.Events.FirstOrDefault(x => x.OlympiadId == currentOlympiad.Id && x.Code == "PESR");
                var entry      = context.Entrants.FirstOrDefault(x => x.OlympiadId == currentOlympiad.Id &&
                                                                 x.Game_Code == "PESR" && x.Mind_Sport_ID == standing.ContestantId);
                if (entry == null)
                {
                    entry = Entrant.NewEntrant(evt.EIN, "PESR", currentOlympiad.Id, contestant, 0m);
                    context.Entrants.Add(entry);
                }
                entry.Score = standing.TotalScoreStr;
                entry.Rank  = rank;
                entry.Medal = MedalForRank(rank);
                rank++;
                context.SaveChanges();
            }
        }