public PlayerLister() { PrimariesOnly = true; ActivesOnly = true; FreeAgentsOnly = false; Tc = new TeamCheckList(); PlayerList = new ArrayList(); WeeksToGoBack = Constants.K_WEEKS_IN_A_SEASON; // default }
public PlayerLister() { PrimariesOnly = true; ActivesOnly = true; FreeAgentsOnly = false; Tc = new TeamCheckList(); PlayerList = new ArrayList(); //Collect(catCode, sPos, fantasyLeague, startersOnly, tc); 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 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 }