Ejemplo n.º 1
0
        public string RenderAsHtml()
        {
            var    s = HtmlLib.TableRowOpen();
            string sOpp;

            //  three rows
            s += HtmlLib.TableData(_team.TeamUrl()) + HtmlLib.TableData("");
            for (var i = 1; i < 18; i++)
            {
                s += HtmlLib.TableDataAttr(HtmlLib.Font("ARIAL", i.ToString(), "-2"),
                                           "ALIGN='CENTER' BGCOLOR='MOCCASIN'"); //  week number row
            }
            s += HtmlLib.TableRowClose();

            //  Row 2  Schedule this year
            s += HtmlLib.TableRowOpen() +
                 HtmlLib.TableDataAttr(Label1Out(), Colour1Out() + " ALIGN='CENTER'");
            s += HtmlLib.TableData(_metricName);
            for (var j = 0; j < Constants.K_WEEKS_IN_REGULAR_SEASON; j++)
            {
                if ((_opps[j].Opponent == "BYE") || (_opps[j].Opponent.Trim().Length == 0))
                {
                    sOpp = _opps[j].Opponent;
                }
                else
                {
                    sOpp = (_opps[j].IsHome() ? "v" : "@") + TeamUrl(_opps[j].Opponent);
                }
                s += HtmlLib.TableDataAttr(sOpp, "ALIGN='CENTER'" + OpponentColour(_opps[j].Opponent));
            }
            s += HtmlLib.TableRowClose();

            if (AddBlankRow)
            {
                s += HtmlLib.TableRowOpen() + HtmlLib.TableDataAttr(HtmlLib.HtmlPad("", 2), "ALIGN='CENTER'");
                s += HtmlLib.TableDataAttr(HtmlLib.HtmlPad("", 2), "ALIGN='RIGHT' BGCOLOR='WHITE'");

                for (var k = 0; k < Constants.K_WEEKS_IN_REGULAR_SEASON; k++)
                {
                    s += HtmlLib.TableDataAttr(HtmlLib.HtmlPad("", 2), string.Format("ALIGN='CENTER' BGCOLOR='{0}'", "WHITE"));
                }
                s += HtmlLib.TableRowClose();
            }
            //  Row 3 Total  (W-L) tot spread
            s += HtmlLib.TableRowOpen() +
                 HtmlLib.TableDataAttr(Stats1Out(), "ALIGN='CENTER'");
            s += HtmlLib.TableDataAttr(
                HtmlLib.Bold(_total.ToString()),
                string.Format("ALIGN='RIGHT' BGCOLOR='{0}'", TotalColour()));

            for (var k = 0; k < Constants.K_WEEKS_IN_REGULAR_SEASON; k++)
            {
                var mBit = LinkedCellContent(_opps[k], k, _team.TeamCode);
                s += mBit;
            }
            if (_metricName == "Spread")
            {
                //  Additional Row 4 last year's spreads
                s += HtmlLib.TableRowOpen() + HtmlLib.TableDataAttr(Stats2Out(), "ALIGN='CENTER'");
                s += HtmlLib.TableData("prev");
                for (var l = 0; l < Constants.K_WEEKS_IN_REGULAR_SEASON; l++)
                {
                    if ((_prevOpp[l].Opponent == "BYE") || (_prevOpp[l].Opponent.Length == 0))
                    {
                        sOpp = _prevOpp[l].Opponent;
                    }
                    else
                    {
                        sOpp = (_prevOpp[l].IsHome() ? "v" : "@")
                               + MatchupUrl(l + 1, _team.TeamCode, _prevOpp[l].Opponent, _prevOpp[l].IsHome());
                    }
                    s += HtmlLib.TableDataAttr(sOpp, "ALIGN='CENTER'" +
                                               OpponentColour(_prevOpp[l].Opponent));
                }
                s += HtmlLib.TableRowClose();
                //  Row 5 last years results
                s += HtmlLib.TableRowOpen() + HtmlLib.TableDataAttr(Stats3Out(), "ALIGN='CENTER'");                    // W-L
                s += HtmlLib.TableDataAttr(TotalPrev().ToString(), "ALIGN='RIGHT'");
                for (var m = 0; m < Constants.K_WEEKS_IN_REGULAR_SEASON; m++)
                {
                    var mBit = CellContent(_prevOpp[m]);
                    s += mBit;
                }
                s += HtmlLib.TableRowClose();
            }

            return(s);
        }