private void AddBreakdown(string teamCode, EpMetric ep, NFLGame g) { var scorers = string.Empty; if (ep.OffTDr > 0) { scorers = g.ScorersOff(Constants.K_SCORE_TD_RUN, teamCode); } Breakdowns.AddLine(string.Format("{0}-Tdr", teamCode), string.Format("{0} {1:#0} {2}", g.GameName(), ep.OffTDr, scorers)); if (ep.OffTDp > 0) { scorers = g.ScorersOff(Constants.K_SCORE_TD_PASS, teamCode); } Breakdowns.AddLine(string.Format("{0}-Tdp", teamCode), string.Format("{0} {1:#0} {2}", g.GameName(), ep.OffTDp, scorers)); }
private void LoadTeam( NflTeam team, string teamCode, bool skipPostseason ) { var ep = new EpMetric(); var metricsHt = new Hashtable(); DataSet dg; dg = skipPostseason ? _tflWs.GetAllRegularSeasonGames( teamCode, Season ) : _tflWs.GetAllGames( teamCode, Season ); var games = dg.Tables[ "sched" ]; foreach ( DataRow drg in games.Rows ) { var g = new NFLGame( drg ); //last 2 yrs if (!g.IsRecent()) continue; if (skipPostseason && g.IsPlayoff()) continue; if ( ! g.MetricsCalculated ) g.TallyMetrics(String.Empty); var hashCode = string.Format( "{0}{1}{2}", teamCode, g.Season, g.Week ); if ( g.IsHome( teamCode ) ) { ep.HomeTeam = teamCode; ep.OffTDp = g.HomeTDp; ep.OffTDr = g.HomeTDr; ep.OffSakAllowed = g.HomeSaKa; ep.DefTDp = g.AwayTDp; ep.DefTDr = g.AwayTDr; ep.DefSak = g.AwaySaKa; ep.HomePasses = g.HomePasses; ep.HomeRuns = g.HomeRuns; } else { ep.AwayTeam = g.AwayTeam; ep.OffTDp = g.AwayTDp; ep.OffTDr = g.AwayTDr; ep.OffSakAllowed = g.AwaySaKa; ep.DefTDp = g.HomeTDp; ep.DefTDr = g.HomeTDr; ep.DefSak = g.HomeSaKa; ep.AwayPasses = g.AwayPasses; ep.AwayRuns = g.AwayRuns; } if ( DoBreakdowns ) AddBreakdown( teamCode, ep, g ); if (ep.Total() <= 0) continue; ep.WeekSeed = Utility.WeekSeed( g.Season, g.Week ); if ( ! metricsHt.ContainsKey( hashCode ) ) metricsHt.Add( hashCode, ep ); } team.SetMetrics( metricsHt ); #if DEBUG Utility.PrintIndexAndKeysAndValues( metricsHt ); #endif }
private void LoadTeam(NflTeam team, string teamCode) { var ep = new EpMetric(); var metricsHt = new Hashtable(); var dg = _tflWs.GetAllGames(teamCode, Season); var games = dg.Tables["sched"]; foreach (DataRow drg in games.Rows) { var g = new NFLGame(drg); if (!g.IsRecent()) { continue; } if (!g.MetricsCalculated) { g.TallyMetrics(String.Empty); } var hashCode = string.Format("{0}{1}{2}", teamCode, g.Season, g.Week); if (g.IsHome(teamCode)) { ep.HomeTeam = teamCode; ep.OffTDp = g.HomeTDp; ep.OffTDr = g.HomeTDr; ep.OffSakAllowed = g.HomeSaKa; ep.DefTDp = g.AwayTDp; ep.DefTDr = g.AwayTDr; ep.DefSak = g.AwaySaKa; ep.HomePasses = g.HomePasses; ep.HomeRuns = g.HomeRuns; } else { ep.AwayTeam = g.AwayTeam; ep.OffTDp = g.AwayTDp; ep.OffTDr = g.AwayTDr; ep.OffSakAllowed = g.AwaySaKa; ep.DefTDp = g.HomeTDp; ep.DefTDr = g.HomeTDr; ep.DefSak = g.HomeSaKa; ep.AwayPasses = g.AwayPasses; ep.AwayRuns = g.AwayRuns; } if (DoBreakdowns) { AddBreakdown(teamCode, ep, g); } if (ep.Total() <= 0) { continue; } ep.WeekSeed = Utility.WeekSeed(g.Season, g.Week); if (!metricsHt.ContainsKey(hashCode)) { metricsHt.Add(hashCode, ep); } } team.SetMetrics(metricsHt); #if DEBUG //Utility.PrintIndexAndKeysAndValues( metricsHt ); #endif }
private void AddBreakdown(string teamCode, EpMetric ep, NFLGame g) { var scorers = string.Empty; if ( ep.OffTDr > 0 ) scorers = g.ScorersOff( Constants.K_SCORE_TD_RUN, teamCode ); Breakdowns.AddLine( string.Format( "{0}-Tdr", teamCode ), string.Format("{0} {1:#0} {2}", g.GameName(), ep.OffTDr, scorers )); if ( ep.OffTDp > 0 ) scorers = g.ScorersOff( Constants.K_SCORE_TD_PASS, teamCode ); Breakdowns.AddLine( string.Format( "{0}-Tdp", teamCode ), string.Format( "{0} {1:#0} {2}", g.GameName(), ep.OffTDp, scorers ) ); }