Example #1
0
        private static Dictionary <int, Dictionary <LeagueEnum, LeagueTable> > _getClassifications(List <JourneyDateClassification> journeys, Configuration configuration)
        {
            // Cargamos clasificacion
            Log.Info("Cargando las clasificaciones");
            Dictionary <int, Dictionary <LeagueEnum, LeagueTable> > classifications = new Dictionary <int, Dictionary <LeagueEnum, LeagueTable> >();

            foreach (var j in journeys)
            {
                if (j.journey == 2) // TODO if (j.journey > 1)
                {
                    Dictionary <string, string> leagueRequest = new Dictionary <string, string>();
                    leagueRequest.Add(EnumUtility.GetDescriptionFromEnumValue(LeagueEnum.PRIMERA), "competitions/436/leagueTable/?matchday=" + (j.journey - 1));
                    leagueRequest.Add(EnumUtility.GetDescriptionFromEnumValue(LeagueEnum.SEGUNDA), "competitions/437/leagueTable/?matchday=" + (j.journey - 1));

                    ApiRequester ar = new ApiRequester()
                    {
                        API_KEY       = configuration.API_KEY,
                        API_URL       = configuration.API_URL,
                        RequestHeader = configuration.RequestHeader,
                        LeagueRequest = leagueRequest
                    };

                    /*
                     * ar.DownloadLeague(LeagueEnum.PRIMERA);
                     * ar.DownloadLeague(LeagueEnum.SEGUNDA);
                     */

                    LeagueTable firstDiv  = ar.GetLeague(LeagueEnum.PRIMERA, j.journey);
                    LeagueTable secondDiv = ar.GetLeague(LeagueEnum.SEGUNDA, j.journey);

                    Dictionary <LeagueEnum, LeagueTable> table = new Dictionary <LeagueEnum, LeagueTable>();
                    table.Add(LeagueEnum.PRIMERA, firstDiv);
                    table.Add(LeagueEnum.SEGUNDA, secondDiv);

                    classifications.Add(j.journey, table);
                }
            }
            return(classifications);
        }