private void detach_PLAYER_YEARLY_PITCHINGs(PLAYER_YEARLY_PITCHING entity) { this.SendPropertyChanging(); entity.TEAM1 = null; }
partial void DeletePLAYER_YEARLY_PITCHING(PLAYER_YEARLY_PITCHING instance);
partial void UpdatePLAYER_YEARLY_PITCHING(PLAYER_YEARLY_PITCHING instance);
partial void InsertPLAYER_YEARLY_PITCHING(PLAYER_YEARLY_PITCHING instance);
private void attach_PLAYER_YEARLY_PITCHINGs(PLAYER_YEARLY_PITCHING entity) { this.SendPropertyChanging(); entity.PLAYER1 = this; }
private void LoadPlayerStats(PLAYER Player) { parser.OpenPage(string.Format(PLAYERSTATS_URL, Player.MlbComId)); foreach (Table table in parser.CurrentPage.Tables) { if (table.Rows[0].Text.Length >= 8) { if (table.Rows[0].Text.Substring(0, 8).ToLower() == "pitching") { foreach (TableRow row in table.Rows) { int year; if (int.TryParse(row.Cells[0].Text, out year)) { TEAM team = GetTeam(row.Cells[1].Text); PLAYER_YEARLY_PITCHING pitching = (from p in mlbData.PLAYER_YEARLY_PITCHINGs where p.Player == Player.PLAYER_ID && p.Year == year && p.Team == team.TEAM_ID select p).SingleOrDefault(); if (pitching == null) { //add new pitching = new PLAYER_YEARLY_PITCHING(); pitching.Player = Player.PLAYER_ID; pitching.Year = year; pitching.Team = team.TEAM_ID; mlbData.PLAYER_YEARLY_PITCHINGs.InsertOnSubmit(pitching); } pitching.W = ParseInt(row.Cells[2].Text); pitching.L = ParseInt(row.Cells[3].Text); pitching.G = ParseInt(row.Cells[5].Text); pitching.GS = ParseInt(row.Cells[6].Text); pitching.CG = ParseInt(row.Cells[7].Text); pitching.SHO = ParseInt(row.Cells[8].Text); pitching.SV = ParseInt(row.Cells[9].Text); pitching.SVO = ParseInt(row.Cells[10].Text); string[] innings = row.Cells[11].Text.Split('.'); pitching.OUTS = (ParseInt(innings[0]) * 3) + ParseInt(innings[1]); pitching.H = ParseInt(row.Cells[12].Text); pitching.R = ParseInt(row.Cells[13].Text); pitching.ER = ParseInt(row.Cells[14].Text); pitching.HR = ParseInt(row.Cells[15].Text); pitching.HBP = ParseInt(row.Cells[16].Text); pitching.BB = ParseInt(row.Cells[17].Text); pitching.SO = ParseInt(row.Cells[18].Text); } } } else if (table.Rows[0].Text.Substring(0, 7).ToLower() == "hitting") { foreach (TableRow row in table.Rows) { int year; if (int.TryParse(row.Cells[0].Text, out year)) { TEAM team = GetTeam(row.Cells[1].Text); PLAYER_YEARLY_BATTING batting = (from b in mlbData.PLAYER_YEARLY_BATTINGs where b.Player == Player.PLAYER_ID && b.Year == year && b.Team == team.TEAM_ID select b).SingleOrDefault(); if (batting == null) { //add new batting = new PLAYER_YEARLY_BATTING(); batting.Player = Player.PLAYER_ID; batting.Year = year; batting.Team = team.TEAM_ID; mlbData.PLAYER_YEARLY_BATTINGs.InsertOnSubmit(batting); } batting.G = ParseInt(row.Cells[2].Text); batting.AB = ParseInt(row.Cells[3].Text); batting.R = ParseInt(row.Cells[4].Text); batting.H = ParseInt(row.Cells[5].Text); batting._2B = ParseInt(row.Cells[6].Text); batting._3B = ParseInt(row.Cells[7].Text); batting.HR = ParseInt(row.Cells[8].Text); batting.RBI = ParseInt(row.Cells[9].Text); batting.BB = ParseInt(row.Cells[11].Text); batting.SO = ParseInt(row.Cells[12].Text); batting.SB = ParseInt(row.Cells[13].Text); batting.CS = ParseInt(row.Cells[14].Text); } } } } } }