Пример #1
0
        public List <int> GetPositions()
        {
            List <int> pos = new List <int>(Runners.Count);

            Runners.Sort(new TimeDisplacementComparer());

            for (int i = 0; i < Runners.Count; i++)
            {
                pos.Add(Runners[i].Id);
            }

            return(pos);
        }
Пример #2
0
        public void LoadCarries(string season, string week)
        {
            var totRushes = 0;

            foreach (var runner in Runners)
            {
                //  remove SH designation
                runner.PlayerPos = runner.PlayerPos.Replace(",SH", "");
                string carries = Utility.TflWs.PlayerStats(
                    Constants.K_STATCODE_RUSHING_CARRIES, season, week, runner.PlayerCode);
                runner.TotStats = new PlayerStats();
                int rushes = 0;
                if (!int.TryParse(carries, out rushes))
                {
                    rushes = 0;
                }

                runner.TotStats.Rushes = rushes;
                totRushes += rushes;
            }
            if (totRushes > 0)             //  not bye wk
            {
                var compareByCarries = new Comparison <NFLPlayer>(CompareTeamsByCarries);
                Runners.Sort(compareByCarries);
                //  look for SH back
                var sh = GetShortYardageBack(season, week, TeamCode);
                foreach (var runner in Runners)
                {
                    if (runner.PlayerCode.Equals(sh))
                    {
                        runner.PlayerPos += ",SH";
                    }
                }
                DumpUnitByCarries(totRushes);

                foreach (var runner in Runners)
                {
                    Utility.TflWs.StorePlayerRoleAndPos(runner.PlayerRole, runner.PlayerPos, runner.PlayerCode);
                }
            }
            else
            {
                Utility.Announce(string.Format("{0}:{1} is a bye week for {2}", season, week, TeamCode));
            }
        }
Пример #3
0
        public List <string> LoadCarries(string season, string week)
        {
            var output     = new List <string>();
            var totRushes  = 0;
            var totTouches = 0;

            foreach (var runner in Runners)
            {
                //  remove SH designation
                runner.PlayerPos = runner.PlayerPos.Replace(",SH", "");

                var carries = Utility.TflWs.PlayerStats(
                    Constants.K_STATCODE_RUSHING_CARRIES, season, week, runner.PlayerCode);

                runner.TotStats = new PlayerStats();
                if (!int.TryParse(carries, out int rushes))
                {
                    rushes = 0;
                }

                var receptions = Utility.TflWs.PlayerStats(
                    Constants.K_STATCODE_PASSES_CAUGHT, season, week, runner.PlayerCode);
                if (!int.TryParse(receptions, out int catches))
                {
                    catches = 0;
                }

                runner.TotStats.Rushes  = rushes;
                runner.TotStats.Touches = rushes + catches;

                totRushes  += rushes;
                totTouches += rushes + catches;
            }
            if (totRushes > 0)               //  not bye wk
            {
                var compareByCarries = new Comparison <NFLPlayer>(CompareTeamsByCarries);
                Runners.Sort(compareByCarries);
                //  look for SH back
                var sh = GetShortYardageBack(season, week, TeamCode);
                foreach (var runner in Runners)
                {
                    if (runner.PlayerCode.Equals(sh))
                    {
                        runner.PlayerPos += ",SH";
                    }
                }
                output = DumpUnitByTouches(totTouches);

                SetSpecialRoles();

                foreach (var runner in Runners)
                {
                    Utility.TflWs.StorePlayerRoleAndPos(runner.PlayerRole, runner.PlayerPos, runner.PlayerCode);
                }
            }
            else
            {
                Announce(string.Format("{0}:{1} is a bye week for {2}", season, week, TeamCode));
            }
            return(output);
        }