private void AddPickup(NFLPlayer p, NFLGame g) { p.LoadOwner(Constants.K_LEAGUE_Yahoo); if (p.IsFreeAgent() || p.Owner == "77") { var prevPts = p.Points; // so we dont lose Points value var pu = new Pickup { Season = Season, Player = p, Name = $"{p.PlayerNameTo( 20 )} ({p.TeamCode}) {p.PlayerPos,-10}", Opp = $"{g.OpponentOut( p.TeamCode )}", ProjPts = p.Points, CategoryCode = p.PlayerCat, Pos = p.PlayerPos, ActualPts = ActualOutput(g, p) }; p.Points = prevPts; if (p.Owner == "77") { pu.Name = pu.Name.ToUpper(); } PickupSummary.AddPickup(pu); if (PlayerReports) { p.PlayerReport(forceIt: true); } } }
public PlayerLister( string catCode, bool faOnly, [Optional] string fantasyLeague, [Optional] bool startersOnly, [Optional] IKeepTheTime timekeeper ) { if (timekeeper != null) { TimeKeeper = timekeeper; } PrimariesOnly = true; ActivesOnly = true; FreeAgentsOnly = false; StartersOnly = startersOnly; PlayerList = new ArrayList(); Folder = string.Empty; var ds = Utility.TflWs.GetPlayers(catCode); var dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { var p = new NFLPlayer(dr, fantasyLeague); var bAdd = !faOnly || p.IsFreeAgent(); if (ActivesOnly) { bAdd = bAdd && p.IsActive(); } if (StartersOnly) { bAdd = bAdd && p.IsStarter(); } if (PlayoffsOnly) { bAdd = bAdd && p.IsPlayoffBound(); } if (PrimariesOnly) { bAdd = bAdd && !p.IsItalic(); // dont want FB, TE or punters } if (OnesAndTwosOnly) { bAdd = bAdd && p.IsOneOrTwo(); } if (catCode.Equals("2")) // there is a lack of RBs { bAdd = bAdd && p.IsOneOrTwo(); } if (bAdd) { PlayerList.Add(p); } } WeeksToGoBack = Constants.K_WEEKS_IN_A_SEASON; // default }
private static string BoldFreeAgents( NFLPlayer player, string namePart) { if (player.IsFreeAgent()) { namePart = $"**{namePart.Trim()}**"; } return(namePart); }
public PlayerLister(string catCode, bool faOnly, [Optional] string fantasyLeague, [Optional] bool startersOnly ) { PrimariesOnly = true; ActivesOnly = true; FreeAgentsOnly = false; StartersOnly = startersOnly; PlayerList = new ArrayList(); var ds = Utility.TflWs.GetPlayers(catCode); var dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { var p = new NFLPlayer(dr, fantasyLeague); var bAdd = !(faOnly) || p.IsFreeAgent(); if (ActivesOnly) { bAdd = (bAdd) && p.IsActive(); } if (StartersOnly) { bAdd = (bAdd) && p.IsStarter(); } if (PlayoffsOnly) { bAdd = (bAdd) && p.IsPlayoffBound(); } if (PrimariesOnly) { bAdd = (bAdd) && !p.IsItalic(); // dont want FB, TE or punters } if (OnesAndTwosOnly) { bAdd = (bAdd) && p.IsOneOrTwo(); } if (bAdd) { PlayerList.Add(p); } } WeeksToGoBack = Constants.K_WEEKS_IN_A_SEASON; // default }
private string PlayerPointsOut( NFLPlayer player, bool isReport = false) { var pointsOut = $"{ player.Points,2:#0}"; if (pointsOut.Length == 1) { pointsOut = " " + pointsOut; } if (player.Points > PlayerStandard( player.PlayerCat) && player.IsFreeAgent()) { if (!isReport) { pointsOut = $"**{pointsOut.Trim()}**"; } } return(" " + pointsOut + " "); }
private void AddPickupForLeague( NFLPlayer p, NFLGame g, string leagueId, string prefix, string suffix) { p.LoadOwner(leagueId); if (p.IsFreeAgent() || OwnedBySteve(p, leagueId)) { var prevPts = p.Points; // so we dont lose Points value var pu = new Pickup { LeagueId = leagueId, Owner = p.Owner, Season = Season, Player = p, Prefix = prefix, Suffix = suffix, Name = $"{p.PlayerNameTo(20)} ({p.TeamCode}) {p.PlayerPos,-10}", Opp = $"{g.OpponentOut(p.TeamCode)}", ProjPts = p.Points, CategoryCode = p.PlayerCat, Pos = p.PlayerPos, ActualPts = ActualOutput(g, p, null) }; p.Points = prevPts; if (p.Owner == "77") { pu.Name = pu.Name.ToUpper(); } PickupSummary.AddPickup(pu); if (PlayerReports) { p.PlayerReport(forceIt: true); } } }
public PlayerLister(string catCode, bool faOnly, [Optional] string fantasyLeague, [Optional] bool startersOnly, [Optional] IKeepTheTime timekeeper ) { if (timekeeper != null) TimeKeeper = timekeeper; PrimariesOnly = true; ActivesOnly = true; FreeAgentsOnly = false; StartersOnly = startersOnly; PlayerList = new ArrayList(); Folder = string.Empty; var ds = Utility.TflWs.GetPlayers(catCode); var dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { var p = new NFLPlayer(dr, fantasyLeague); var bAdd = !(faOnly) || p.IsFreeAgent(); if (ActivesOnly) bAdd = (bAdd) && p.IsActive(); if (StartersOnly) bAdd = (bAdd) && p.IsStarter(); if (PlayoffsOnly) bAdd = (bAdd) && p.IsPlayoffBound(); if (PrimariesOnly) bAdd = (bAdd) && !p.IsItalic(); // dont want FB, TE or punters if (OnesAndTwosOnly) bAdd = (bAdd) && p.IsOneOrTwo(); if (bAdd) PlayerList.Add(p); } WeeksToGoBack = Constants.K_WEEKS_IN_A_SEASON; // default }
public void Collect( string catCode, string sPos, string fantasyLeague, [Optional] string rookieYr) { DumpParameters(); DataSet ds; if (string.IsNullOrEmpty(sPos)) { ds = Utility.TflWs.GetPlayers(catCode); } else { ds = sPos.Equals("KR") ? Utility.TflWs.GetReturners() : Utility.TflWs.GetPlayers( catCode, sPos, role: OnesAndTwosOnly? null : "*", rookieYr: rookieYr); } var dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { if (dr.RowState == DataRowState.Deleted) { continue; } var p = new NFLPlayer(dr, fantasyLeague); if (p.PlayerName == "Jonathan Taylor") { System.Console.WriteLine("Testplayer"); } var bAdd = true; if (FreeAgentsOnly) { bAdd = p.IsFreeAgent(); } if (PlayoffsOnly) { bAdd = bAdd && p.IsPlayoffBound(); } bAdd = bAdd && p.IsFantasyOffence(); bAdd = bAdd && p.IsActive(); if (StartersOnly) { bAdd = bAdd && p.IsStarter(); if (sPos.Equals("RB")) { bAdd = p.IsOneOrTwo(); } } if (OnesAndTwosOnly) { bAdd = bAdd && p.IsOneOrTwo(); } if (bAdd) { AnnounceAdd( catCode, sPos, p); PlayerList.Add(p); #if DEBUG2 // speed up things if (PlayerList.Count > 2) { break; } #endif if (StartersOnly) { if (sPos != null) { if (sPos != "WR") { Tc.TickOff(p.TeamCode, sPos); // there r 2 WRs } } } } else { AnnounceSkip( catCode, sPos, p); } } AnnounceTotal(sPos); }
public void Collect(string catCode, string sPos, string fantasyLeague) { Clear(); DataSet ds; if (string.IsNullOrEmpty(sPos)) { ds = Utility.TflWs.GetPlayers(catCode); } else { ds = sPos.Equals("KR") ? Utility.TflWs.GetReturners() : Utility.TflWs.GetPlayers(catCode, sPos); } var dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { if (dr.RowState != DataRowState.Deleted) { var p = new NFLPlayer(dr, fantasyLeague); var bAdd = true; if (FreeAgentsOnly) { bAdd = p.IsFreeAgent(); } if (PlayoffsOnly) { bAdd = (bAdd) && p.IsPlayoffBound(); } bAdd = (bAdd) && p.IsFantasyOffence(); bAdd = (bAdd) && p.IsActive(); if (StartersOnly) { bAdd = (bAdd) && p.IsStarter(); } if (OnesAndTwosOnly) { bAdd = (bAdd) && p.IsOneOrTwo(); } if (bAdd) { AnnounceAdd(catCode, sPos, p); PlayerList.Add(p); if (StartersOnly) { if (sPos != null) { if (sPos != "WR") { Tc.TickOff(p.TeamCode, sPos); // there r 2 WRs } } } } } } AnnounceTotal(sPos); }
public void Collect( string catCode, string sPos, string fantasyLeague, [Optional] string rookieYr ) { DumpParameters(); DataSet ds; if (string.IsNullOrEmpty(sPos)) ds = Utility.TflWs.GetPlayers(catCode); else ds = sPos.Equals("KR") ? Utility.TflWs.GetReturners() : Utility.TflWs.GetPlayers( catCode, sPos, role:OnesAndTwosOnly? null : "*", rookieYr:rookieYr); var dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { if (dr.RowState == DataRowState.Deleted) continue; var p = new NFLPlayer(dr, fantasyLeague); var bAdd = true; if (FreeAgentsOnly) bAdd = p.IsFreeAgent(); if (PlayoffsOnly) bAdd = (bAdd) && p.IsPlayoffBound(); bAdd = (bAdd) && p.IsFantasyOffence(); bAdd = (bAdd) && p.IsActive(); if (StartersOnly) bAdd = (bAdd) && p.IsStarter(); if (OnesAndTwosOnly) bAdd = (bAdd) && p.IsOneOrTwo(); if (bAdd) { AnnounceAdd(catCode, sPos, p); PlayerList.Add(p); #if DEBUG2 // speed up things if (PlayerList.Count > 2) break; #endif if (StartersOnly) { if (sPos != null) if (sPos != "WR") Tc.TickOff(p.TeamCode, sPos); // there r 2 WRs } } } AnnounceTotal(sPos); }