Exemplo n.º 1
0
        /*public async Task UpdateTeam()
         * {
         *  var teams = await _wpbService.GetTeamsAllAdminAsync();
         *
         *  foreach (var team in teams)
         *  {
         *      team.HasLogo = false;
         *      await _wpbService.UpdateTeamAsync(team);
         *  }
         *
         * }*/

        public async Task AddDataSourceRankingAsync()
        {
            var encrypter  = new TyfSimpleAes();
            var collection = new List <DataSourceRanking>();

            var dataSources = new List <DataSourceRanking>()
            {
                new DataSourceRanking()
                {
                    DataSourceDescription = @"First Division Rankings - 18/19",
                    Division      = "Division 1",
                    DivisionCode  = "DIV1",
                    Url           = @"http://www.gbwba.org.uk/gbwba/index.cfm/the-league/?v=ll&LeagueId=148",
                    UrlHash       = encrypter.Encrypt(@"http://www.gbwba.org.uk/gbwba/index.cfm/the-league/?v=ll&LeagueId=148"),
                    TimeStamp     = SystemTime.Now(),
                    ClassNameNode = @"//table[@class='leagueManager_divisionTable']"
                },
                new DataSourceRanking()
                {
                    DataSourceDescription = @"Second Division Rankings - 18/19",
                    Division      = "Division 2",
                    DivisionCode  = "DIV2",
                    Url           = @"http://www.gbwba.org.uk/gbwba/index.cfm/the-league/?v=ll&LeagueId=149",
                    UrlHash       = encrypter.Encrypt(@"http://www.gbwba.org.uk/gbwba/index.cfm/the-league/?v=ll&LeagueId=149"),
                    TimeStamp     = SystemTime.Now(),
                    ClassNameNode = @"//table[@class='leagueManager_divisionTable']"
                },
                new DataSourceRanking()
                {
                    DataSourceDescription = @"Third Division Rankings - 18/19",
                    Division      = "Division 3",
                    DivisionCode  = "DIV3",
                    Url           = @"http://www.gbwba.org.uk/gbwba/index.cfm/the-league/?v=ll&LeagueId=142",
                    UrlHash       = encrypter.Encrypt(@"http://www.gbwba.org.uk/gbwba/index.cfm/the-league/?v=ll&LeagueId=142"),
                    TimeStamp     = SystemTime.Now(),
                    ClassNameNode = @"//table[@class='leagueManager_divisionTable']"
                }
            };

            foreach (var item in dataSources)
            {
                try
                {
                    await _wpbService.CreateRankingDataSourceAsync(item);
                }
                catch (Exception err)
                {
                    var msg = err.ToString();
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Prime the fixture data sources
        /// </summary>
        /// <returns></returns>
        public async Task AddDataSourceFixturesAsync()
        {
            var encrypter = new TyfSimpleAes();

            var dataSources = new List <DataSourceFixture>()
            {
                new DataSourceFixture()
                {
                    DataSourceDescription = @"First Division Fixtures - 18/19",
                    Division     = "Division 1",
                    DivisionCode = "DIV1",
                    Url          = @"http://www.gbwba.org.uk/gbwba/index.cfm/the-league/?v=lf&LeagueId=148",
                    UrlHash      =
                        encrypter.Encrypt(@"http://www.gbwba.org.uk/gbwba/index.cfm/the-league/?v=lf&LeagueId=148"),
                    TimeStamp     = SystemTime.Now(),
                    ClassNameNode = @"//table[@class='leagueManager_fixturesTable']"
                },
                new DataSourceFixture()
                {
                    DataSourceDescription = @"Second Division Fixtures - 18/19",
                    Division     = "Division 2",
                    DivisionCode = "DIV2",
                    Url          = @"http://www.gbwba.org.uk/gbwba/index.cfm/the-league/?v=lf&LeagueId=149",
                    UrlHash      =
                        encrypter.Encrypt(@"http://www.gbwba.org.uk/gbwba/index.cfm/the-league/?v=lf&LeagueId=149"),
                    TimeStamp     = SystemTime.Now(),
                    ClassNameNode = @"//table[@class='leagueManager_fixturesTable']"
                },
                new DataSourceFixture()
                {
                    DataSourceDescription = @"Third Division Fixtures - 18/19",
                    Division      = "Division 3",
                    DivisionCode  = "DIV3",
                    Url           = @"http://www.gbwba.org.uk/gbwba/index.cfm/the-league/?v=lf&LeagueId=150",
                    UrlHash       = encrypter.Encrypt(@"http://www.gbwba.org.uk/gbwba/index.cfm/the-league/?v=lf&LeagueId=150"),
                    TimeStamp     = SystemTime.Now(),
                    ClassNameNode = @"//table[@class='leagueManager_fixturesTable']"
                }
            };

            foreach (var item in dataSources)
            {
                await _wpbService.CreateFixtureDataSourceAsync(item);
            }
        }