Exemplo n.º 1
0
        private string TotalLine(int[] tot)
        {
            var tl = "";

            if (!Totals)
            {
                return("");
            }

            if (Body != null)
            {
                tl = HtmlLib.TableRowOpen();
                if (DoRowNumbers)
                {
                    tl += HtmlLib.TableDataAttr("Totals", "ALIGN='RIGHT' VALIGN='TOP'");
                }

                for (int i = 0; i < _columns.Count; i++)
                {
                    var col = ( ReportColumn )_columns[i];
                    if (col.CanAccumulate)
                    {
                        var dc    = Body.Columns[col.Source];
                        var sData = FormatData(dc, col.Format, tot[i].ToString(CultureInfo.InvariantCulture));
                        tl       += HtmlLib.TableDataAttr(sData, AttrFor(dc, (ReportColumn.ColourDelegate)null, ""));
                        LastTotal = tot[i];
                    }
                    else if (col.ColumnTotalDelegate != null)
                    {
                        string output = col.ColumnTotalDelegate();
                        tl += HtmlLib.TableDataAttr(output, "ALIGN='CENTER' VALIGN='TOP'");
                    }
                    else
                    {
                        tl += HtmlLib.TableData(HtmlLib.HtmlPad("", 1));
                    }
                }
                tl += HtmlLib.TableRowClose();
            }
            return(tl);
        }
Exemplo n.º 2
0
        private string AverageLine(int[] tot, int rowCount)
        {
            var tl = "";

            if (!Totals)
            {
                return("");
            }

            if (Body != null)
            {
                tl = HtmlLib.TableRowOpen();
                if (DoRowNumbers)
                {
                    tl += HtmlLib.TableDataAttr("Averages", "ALIGN='RIGHT' VALIGN='TOP'");
                }

                for (int i = 0; i < _columns.Count; i++)
                {
                    var col = ( ReportColumn )_columns[i];
                    if (col.CanAccumulate)
                    {
                        var dc    = Body.Columns[col.Source];
                        var sData = FormatData(dc, "{0:0.0}", string.Format("{0:0.0}", (( decimal )tot[i] / ( decimal )rowCount)));
                        tl       += HtmlLib.TableDataAttr(sData, AttrFor(dc, (ReportColumn.ColourDelegate)null, ""));
                        LastTotal = tot[i];
                    }
                    else if (col.ColumnTotalDelegate != null)
                    {
                        string output = col.ColumnTotalDelegate();
                        tl += HtmlLib.TableDataAttr(output, "ALIGN='CENTER' VALIGN='TOP'");
                    }
                    else
                    {
                        tl += HtmlLib.TableData(HtmlLib.HtmlPad("", 1));
                    }
                }
                tl += HtmlLib.TableRowClose();
            }
            return(tl);
        }
Exemplo n.º 3
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);
        }