Exemple #1
0
        /// <summary>
        /// Renders the object as a simple HTML report.
        /// </summary>
        public override void RenderAsHtml()
        {
            Name = "Strength of Schedule";
            var ds = Utility.TflWs.TeamsDs(Season);
            var dt = ds.Tables["Team"];

            _teamList = new ArrayList();
            foreach (DataRow dr in dt.Rows)
            {
                var t = new NflTeam(dr["TEAMID"].ToString(), Season,
                                    Int32.Parse(dr["WINS"].ToString()),
                                    dr["TEAMNAME"].ToString());
                t.StrengthOfSchedule();
                _teamList.Add(t);
            }
            var str = new SimpleTableReport(Name)
            {
                ColumnHeadings = true, DoRowNumbers = true
            };

            str.AddColumn(new ReportColumn("Team", KFieldTeam, "{0,-20}"));
            str.AddColumn(new ReportColumn("SoS", KFieldSos, "{0}"));
            str.AddColumn(new ReportColumn("Exp W", KFieldExpWins, "{0}"));
            str.AddColumn(new ReportColumn("Exp L", KFieldExpLosses, "{0}"));
            str.AddColumn(new ReportColumn("Prev W", KFieldWins, "{0}"));
            str.AddColumn(new ReportColumn("Prev L", KFieldLosses, "{0}"));
            str.AddColumn(new ReportColumn("Var", KFieldVariance, "{0}"));
            str.LoadBody(BuildTable());
            str.RenderAsHtml(OutputFilename(), true);
        }
        public StrengthOfSchedule(string season)
        {
            //  Part 1 - Get the Teams for the season
            _season = season;
            var ds = Utility.TflWs.TeamsDs(season);
            var dt = ds.Tables["Team"];

            _teamList = new ArrayList();
            //  Part 2 - Iterate through the teams
            foreach (DataRow dr in dt.Rows)
            {
                var t = new NflTeam(dr["TEAMID"].ToString(), season,
                                    Int32.Parse(dr["WINS"].ToString()),
                                    dr["TEAMNAME"].ToString());
                t.StrengthOfSchedule();
                _teamList.Add(t);
                //break;  //  Only need one team to start with
            }
        }