Beispiel #1
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);
        }
        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, 
         [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);
        }