Example #1
0
        public void LoadGame(int Season, int Week, int GameId)
        {
            GAME game = (from p in nflData.GAMEs
                         where p.EspnId == GameId
                         select p).SingleOrDefault();

            if (game == null)
            {
                game = new GAME();
                game.EspnId = GameId;
                nflData.GAMEs.InsertOnSubmit(game);
            }

            parser.OpenPage(string.Format(BOXSCORE_URL, GameId));

            string awayTeamAbbr = parser.CurrentPage.Tables[0].Rows[1].Cells[0].Links[0].URL;
            awayTeamAbbr = awayTeamAbbr.Substring(awayTeamAbbr.IndexOf("team=") + 5);

            TEAM awayTeam = (from p in nflData.TEAMs
                             where p.EspnAbbr.Equals(awayTeamAbbr)
                             select p).SingleOrDefault();

            if (awayTeam == null)
            {
                //add team
            }

            int awayTeamScore = int.Parse(parser.CurrentPage.Tables[0].Rows[1].Cells[5].Text);

            string homeTeamAbbr = parser.CurrentPage.Tables[0].Rows[2].Cells[0].Links[0].URL;
            homeTeamAbbr = homeTeamAbbr.Substring(homeTeamAbbr.IndexOf("team=") + 5);

            TEAM homeTeam = (from p in nflData.TEAMs
                             where p.EspnAbbr.Equals(homeTeamAbbr)
                             select p).SingleOrDefault();

            if (homeTeam == null)
            {
                //add team
            }

            int homeTeamScore = int.Parse(parser.CurrentPage.Tables[0].Rows[2].Cells[5].Text);

            game.Season = Season;
            game.Week = Week;
            game.AwayTeam = awayTeam.TEAM_ID;
            game.AwayScore = awayTeamScore;
            game.HomeTeam = homeTeam.TEAM_ID;
            game.HomeScore = homeTeamScore;

            nflData.SubmitChanges();

            LoadGameStats(game, parser.CurrentPage);
        }
Example #2
0
 partial void DeleteGAME(GAME instance);
Example #3
0
 partial void UpdateGAME(GAME instance);
Example #4
0
 partial void InsertGAME(GAME instance);
Example #5
0
		private void detach_GAMEs1(GAME entity)
		{
			this.SendPropertyChanging();
			entity.TEAM1 = null;
		}
Example #6
0
		private void attach_GAMEs1(GAME entity)
		{
			this.SendPropertyChanging();
			entity.TEAM1 = this;
		}
Example #7
0
        private void LoadGameStats(GAME Game, Page GamePage)
        {
            Table statTable = GamePage.Tables[4];
            PLAYER player;
            for (int i = 2; i < statTable.Rows.Count - 1; i++)
            {
                player = GetPlayer(statTable.Rows[i].Cells[0]);
                PLAYER_GAME_PASSING passing = (from p in nflData.PLAYER_GAME_PASSINGs
                                               where p.Game == Game.GAME_ID && p.Player == player.PLAYER_ID && p.Team == Game.AwayTeam
                                               select p).SingleOrDefault();

                if (passing == null)
                {
                    passing = new PLAYER_GAME_PASSING();
                    passing.Game = Game.GAME_ID;
                    passing.Player = player.PLAYER_ID;
                    passing.Team = Game.AwayTeam;
                    nflData.PLAYER_GAME_PASSINGs.InsertOnSubmit(passing);
                }

                passing.Attempts = int.Parse(statTable.Rows[i].Cells[1].Text.Split('/')[0]);
                passing.Completions = int.Parse(statTable.Rows[i].Cells[1].Text.Split('/')[1]);
                passing.Yards = int.Parse(statTable.Rows[i].Cells[2].Text);
                passing.Touchdowns = int.Parse(statTable.Rows[i].Cells[4].Text);
                passing.Interceptions = int.Parse(statTable.Rows[i].Cells[5].Text);
                //set the rest of the stats
            }

            nflData.SubmitChanges();
        }