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

            return(Print(results, "Modern Abstract WC Standings"));
        }
Ejemplo n.º 2
0
        public void FreezeModernAbstract()
        {
            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.GetModernAbstractStandings(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 == "MBWC");
                var entry      = context.Entrants.FirstOrDefault(x => x.OlympiadId == currentOlympiad.Id &&
                                                                 x.Game_Code == "MBWC" && x.Mind_Sport_ID == standing.ContestantId);
                if (entry == null)
                {
                    entry = Entrant.NewEntrant(evt.EIN, "MBWC", currentOlympiad.Id, contestant, 0m);
                    context.Entrants.Add(entry);
                }
                entry.Score = standing.TotalScoreStr;
                entry.Rank  = rank;
                entry.Medal = MedalForRank(rank);
                rank++;
                context.SaveChanges();
            }
        }