示例#1
0
        public decimal InjuryRatio()
        {
            int players  = 0;
            int injuries = 0;

            IDictionaryEnumerator myEnumerator = TheHt.GetEnumerator();

            while (myEnumerator.MoveNext())
            {
                NFLPlayer p = (NFLPlayer)myEnumerator.Value;
                if (p.IsActive())
                {
                    players++;
                }
                if (p.IsInjured())
                {
                    injuries++;
                }
            }

            decimal ratio = Ratio(injuries, players);

            RosterLib.Utility.Announce(string.Format("Injury Ratio:- Injuries {0} players {1} Ratio {2:###.#}%",
                                                     injuries, players, ratio * 100.0M));
            return(ratio);
        }
示例#2
0
        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
        }
示例#3
0
        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
        }
示例#4
0
        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
        }
示例#5
0
        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
        }
示例#6
0
        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);
        }
示例#7
0
        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);
        }
示例#8
0
        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
        }
示例#9
0
        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);
        }