Ejemplo n.º 1
0
        public override void Run()
        {
            Console.WriteLine("Hello World!");
            HockeyDataContext context = null;

            try
            {
                var config = GetConfig();

                context = new HockeyDataContext(config);

                //context.Database.EnsureDeleted();
                //context.Database.EnsureCreated();
                //context.SaveChanges();

                //context.RefGameTypes.AddRange(new List<RefGameType>
                //{
                //	new RefGameType{ GameTypeId = GameType.Unknown, NhlGameTypeKey = string.Empty, GameTypeDescription = "Unknown"},
                //	new RefGameType{ GameTypeId = GameType.RegularSeason, NhlGameTypeKey = "R", GameTypeDescription = "Regular Season"},
                //	new RefGameType{ GameTypeId = GameType.Postseason, NhlGameTypeKey = "P", GameTypeDescription = "Postseason"},
                //	new RefGameType{ GameTypeId = GameType.Preseason, NhlGameTypeKey = "PR", GameTypeDescription = "Preseason"},
                //	new RefGameType{ GameTypeId = GameType.AllStarGame, NhlGameTypeKey = "A", GameTypeDescription = "All-Star Game"},
                //	new RefGameType{ GameTypeId = GameType.AllStarGameWomen, NhlGameTypeKey = "WA", GameTypeDescription = "All-Star Women Game"},
                //	new RefGameType{ GameTypeId = GameType.Olympics, NhlGameTypeKey = "O", GameTypeDescription = "Olympics Game"},
                //	new RefGameType{ GameTypeId = GameType.Exhibition, NhlGameTypeKey = "E", GameTypeDescription = "Exhibition"},
                //	new RefGameType{ GameTypeId = GameType.WorldCupExhibition, NhlGameTypeKey = "WCOH_EXH", GameTypeDescription = "World Cup of Hockey exhibition/preseason games "},
                //	new RefGameType{ GameTypeId = GameType.WorldCupPrelim, NhlGameTypeKey = "WCOH_PRELIM", GameTypeDescription = "World Cup of Hockey preliminary games"},
                //	new RefGameType{ GameTypeId = GameType.WorldCupFinal, NhlGameTypeKey = "WCOH_FINAL", GameTypeDescription = "World Cup of Hockey semifinals and finals"},
                //});
                //context.SaveChanges();

                //context.RefGameStatuses.AddRange(new List<RefGameStatus>
                //{
                //	new RefGameStatus{ DetailedGameStatusId = DetailedGameStatus.Scheduled, GameStatusId = GameStatus.Pregame, NhlStatusCode = 01, GameStatusName = "Pregame", DetailedGameStatusName = "Scheduled"},
                //	new RefGameStatus{ DetailedGameStatusId = DetailedGameStatus.Pregame, GameStatusId = GameStatus.Pregame, NhlStatusCode = 02, GameStatusName = "Pregame", DetailedGameStatusName = "Pregame"},
                //	new RefGameStatus{ DetailedGameStatusId = DetailedGameStatus.InProgress, GameStatusId = GameStatus.Live, NhlStatusCode = 03, GameStatusName = "Live", DetailedGameStatusName = "In-Progress"},
                //	new RefGameStatus{ DetailedGameStatusId = DetailedGameStatus.InProgressCritical, GameStatusId = GameStatus.Live, NhlStatusCode = 04, GameStatusName = "Live", DetailedGameStatusName = "In-Progress - Critical"},
                //	new RefGameStatus{ DetailedGameStatusId = DetailedGameStatus.GameOver, GameStatusId = GameStatus.Final, NhlStatusCode = 05, GameStatusName = "Final", DetailedGameStatusName = "Game Over"},
                //	new RefGameStatus{ DetailedGameStatusId = DetailedGameStatus.Final, GameStatusId = GameStatus.Final, NhlStatusCode = 06, GameStatusName = "Final", DetailedGameStatusName = "Final"},
                //	new RefGameStatus{ DetailedGameStatusId = DetailedGameStatus.Final2, GameStatusId = GameStatus.Final, NhlStatusCode = 07, GameStatusName = "Final", DetailedGameStatusName = "Final"},
                //	new RefGameStatus{ DetailedGameStatusId = DetailedGameStatus.ScheduledTbd, GameStatusId = GameStatus.Pregame, NhlStatusCode = 08, GameStatusName = "Pregame", DetailedGameStatusName = "Scheduled (Time TBD)"},
                //	new RefGameStatus{ DetailedGameStatusId = DetailedGameStatus.Postponed, GameStatusId = GameStatus.Postponed, NhlStatusCode = 09, GameStatusName = "Postponed", DetailedGameStatusName = "Postponed"},
                //});
                //context.SaveChanges();

                //context.RefPlayTypes.AddRange(new List<RefPlayType>
                //{
                //	new RefPlayType{ PlayTypeId = PlayType.BlockedShot, NhlCode = "BLOCKED_SHOT", PlayTypeName = "Blocked Shot" },
                //	new RefPlayType{ PlayTypeId = PlayType.Faceoff, NhlCode = "FACEOFF", PlayTypeName = "Faceoff" },
                //	new RefPlayType{ PlayTypeId = PlayType.GameEnd, NhlCode = "GAME_END", PlayTypeName = "Game End" },
                //	new RefPlayType{ PlayTypeId = PlayType.GameScheduled, NhlCode = "GAME_SCHEDULED", PlayTypeName = "Game Scheduled" },
                //	new RefPlayType{ PlayTypeId = PlayType.Giveaway, NhlCode = "GIVEAWAY", PlayTypeName = "Giveaway" },
                //	new RefPlayType{ PlayTypeId = PlayType.Goal, NhlCode = "GOAL", PlayTypeName = "Goal" },
                //	new RefPlayType{ PlayTypeId = PlayType.Hit, NhlCode = "HIT", PlayTypeName = "Hit" },
                //	new RefPlayType{ PlayTypeId = PlayType.MissedShot, NhlCode = "MISSED_SHOT", PlayTypeName = "Missed Shot" },
                //	new RefPlayType{ PlayTypeId = PlayType.Penalty, NhlCode = "PENALTY", PlayTypeName = "Penalty" },
                //	new RefPlayType{ PlayTypeId = PlayType.PeriodEnd, NhlCode = "PERIOD_END", PlayTypeName = "Period End" },
                //	new RefPlayType{ PlayTypeId = PlayType.PeriodOfficial, NhlCode = "PERIOD_OFFICIAL", PlayTypeName = "Period Official" },
                //	new RefPlayType{ PlayTypeId = PlayType.PeriodReady, NhlCode = "PERIOD_READY", PlayTypeName = "Period Ready" },
                //	new RefPlayType{ PlayTypeId = PlayType.PeriodStart, NhlCode = "PERIOD_START", PlayTypeName = "Period Start" },
                //	new RefPlayType{ PlayTypeId = PlayType.Shot, NhlCode = "SHOT", PlayTypeName = "Shot" },
                //	new RefPlayType{ PlayTypeId = PlayType.Stoppage, NhlCode = "STOP", PlayTypeName = "Stoppage" },
                //	new RefPlayType{ PlayTypeId = PlayType.Takeaway, NhlCode = "TAKEAWAY", PlayTypeName = "Takeaway" },
                //});
                //context.SaveChanges();

                //context.RefStoppageTypes.AddRange(new List<RefStoppageType>
                //{
                //	new RefStoppageType{ StoppageTypeId = StoppageType.Unknown, NhlDescription = null , StoppageName = "Unknown"},
                //	new RefStoppageType{ StoppageTypeId = StoppageType.GoalieStopped, NhlDescription = "Goalie Stopped", StoppageName = "Goalie Stopped"},
                //	new RefStoppageType{ StoppageTypeId = StoppageType.Icing, NhlDescription = "Icing", StoppageName = "Icing"},
                //	new RefStoppageType{ StoppageTypeId = StoppageType.NetOff, NhlDescription = "Net Off", StoppageName = "Net Off"},
                //	new RefStoppageType{ StoppageTypeId = StoppageType.Offside, NhlDescription = "Offside", StoppageName = "Offside"},
                //	new RefStoppageType{ StoppageTypeId = StoppageType.PuckFrozen, NhlDescription = "Puck Frozen", StoppageName = "Puck Frozen"},
                //	new RefStoppageType{ StoppageTypeId = StoppageType.PuckInBenches, NhlDescription = "Puck In Benches", StoppageName = "Puck in Benches"},
                //	new RefStoppageType{ StoppageTypeId = StoppageType.PuckInCrowd, NhlDescription = "Puck In Crowd", StoppageName = "Puck in Crowd"},
                //	new RefStoppageType{ StoppageTypeId = StoppageType.PuckInNetting, NhlDescription = "Puck In Netting", StoppageName = "Puck in Netting"},
                //	new RefStoppageType{ StoppageTypeId = StoppageType.TVTimeout, NhlDescription = "TV Timeout", StoppageName = "TV timeout"},
                //});
                //context.SaveChanges();

                //context.Leagues.Add(new League { LeagueName = "National Hockey League", LeagueAbbr = "NHL" });
                //context.SaveChanges();

                //context.Players.Add(new Player { NhlPlayerId = 0, FullName = "Unknown" });
                //context.SaveChanges();

                var seasonsProcessor = new SeasonsProcessor();
                seasonsProcessor.Run(context);

                //var dbSeasons = context.Seasons.Where(x => x.SeasonId > 100 && x.NhlSeasonKey != "20192020").OrderBy(x => x.SeasonId).ToList();
                var dbSeasons = context.Seasons.Where(x => x.NhlSeasonKey == "20192020").OrderBy(x => x.SeasonId).ToList();
                //var dbSeasons = context.Seasons.OrderBy(x => x.SeasonId).ToList();
                for (int i = 0; i < dbSeasons.Count; i++)
                {
                    var dbSeason     = dbSeasons[i];
                    var nhlSeasonKey = dbSeason.NhlSeasonKey;
                    Console.WriteLine($"PROCESS TEAMS - {nhlSeasonKey}");
                    var teamsProcessor = new TeamsProcessor(nhlSeasonKey);
                    teamsProcessor.Run(context);

                    Console.WriteLine($"PROCESS GAMES - {nhlSeasonKey}");
                    var gamesProcessor = new GamesProcessor(nhlSeasonKey);
                    gamesProcessor.Run(context);

                    var seasonGames = context.Games.Where(x => x.SeasonId == dbSeason.SeasonId).ToList();
                    for (int j = 0; j < seasonGames.Count; j++)
                    {
                        Console.WriteLine($"PROCESS GAMES - {nhlSeasonKey} - BOXES: {j}/{seasonGames.Count}");
                        var seasonGame        = seasonGames[j];
                        var gameLiveProcessor = new GameLiveProcessor(seasonGame.NhlGameId, seasonGame.GameDateEst);
                        gameLiveProcessor.Run(context);

                        if (j % 30 == 29)
                        {
                            context.Dispose();
                            context = new HockeyDataContext(config);
                        }
                    }

                    if (i % 10 == 9)
                    {
                        context.Dispose();
                        context = new HockeyDataContext(config);
                    }
                }
            }
            finally
            {
                if (context != null)
                {
                    context.Dispose();
                }
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            var config = GetConfig();

            var context = new SoccerDataContext(config);

            //var init = new SoccerDataContextInitializer();
            //init.InitializeDatabase(context);

            var countriesProcessor = new CountriesProcessor();

            Console.WriteLine("START COUNTRIES");
            countriesProcessor.Run(context);
            Console.WriteLine("SAVE COUNTRIES");
            context.SaveChanges();
            Console.WriteLine("END COUNTRIES");

            var leaguesProcessor = new LeaguesProcessor();

            Console.WriteLine("START LEAGUES");
            leaguesProcessor.Run(context);
            Console.WriteLine("SAVE LEAGUES");
            context.SaveChanges();
            Console.WriteLine("END LEAGUES");

            var desiredLeagueIds = new List <int>
            {
                751, 752, 51, 403,                                                      // EURO CHAMPS
                1, 749, 750,                                                            // WORLD CUP
                52, 31, 132, 530, 53, 32, 137, 514,                                     // UEFA CL/EL
                735, 734, 733, 732, 731, 730, 64, 30, 87,                               // ESP - LA LIGA
                65, 33, 88, 776,                                                        // ESP - SEGUNDA
                808, 973,                                                               // ESP - COPA DEL REY
                499, 498, 444, 968, 502, 501, 445, 966,                                 // AND - 1st AND 2nd
                201, 200, 199, 294,                                                     // USA - MLS
                521, 520, 519, 518, 522, 523                                            // USA - USL
            };

            desiredLeagueIds = new List <int>
            {
                1, 749, 750,                                                                                    // WORLD CUP
                64, 30, 87,                                                                                     // ESP - LA LIGA
                808, 973,                                                                                       // ESP - COPA DEL REY
                200, 199, 294,                                                                                  // USA - MLS
            };

            var competitionSeasonIds = context.CompetitionSeasons
                                       .Where(x => desiredLeagueIds.Contains(x.ApiFootballId))
                                       .Select(x => x.CompetitionSeasonId)
                                       .Distinct()
                                       .OrderBy(x => x)
                                       .ToList();

            for (int i = 0; i < competitionSeasonIds.Count; i++)
            {
                Console.WriteLine($"START LEAGUE {i+1} OF {competitionSeasonIds.Count}");
                int competitionSeasonId = competitionSeasonIds[i];

                if (i % 10 == 9)
                {
                    Console.WriteLine("NEW CONTEXT");
                    context.Dispose();
                    context = new SoccerDataContext(config);
                }

                var teamsProcessor = new TeamsProcessor(competitionSeasonId);
                teamsProcessor.Run(context);

                var roundsProcessor = new CompetitionSeasonRoundsProcessor(competitionSeasonId);
                roundsProcessor.Run(context);

                context.SaveChanges();

                var leagueFixturesProcessor = new LeagueFixturesProcessor(competitionSeasonId);
                leagueFixturesProcessor.Run(context);

                context.SaveChanges();
            }
            var a = 1;
        }
        public override void Run()
        {
            var config = GetConfig();

            using (var context = new BasketballDataContext(config))
            {
                context.Countries.Add(
                    new Country
                {
                    ApiBasketballCountryId = 0,
                    CountryAbbr            = "XX",
                    CountryName            = "World",
                    FlagUrl = null
                });

                context.RefGameStatuses.AddRange(new List <RefGameStatus>
                {
                    new RefGameStatus {
                        FullGameStatusId = FullGameStatus.NotStarted, FullGameStatusName = "Not Started", GameStatusId = GameStatus.Pregame, GameStatusName = "Pregame", ApiBasketballStatusCode = "NS"
                    },
                    new RefGameStatus {
                        FullGameStatusId = FullGameStatus.Live_Q1, FullGameStatusName = "Live - Q1", GameStatusId = GameStatus.Live, GameStatusName = "Live", ApiBasketballStatusCode = "Q1"
                    },
                    new RefGameStatus {
                        FullGameStatusId = FullGameStatus.Live_Q2, FullGameStatusName = "Live - Q2", GameStatusId = GameStatus.Live, GameStatusName = "Live", ApiBasketballStatusCode = "Q2"
                    },
                    new RefGameStatus {
                        FullGameStatusId = FullGameStatus.Live_Q3, FullGameStatusName = "Live - Q3", GameStatusId = GameStatus.Live, GameStatusName = "Live", ApiBasketballStatusCode = "Q3"
                    },
                    new RefGameStatus {
                        FullGameStatusId = FullGameStatus.Live_Q4, FullGameStatusName = "Live - Q4", GameStatusId = GameStatus.Live, GameStatusName = "Live", ApiBasketballStatusCode = "Q4"
                    },
                    new RefGameStatus {
                        FullGameStatusId = FullGameStatus.Live_OT, FullGameStatusName = "Live - OT", GameStatusId = GameStatus.Live, GameStatusName = "Live", ApiBasketballStatusCode = "OT"
                    },
                    new RefGameStatus {
                        FullGameStatusId = FullGameStatus.Live_BK, FullGameStatusName = "Live - Break", GameStatusId = GameStatus.Live, GameStatusName = "Live", ApiBasketballStatusCode = "BT"
                    },
                    new RefGameStatus {
                        FullGameStatusId = FullGameStatus.Live_HT, FullGameStatusName = "Live - Halftime", GameStatusId = GameStatus.Live, GameStatusName = "Live", ApiBasketballStatusCode = "HT"
                    },
                    new RefGameStatus {
                        FullGameStatusId = FullGameStatus.Final, FullGameStatusName = "Final", GameStatusId = GameStatus.Final, GameStatusName = "Final", ApiBasketballStatusCode = "FT"
                    },
                    new RefGameStatus {
                        FullGameStatusId = FullGameStatus.FinalWithOT, FullGameStatusName = "Final (OT)", GameStatusId = GameStatus.Final, GameStatusName = "Final", ApiBasketballStatusCode = "AOT"
                    },
                    new RefGameStatus {
                        FullGameStatusId = FullGameStatus.Postponed, FullGameStatusName = "Postponed", GameStatusId = GameStatus.Postponed, GameStatusName = "Postponed", ApiBasketballStatusCode = "POST"
                    },
                    new RefGameStatus {
                        FullGameStatusId = FullGameStatus.Cancelled, FullGameStatusName = "Cancelled", GameStatusId = GameStatus.Cancelled, GameStatusName = "Cancelled", ApiBasketballStatusCode = "CANC"
                    },
                    new RefGameStatus {
                        FullGameStatusId = FullGameStatus.Unknown, FullGameStatusName = "Unknown", GameStatusId = GameStatus.Unknown, GameStatusName = "Unknown", ApiBasketballStatusCode = null
                    }
                });
                context.SaveChanges();

                var bookmakersProcessor = new BookmakersProcessor();
                Console.WriteLine("START BOOKMAKERS");
                bookmakersProcessor.Run(context);
                Console.WriteLine("SAVE BOOKMAKERS");
                context.SaveChanges();
                Console.WriteLine("END BOOKMAKERS");

                var betTypesProcessor = new BetTypesProcessor();
                Console.WriteLine("START BET TYPES");
                betTypesProcessor.Run(context);
                Console.WriteLine("SAVE BET TYPES");
                context.SaveChanges();
                Console.WriteLine("END BET TYPES");

                var countriesProcessor = new CountriesProcessor();
                Console.WriteLine("START COUNTRIES");
                countriesProcessor.Run(context);
                Console.WriteLine("SAVE COUNTRIES");
                context.SaveChanges();
                Console.WriteLine("END COUNTRIES");

                var leaguesProcessor = new LeaguesProcessor();
                Console.WriteLine("START LEAGUES");
                leaguesProcessor.Run(context);
                Console.WriteLine("SAVE LEAGUES");
                context.SaveChanges();
                Console.WriteLine("END LEAGUES");

                var leagueSeasons = context.LeagueSeasons
                                    .OrderBy(x => x.LeagueSeasonId)
                                    .Select(y => new { y.ApiBasketballLeagueId, y.ApiBasketballSeasonKey })
                                    .ToList();

                foreach (var leagueSeason in leagueSeasons)
                {
                    int    leagueId       = leagueSeason.ApiBasketballLeagueId;
                    string seasonKey      = leagueSeason.ApiBasketballSeasonKey;
                    var    teamsProcessor = new TeamsProcessor(leagueId, seasonKey);
                    Console.WriteLine($"START TEAMS - {leagueId} {seasonKey}");
                    teamsProcessor.Run(context);
                    Console.WriteLine($"SAVE TEAMS - {leagueId} {seasonKey}");
                    context.SaveChanges();
                    Console.WriteLine($"END TEAMS - {leagueId} {seasonKey}");
                }

                var countriesDict = context.Countries.ToDictionary(x => x.ApiBasketballCountryId, y => y.CountryId);
                var teamsDict     = context.Teams.ToDictionary(x => x.ApiBasketballTeamId, y => y.TeamId);
                var statusDict    = context.RefGameStatuses
                                    .Where(x => !string.IsNullOrEmpty(x.ApiBasketballStatusCode))
                                    .ToDictionary(x => x.ApiBasketballStatusCode, y => y.FullGameStatusId);
                foreach (var leagueSeason in leagueSeasons)
                {
                    int    leagueId       = leagueSeason.ApiBasketballLeagueId;
                    string seasonKey      = leagueSeason.ApiBasketballSeasonKey;
                    var    gamesProcessor = new GamesProcessor(leagueId, seasonKey, countriesDict, statusDict);
                    Console.WriteLine($"START GAMES - {leagueId} {seasonKey}");
                    gamesProcessor.Run(context);
                    Console.WriteLine($"SAVE GAMES - {leagueId} {seasonKey}");
                    context.SaveChanges();
                    Console.WriteLine($"END GAMES - {leagueId} {seasonKey}");
                }

                var bookmakersDict = context.Bookmakers.ToDictionary(x => x.ApiBasketballBookmakerId, y => y.BookmakerId);
                var betTypesDict   = context.BetTypes.ToDictionary(x => x.ApiBasketballBetTypeId, y => y.BetTypeId);

                var liveAndUpcomingGameStatuses = context.RefGameStatuses
                                                  .Where(x => x.GameStatusId == GameStatus.Pregame || x.GameStatusId == GameStatus.Live)
                                                  .Select(x => x.FullGameStatusId)
                                                  .ToList();

                foreach (var leagueSeason in leagueSeasons)
                {
                    int    leagueId      = leagueSeason.ApiBasketballLeagueId;
                    string seasonKey     = leagueSeason.ApiBasketballSeasonKey;
                    var    oddsProcessor = new OddsProcessor(leagueId, seasonKey, betTypesDict, bookmakersDict);
                    Console.WriteLine($"START ODDS - {leagueId} {seasonKey}");
                    oddsProcessor.Run(context);
                    Console.WriteLine($"SAVE ODDS - {leagueId} {seasonKey}");
                    context.SaveChanges();
                    Console.WriteLine($"END ODDS - {leagueId} {seasonKey}");
                }
            }
        }
Ejemplo n.º 4
0
        public override void Run()
        {
            Console.WriteLine("Hello World!");
            SoccerDataContext context   = null;
            DateTime          startTime = DateTime.Now;

            try
            {
                var config = GetConfig();

                context = new SoccerDataContext(config);

                //context.Database.EnsureDeleted();
                //context.Database.EnsureCreated();
                //context.SaveChanges();

                //var countriesProcessor = new CountriesProcessor();
                //Console.WriteLine("START COUNTRIES");
                //countriesProcessor.Run(context);
                //Console.WriteLine("SAVE COUNTRIES");
                //context.SaveChanges();
                //Console.WriteLine("END COUNTRIES");

                //var leaguesProcessor = new LeaguesProcessor();
                //Console.WriteLine("START LEAGUES");
                //leaguesProcessor.Run(context);
                //Console.WriteLine("SAVE LEAGUES");
                //context.SaveChanges();
                //Console.WriteLine("END LEAGUES");

                List <int> desiredLeagueIds = null;
                desiredLeagueIds = new List <int>
                {
                    751, 752, 51, 403,                                                  // EURO CHAMPS
                    1, 749, 750,                                                        // WORLD CUP
                    52, 31, 132, 530, 53, 32, 137, 514,                                 // UEFA CL/EL
                    735, 734, 733, 732, 731, 730, 64, 30, 87,                           // ESP - LA LIGA
                    65, 33, 88, 776,                                                    // ESP - SEGUNDA
                    808, 973,                                                           // ESP - COPA DEL REY
                    499, 498, 444, 968, 502, 501, 445, 966,                             // AND - 1st AND 2nd
                    201, 200, 199, 294,                                                 // USA - MLS
                    521, 520, 519, 518, 522, 523                                        // USA - USL
                };
                //desiredLeagueIds = new List<int>
                //{
                //	1, 749, 750,								// WORLD CUP
                //	64, 30, 87,									// ESP - LA LIGA
                //	808, 973,									// ESP - COPA DEL REY
                //	200, 199, 294,								// USA - MLS
                //};
                desiredLeagueIds = new List <int> {
                    357, 82, 775
                };                                                                 // 2019 BRAZIL SERIE A, 2018 CHINA SUPER LEAGUE, 2019-2020 ESP LALIGA

                var competitionSeasons = context.CompetitionSeasons
                                         .Include(x => x.Competition)
                                         //.Where(x => desiredLeagueIds == null || desiredLeagueIds.Contains(x.ApiFootballId))
                                         .Where(x => x.StartDate.HasValue && /*x.StartDate.Value.Date >= new DateTime(2014, 01, 01) &&*/ x.StartDate.Value.Date < new DateTime(2016, 01, 01))
                                         //.Where(x => (x.IsCurrent && x.Competition.CompetitionType.ToUpper() == "LEAGUE" && x.EndDate.HasValue && x.EndDate.Value.Date >= DateTime.Now.Date) && (new List<string> { "ES", "CN", "BR", "AM", "CH", "CZ", "CR", "DE", "DK", "EE", "FO", "GB", "IT", "KR", "PT", "TW" }).Contains(x.Competition.Country.CountryAbbr)) // CURRENT || (PAST FROM COUNTRIES NOT CURRENTLY CANCELLED DUE TO COVID-19)
                                         //.Where(x => (x.IsCurrent && x.EndDate.Date >= DateTime.Now.Date) || (new List<string> { "MX", "RU", "CL", "DZ", "AR", "TR", "UA", "AU", "IN", "BY", "BR", "CR", "AO", "NI", "HK", "SG" }).Contains(x.Competition.Country.CountryAbbr)) // CURRENT || (PAST FROM COUNTRIES NOT CURRENTLY CANCELLED DUE TO COVID-19)
                                         //.Where(x =>x.Season >= 2016 && (new List<string> { "MX", "RU", "TR", "AU", "BY", "BR", "AO", "NI", "HK", "SG", "DK", "PL", "PY", "CN" }).Contains(x.Competition.Country.CountryAbbr)) // (PAST FROM COUNTRIES NOT CURRENTLY CANCELLED DUE TO COVID-19)
                                         //.Where(x => x.Season >= 2016 && (new List<string> { "BY", "NI", "ES" }).Contains(x.Competition.Country.CountryAbbr)) // (PAST FROM COUNTRIES NOT CURRENTLY CANCELLED DUE TO COVID-19)
                                         //.Where(x => x.IsCurrent && x.Competition.CompetitionType.ToUpper() == "LEAGUE" && x.StartDate.HasValue && x.StartDate.Value.Date >= new DateTime(2019, 01, 01)) // (PAST FROM COUNTRIES NOT CURRENTLY CANCELLED DUE TO COVID-19)
                                         .OrderBy(x => x.CompetitionSeasonId)
                                         .ToList();

                int         i = 710;         // REDO API LEAGUE ID 2432
                List <Team> dbTeams;
                for (; i < competitionSeasons.Count; i++)
                {
                    Console.WriteLine($"START LEAGUE {i + 1} OF {competitionSeasons.Count}");

                    var competitionSeason   = competitionSeasons[i];
                    int competitionSeasonId = competitionSeason.CompetitionSeasonId;

                    // NULL StartDate AND/OR EndDate INDICATES NO GAMES AVAILABLE... NOTHING MORE TO PROCESS
                    if (competitionSeason.StartDate.HasValue && competitionSeason.EndDate.HasValue)
                    {
                        var teamsProcessor = new TeamsProcessor(competitionSeasonId);
                        teamsProcessor.Run(context);

                        var roundsProcessor = new CompetitionSeasonRoundsProcessor(competitionSeasonId);
                        roundsProcessor.Run(context);

                        var leagueFixturesProcessor = new LeagueFixturesProcessor(competitionSeasonId);
                        leagueFixturesProcessor.Run(context);

                        context.Dispose();
                        context = new SoccerDataContext(config);

                        dbTeams = context.Teams.Where(x => x.TeamSeasons.Any(y => y.CompetitionSeasonId == competitionSeasonId)).ToList();
                        for (int j = 0; j < dbTeams.Count; j++)
                        {
                            Console.WriteLine($"LEAGUE {i + 1} OF {competitionSeasons.Count} - TEAM {j + 1} OF {dbTeams.Count}");
                            var dbTeam             = dbTeams[j];
                            var teamSquadProcessor = new TeamSquadProcessor(dbTeam.ApiFootballId, competitionSeason);
                            teamSquadProcessor.Run(context);

                            if (j % 5 == 4)
                            {
                                Console.WriteLine("NEW CONTEXT");
                                context.Dispose();
                                context = new SoccerDataContext(config);
                            }
                        }

                        context.Dispose();
                        context = new SoccerDataContext(config);

                        var competitionSeasonFixtures = context.Fixtures.Where(x => x.CompetitionSeasonId == competitionSeasonId).ToList();
                        for (int j = 0; j < competitionSeasonFixtures.Count; j++)
                        {
                            Console.WriteLine($"LEAGUE {i + 1} OF {competitionSeasons.Count} - FIXTURE {j + 1} OF {competitionSeasonFixtures.Count} - {competitionSeason.Competition.CompetitionName} ({competitionSeason.Competition.CountryId})");

                            var dbFixture = competitionSeasonFixtures[j];

                            if (string.Equals("Match Finished", dbFixture.Status, StringComparison.CurrentCultureIgnoreCase))
                            {
                                // TODO: PROCESS FIXTURE DATA (INCLUDE SETTING HasTeamBoxscores VALUE ON FIXTURE)
                                var fixtureProcessor = new FixtureProcessor(dbFixture.ApiFootballId);
                                fixtureProcessor.Run(context);

                                var apiFootballPredictionsProcessor = new ApiFootballPredictionsProcessor(dbFixture.ApiFootballId);
                                apiFootballPredictionsProcessor.Run(context);
                            }

                            if (j % 5 == 4)
                            {
                                Console.WriteLine("NEW CONTEXT");
                                context.Dispose();
                                context = new SoccerDataContext(config);
                            }
                        }

                        context.SaveChanges();
                    }
                }
                context.SaveChanges();

                var apiTeamIds = context.Teams.Select(x => x.ApiFootballId).Distinct().ToList();
                i = 0;
                for (; i < apiTeamIds.Count; i++)
                {
                    Console.WriteLine($"TRANSFERS - TEAM {i + 1} OF {apiTeamIds.Count}");
                    var apiTeamId = apiTeamIds[i];
                    var teamTransfersProcessor = new TransfersProcessor(apiTeamId);
                    teamTransfersProcessor.Run(context);

                    if (i % 5 == 4)
                    {
                        Console.WriteLine("NEW CONTEXT");
                        context.Dispose();
                        context = new SoccerDataContext(config);
                    }
                }
            }
            finally
            {
                if (context != null)
                {
                    context.Dispose();
                }
            }

            DateTime endTime   = DateTime.Now;
            TimeSpan runLength = endTime - startTime;

            Console.WriteLine($"{ (runLength).TotalSeconds } SEC ({ runLength.Hours }:{ runLength.Minutes }:{ runLength.Seconds })");
            Console.ReadKey();
        }