Exemplo n.º 1
0
        /// <summary>
        /// Renders the Matrix as HTML.
        /// </summary>
        /// <param name="header1">The header.</param>
        /// <param name="defence">if set to <c>true</c> [defence].</param>
        /// <param name="offence">if set to <c>true</c> [offence].</param>
        /// <param name="persist">if set to <c>true</c> [persist].</param>
        /// <param name="showRank">if set to <c>true</c> [show rank].</param>
        /// <returns></returns>
        public string RenderAsHtml(string header1, bool defence, bool offence, bool persist, bool showRank)
        {
            //  load table
            _dt.Clear();
            if (offence)
            {
                LoadWeeks(KUnitNamePassingOffence, PoExp);
                //  for debug show multiplier
                LoadMultiplier("PD multiplier", PoExp);
                LoadMetric("Tdp", PoExp);

                LoadWeeks(KUnitNameRushingOffence, RoExp);
                LoadMultiplier("RD multiplier", RoExp);
                LoadMetric("Tdr", RoExp);

                LoadWeeks(KUnitNamePassProtection, PpExp);
                LoadMultiplier("PR multiplier", PpExp);
                LoadMetric("SAK allowed", PpExp);
            }

            if (defence)
            {
                LoadWeeks(KUnitNamePassRush, PrExp);
                LoadMultiplier("PP multiplier", PrExp);
                LoadMetric("SAK", PrExp);

                LoadWeeks(KUnitNameRushingDefence, RdExp);
                LoadMultiplier("RO multiplier", RdExp);
                LoadMetric("Tdr", RdExp);

                LoadWeeks(KUnitNamePassingDefence, PdExp);
                LoadMultiplier("PO multiplier", PdExp);
                LoadMetric("Tdp", PdExp);
            }

            if (defence && offence)
            {
                TotalLine();
            }

            St = new SimpleTableReport("Unit Matrix " + Team.TeamCode, "")
            {
                ColumnHeadings = true
            };

            St.AddColumn(new ReportColumn(header1, "UnitName", "{0}"));
            St.AddColumn(new ReportColumn("01<br>" + _opponent[0], "Week01", "{0:#0.0}"));
            St.AddColumn(new ReportColumn("02<br>" + _opponent[1], "Week02", "{0:#0.0}"));
            St.AddColumn(new ReportColumn("03<br>" + _opponent[2], "Week03", "{0:#0.0}"));
            St.AddColumn(new ReportColumn("04<br>" + _opponent[3], "Week04", "{0:#0.0}"));
            St.AddColumn(new ReportColumn("05<br>" + _opponent[4], "Week05", "{0:#0.0}"));
            St.AddColumn(new ReportColumn("06<br>" + _opponent[5], "Week06", "{0:#0.0}"));
            St.AddColumn(new ReportColumn("07<br>" + _opponent[6], "Week07", "{0:#0.0}"));
            St.AddColumn(new ReportColumn("08<br>" + _opponent[7], "Week08", "{0:#0.0}"));
            St.AddColumn(new ReportColumn("09<br>" + _opponent[8], "Week09", "{0:#0.0}"));
            St.AddColumn(new ReportColumn("10<br>" + _opponent[9], "Week10", "{0:#0.0}"));
            St.AddColumn(new ReportColumn("11<br>" + _opponent[10], "Week11", "{0:#0.0}"));
            St.AddColumn(new ReportColumn("12<br>" + _opponent[11], "Week12", "{0:#0.0}"));
            St.AddColumn(new ReportColumn("13<br>" + _opponent[12], "Week13", "{0:#0.0}"));
            St.AddColumn(new ReportColumn("14<br>" + _opponent[13], "Week14", "{0:#0.0}"));
            St.AddColumn(new ReportColumn("15<br>" + _opponent[14], "Week15", "{0:#0.0}"));
            St.AddColumn(new ReportColumn("16<br>" + _opponent[15], "Week16", "{0:#0.0}"));
            St.AddColumn(new ReportColumn("17<br>" + _opponent[16], "Week17", "{0:#0.0}"));
            St.AddColumn(new ReportColumn("18<br>" + _opponent[16], "Week18", "{0:#0.0}"));
            St.AddColumn(new ReportColumn("19<br>" + _opponent[16], "Week18", "{0:#0.0}"));
            St.AddColumn(new ReportColumn("20<br>" + _opponent[16], "Week18", "{0:#0.0}"));
            St.AddColumn(new ReportColumn("21<br>" + _opponent[16], "Week18", "{0:#0.0}"));
            St.AddColumn(new ReportColumn("Tot", "TOTAL", "{0:#0.0}"));
            if (showRank)
            {
                St.AddColumn(new ReportColumn("Rank", "RANK", "{0}"));
            }

            St.LoadBody(_dt);
            St.DoRowNumbers    = false;
            St.ShowElapsedTime = false;
            if (persist)
            {
                St.RenderAsHtml(
                    string.Format("{0}Experience Points\\unitMatrix\\Unit_{1}.htm",
                                  Utility.OutputDirectory(), Team.TeamCode), true);
            }

            return(St.BodyOut());
        }