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 }
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 }
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 Load() { var tc = new TeamCheckList(); PlayerList = new ArrayList(); var ds = Utility.TflWs.GetPlayers(CatCode, Position); var dt = ds.Tables[0]; #if DEBUG2 Utility.Announce($"{dt.Rows.Count} candidate players"); #endif foreach (DataRow dr in dt.Rows) { if (dr.RowState == DataRowState.Deleted) { continue; } var p = new NFLPlayer(dr, FantasyLeague); var bAdd = true; if (FreeAgentsOnly) { if (!string.IsNullOrEmpty(FantasyLeague)) // lookup owner { if (p.Owner.Equals("**")) { #if DEBUG2 Utility.Announce($@" Player {p.PlayerNameShort,-15} owned by { p.Owner } playoffs {(p.IsPlayoffBound() ? "Yes" : "No ")} starter { (p.IsStarter() ? "Yes" : "No ") }active {(p.IsActive() ? "Yes" : "No ")}" ); #endif } else { bAdd = false; } } } if (FantasyLeague == Constants.K_LEAGUE_Gridstats_NFL1) { bAdd = (bAdd) && p.IsPlayoffBound(); } bAdd = (bAdd) && p.IsActive(); if (StartersOnly) { bAdd = (bAdd) && p.IsStarter(); } if (bAdd) { #if DEBUG2 Utility.Announce($" Adding Player {p.PlayerNameShort,-15}"); #endif PlayerList.Add(p); if (Position != "WR") { tc.TickOff(p.TeamCode, Position); // there r 2 WRs } } } if (WeeksToGoBack == 0) { WeeksToGoBack = Constants.K_WEEKS_IN_A_SEASON; // default } #if DEBUG2 Utility.Announce($"PlayerLister.init {PlayerList.Count} {Position} players added to the list"); Utility.Announce($"Teams missing {Position} are {tc.TeamsLeft()}"); #endif }
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); }
/// <summary> /// Adds the player to the teams roster and increments counts. /// Only if it is a valid code (not blank) /// Also tallies the points by NFL team /// </summary> /// <param name="playerId">The player id.</param> private void AddPlayer(string playerId) { if (playerId.Trim().Length > 0) { var p = new NFLPlayer(playerId); _playerList.Add(p); if (p.IsPlayoffBound()) { if (p.PlayerRole == "S") { PlayoffStarters++; } else { if (p.PlayerRole == "B") { PlayoffBackups++; } else { if (p.PlayerRole == "I") { PlayoffInjuries++; } else { PlayoffOthers++; } } } } else { if (p.PlayerRole == "S") { Starters++; } else { if (p.PlayerRole == "B") { Backups++; } else { if (p.PlayerRole == "I") { Injuries++; } else { Others++; } } } } // keep track of team bias in a hashtable AddTeam(p.TeamCode, PointsFor(p.PlayerRole, p.IsPlayoffBound())); } }
public void Load() { var tc = new TeamCheckList(); PlayerList = new ArrayList(); var ds = Utility.TflWs.GetPlayers(CatCode, Position); var dt = ds.Tables[0]; #if DEBUG Utility.Announce(string.Format("{0} candidate players", dt.Rows.Count)); #endif foreach (DataRow dr in dt.Rows) { if (dr.RowState == DataRowState.Deleted) continue; var p = new NFLPlayer(dr, FantasyLeague); var bAdd = true; if (FreeAgentsOnly) { if (!string.IsNullOrEmpty(FantasyLeague)) // lookup owner { if (p.Owner.Equals("**")) { #if DEBUG Utility.Announce(string.Format(" Player {0,-15} owned by {1} playoffs {2} starter {3} active {4}", p.PlayerNameShort, p.Owner, (p.IsPlayoffBound() ? "Yes" : "No "), (p.IsStarter() ? "Yes" : "No "), (p.IsActive() ? "Yes" : "No "))); #endif } else bAdd = false; } } if (FantasyLeague == Constants.K_LEAGUE_Gridstats_NFL1) bAdd = (bAdd) && p.IsPlayoffBound(); bAdd = (bAdd) && p.IsActive(); if (StartersOnly) bAdd = (bAdd) && p.IsStarter(); if (bAdd) { #if DEBUG Utility.Announce(string.Format(" Adding Player {0,-15}", p.PlayerNameShort)); #endif PlayerList.Add(p); if (Position != "WR") tc.TickOff(p.TeamCode, Position); // there r 2 WRs } } if ( WeeksToGoBack == 0 ) WeeksToGoBack = Constants.K_WEEKS_IN_A_SEASON; // default #if DEBUG Utility.Announce(string.Format("PlayerLister.init {0} {1} players added to the list", PlayerList.Count, Position)); Utility.Announce(string.Format("Teams missing {1} are {0}", tc.TeamsLeft(), Position)); #endif }
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); }
/// <summary> /// Adds the player to the teams roster and increments counts. /// Only if it is a valid code (not blank) /// Also tallies the points by NFL team /// </summary> /// <param name="playerId">The player id.</param> private void AddPlayer( string playerId ) { if ( playerId.Trim().Length > 0 ) { var p = new NFLPlayer( playerId ); _playerList.Add( p ); if ( p.IsPlayoffBound() ) { if ( p.PlayerRole == "S" ) PlayoffStarters++; else { if ( p.PlayerRole == "B" ) PlayoffBackups++; else { if ( p.PlayerRole == "I" ) PlayoffInjuries++; else PlayoffOthers++; } } } else { if ( p.PlayerRole == "S" ) Starters++; else { if ( p.PlayerRole == "B" ) Backups++; else { if ( p.PlayerRole == "I" ) Injuries++; else Others++; } } } // keep track of team bias in a hashtable AddTeam( p.TeamCode, PointsFor( p.PlayerRole, p.IsPlayoffBound() ) ); } }