private decimal TallyPts( List <NFLPlayer> playerList, NFLWeek week, string teamCode) { var pts = 0.0M; var scorer = new YahooXmlScorer(week); var breakDownKey = $"{teamCode}-{PositionAbbr}-{week.Week}"; foreach (var p in playerList) { if (PositionDelegate(p)) { var plyrPts = scorer.RatePlayer(p, week); if (plyrPts != 0) { PlayerBreakdowns.AddLine( breakDownKey, line: $"{p.PlayerName,-20} {plyrPts.ToString(),5}"); } pts += plyrPts; } } PlayerBreakdowns.Dump( breakDownKey, $"{RootFolder}\\breakdowns\\{breakDownKey}.htm"); return(pts); }
private FptsAllowed CalculateFptsAllowed( NflTeam team, string theWeek, DataSet gameDs) { // Process Stats and Scores for the week // save the calculations var ftpsAllowed = new FptsAllowed(team.TeamCode); var game = new NFLGame(gameDs.Tables[0].Rows[0]); List <NFLPlayer> playerList = new List <NFLPlayer>(); if (game.IsAway(team.TeamCode)) { playerList = game.LoadAllFantasyHomePlayers( (DateTime?)game.GameDate, String.Empty); } else { playerList = game.LoadAllFantasyAwayPlayers( ( DateTime? )game.GameDate, String.Empty); } var week = new NFLWeek(Season, theWeek); var scorer = new YahooXmlScorer(week); foreach (var p in playerList) { var plyrPts = scorer.RatePlayer(p, week); if (p.IsQuarterback()) { ftpsAllowed.ToQbs += plyrPts; AddBreakdownLine(team, theWeek, p, plyrPts, "QB"); } else if (p.IsRb()) { ftpsAllowed.ToRbs += plyrPts; AddBreakdownLine(team, theWeek, p, plyrPts, "RB"); } else if (p.IsWideout()) { ftpsAllowed.ToWrs += plyrPts; AddBreakdownLine(team, theWeek, p, plyrPts, "WR"); } else if (p.IsTe()) { ftpsAllowed.ToTes += plyrPts; AddBreakdownLine(team, theWeek, p, plyrPts, "TE"); } else if (p.IsKicker()) { ftpsAllowed.ToPks += plyrPts; AddBreakdownLine(team, theWeek, p, plyrPts, "PK"); } } return(ftpsAllowed); }