Ejemplo n.º 1
0
        public override decimal GetStat(NFLWeek week)
        {
            decimal stat = 0.0M;
            //  important stat is sacks made
            //  determine which game
            NFLGame game = week.GameFor(Team.TeamCode);

            if (game != null)
            {
                //  get sacks
                stat = Utility.TflWs.GetTotStats(Team.TeamCode, RosterLib.Constants.K_QUARTERBACK_SACKS, week.Season, week.ZeroWeek(), game.GameCode);
            }
            else
            {
                stat = -1.0M;
            }
            return(stat);
        }
Ejemplo n.º 2
0
        public override decimal GetStat(NFLWeek week)
        {
            int stat = 0;

            //  important stat is Tdp

            //  determine which game
            NFLGame game = week.GameFor(Team.TeamCode);

            if (game != null)
            {
                //  get Tdp
                stat = Utility.TflWs.GetTotTeamScoresFor(RosterLib.Constants.K_SCORE_TD_PASS, Team.TeamCode, week.Season, week.ZeroWeek(), game.GameCode);
            }
            else
            {
                stat = -1;
            }
            return(stat);
        }
Ejemplo n.º 3
0
        public override decimal GetStat(NFLWeek week)
        {
            int stat = 0;

            //  important stat is FG

            //  determine which game
            NFLGame game = week.GameFor(Team.TeamCode);

            if (game != null)
            {
                //  get FG allowed
                NflTeam opp = game.OpponentTeam(Team.TeamCode);
                stat = Utility.TflWs.GetTotTeamScoresFor(RosterLib.Constants.K_SCORE_FIELD_GOAL, opp.TeamCode, week.Season, week.ZeroWeek(), game.GameCode);
            }
            else
            {
                stat = -1;
            }
            return(stat);
        }
        public DataSet LoadData(ArrayList plyrList, NFLWeek startWeek)
        {
            var ds   = new DataSet();
            var dt   = new DataTable();
            var cols = dt.Columns;

            cols.Add("Name", typeof(String));
            cols.Add("Currteam", typeof(String));
            cols.Add("ROLE", typeof(String));
            cols.Add("FT", typeof(String));
            cols.Add("tot", typeof(Int32));

            var currentWeek = new NFLWeek(Int32.Parse(Utility.CurrentSeason()), Int32.Parse(Utility.CurrentWeek()), false);

            for (var w = Constants.K_WEEKS_IN_A_SEASON; w > 0; w--)
            {
                var fieldName = string.Format(FieldFormat, currentWeek.WeekNo);
                cols.Add(fieldName, typeof(String));
                currentWeek = currentWeek.PreviousWeek(currentWeek, false, false);
            }
            foreach (NFLPlayer p in plyrList)
            {
                decimal nTot = 0;
                var     dr   = dt.NewRow();
                dr["Name"]     = p.PlayerName;
                dr["CurrTeam"] = p.TeamCode;
                dr["ROLE"]     = p.PlayerRole;
                dr["FT"]       = p.Owner;

                var weekCounter = Constants.K_WEEKS_IN_A_SEASON;
//				var scoreWeek = startWeek;
                var scoreWeek = new NFLWeek(startWeek.Season, Constants.K_WEEKS_IN_REGULAR_SEASON);
                do
                {
                    var game   = scoreWeek.GameFor(p.TeamCode);
                    var cOp    = game == null ? string.Empty : game.OpponentOut(p.TeamCode);
                    var nScore = 0M;
                    if (game != null)
                    {
                        if (game.Played())
                        {
                            nScore = _scorer.RatePlayer(p, scoreWeek);
                            nTot  += nScore;
                        }
                    }
                    dr[string.Format(FieldFormat, scoreWeek.WeekNo)] = string.Format("{0:#}:{1}", nScore, cOp);

                    scoreWeek = scoreWeek.PreviousWeek(scoreWeek, false, false);

                    if (CurrentSeasonOnly)
                    {
                        if (scoreWeek.Season != Utility.CurrentSeason())
                        {
                            weekCounter = 0;
                        }
                    }

                    weekCounter--;
                } while (weekCounter > 0);

                dr["tot"] = nTot;
                dt.Rows.Add(dr);
            }
            ds.Tables.Add(dt);
            return(ds);
        }