Ejemplo n.º 1
0
        public string CardOffence()
        {
            //  Force the stats to be tallied
            var theSeason = Utility.CurrentSeason();

            if (Utility.CurrentWeek() == "0")
            {
                theSeason = Utility.LastSeason();
            }
            Team.PpUnit(theSeason);
            Team.PoUnit(theSeason);
            Team.RoUnit(theSeason);

            var innerTable = HtmlLib.TableOpen("class='title' cellpadding='1' cellspacing='1' border='0' width='950'") +
                             "\n\t"

                             + Row1()
                             + Row2()
                             + Row3()

                             + HtmlLib.TableClose() + "\n";

            return(HtmlLib.TableOpen("cellpadding='1' cellspacing='1' border='1' bordercolor='BLUE'") + "\n\t" +
                   HtmlLib.TableRowOpen() + HtmlLib.TableDataAttr(Team.TeamCode, "ALIGN='LEFT'") +
                   HtmlLib.TableDataAttr("OFFENCE", "ALIGN='RIGHT'") + HtmlLib.TableRowClose() +
                   HtmlLib.TableRowOpen() + HtmlLib.TableDataAttr(innerTable, "COLSPAN='2'") + HtmlLib.TableRowClose() +
                   HtmlLib.TableClose());
        }
Ejemplo n.º 2
0
 private static void FreeAgents(ref string s, string homeName, string awayName, NflTeam homeTeam, NflTeam awayTeam)
 {
     //RosterLib.Utility.Announce( "Doing FreeAgents");
     if ((homeTeam == null) || (awayTeam == null))
     {
         Utility.Announce("FreeAgents:one or more teams are null");
     }
     else
     {
         s += "<br>\n";
         //  Table with one row which has 2 columns Away and Home
         s += HtmlLib.TableOpen("BORDER='1' BORDERCOLOR='BLUE'");
         s += HtmlLib.TableRowOpen();
         s += HtmlLib.TableDataAttr("Free Agents/Backups", "COLSPAN='2'");
         s += HtmlLib.TableRowClose();
         s += HtmlLib.TableRowOpen();
         s += HtmlLib.TableDataAttr("Away " + awayName, "WIDTH='400'");
         s += HtmlLib.TableDataAttr("Home " + homeName, "WIDTH='400'");
         s += HtmlLib.TableRowClose();
         s += HtmlLib.TableRowOpen();
         s += HtmlLib.TableDataAttr(awayTeam.FreeAgents(true, true, false), "VALIGN='TOP'");
         s += HtmlLib.TableDataAttr(homeTeam.FreeAgents(true, true, false), "VALIGN='TOP'");
         s += HtmlLib.TableRowClose() + HtmlLib.TableClose() + "<br>\n";
     }
     //RosterLib.Utility.Announce( "Finished FreeAgents");
 }
Ejemplo n.º 3
0
        private string DRow2()
        {
            string htm;

            if (Team.Uses34Defence)
            {
                htm = HtmlLib.TableRowOpen()
                      +
                      SpitUnit("RD", Team.RdRating(),
                               string.Format("Rushing allowed {0} ({1})", Team.TotYdrAllowed, Team.TotTDrAllowed))
                      + BlankCol()
                      + SpitPlayer("ROLB", 1, true) + BlankCol() + SpitPlayer("RILB", 1, true) + BlankCol() + BlankCol()
                      + SpitPlayer("LILB", 1, true) + BlankCol() + BlankCol() + SpitPlayer("LOLB", 1, true)
                      + HtmlLib.TableRowClose() + "\n";
            }
            else
            {
                htm = HtmlLib.TableRowOpen()
                      +
                      SpitUnit("RD", Team.RdRating(),
                               string.Format("Rushing allowed {0} ({1})", Team.TotYdrAllowed, Team.TotTDrAllowed))
                      + BlankCol() + BlankCol()
                      + SpitPlayer("RLB", 1, true) + BlankCol() + SpitPlayer("MLB", 1, true) + BlankCol()
                      + SpitPlayer("LLB", 1, true) + BlankCol() + BlankCol() + BlankCol()
                      + HtmlLib.TableRowClose() + "\n";
            }
            return(htm);
        }
Ejemplo n.º 4
0
 private static void Injuries(ref string s, NflTeam offensiveTeam, NflTeam defensiveTeam,
                              string offName, string defName)
 {
     if ((offensiveTeam == null) || (defensiveTeam == null))
     {
         Utility.Announce("Injuries:one or more teams are null");
     }
     else
     {
         s += "<br>\n";
         //  Table with one row which has 2 columns
         s += HtmlLib.TableOpen("BORDER='1' BORDERCOLOR='BLUE'");
         s += HtmlLib.TableRowOpen();
         s += HtmlLib.TableDataAttr("Injuries", "COLSPAN='2'");
         s += HtmlLib.TableRowClose();
         s += HtmlLib.TableRowOpen();
         s += HtmlLib.TableDataAttr("Offence " + offName, "WIDTH='400'");
         s += HtmlLib.TableDataAttr("Defence " + defName, "WIDTH='400'");
         s += HtmlLib.TableRowClose();
         s += HtmlLib.TableRowOpen();
         s += HtmlLib.TableDataAttr(offensiveTeam.InjuredList(true), "VALIGN='TOP'");
         s += HtmlLib.TableDataAttr(defensiveTeam.InjuredList(false), "VALIGN='TOP'");
         s += HtmlLib.TableRowClose() + HtmlLib.TableClose() + "<br>\n";
     }
 }
Ejemplo n.º 5
0
 private string Row1()
 {
     return(HtmlLib.TableRowOpen() +
            SpitPlayer("WR", 1, false) + BlankCol() + BlankCol()
            + SpitPlayer("LT", 1, false) + SpitPlayer("LG", 1, false) + SpitPlayer("C", 1, false) +
            SpitPlayer("RG", 1, false) + SpitPlayer("RT", 1, false)
            + SpitPlayer("TE", 1, false) + BlankCol() + SpitPlayer("WR", 2, false)
            + HtmlLib.TableRowClose() + "\n");
 }
Ejemplo n.º 6
0
        private static string FooterRow(string label, string fmt, string msg)
        {
            string row =
                HtmlLib.TableRowOpen() + HtmlLib.TableData(label) +
                HtmlLib.TableData(string.Format(fmt, msg))
                + HtmlLib.TableRowClose();

            return(row);
        }
Ejemplo n.º 7
0
        private static string FooterRow(string label, string fmt, double amt)
        {
            string row =
                HtmlLib.TableRowOpen() + HtmlLib.TableData(label) +
                HtmlLib.TableDataAttr(string.Format(fmt, amt), "ALIGN='RIGHT'")
                + HtmlLib.TableRowClose();

            return(row);
        }
Ejemplo n.º 8
0
 private string Row3()
 {
     return(HtmlLib.TableRowOpen() +
            SpitPlayer("PK", 1, false) + BlankCol() + BlankCol() + BlankCol() + SpitPlayer("FB", 1, false) + BlankCol()
            + SpitPlayer("RB", 1, false) + BlankCol()
            + SpitUnit("RO", Team.RoRating(), string.Format("Team rushing {0} ({1})", Team.TotYdr, Team.TotTDr))
            + BlankCol() + BlankCol()
            + HtmlLib.TableRowClose() + "\n");
 }
Ejemplo n.º 9
0
        public string DivHtml(bool showBackups, string catIn, string strPos)
        {
            var s = HtmlLib.TableOpen("BORDER=1 BORDERCOLOR=BLACK BGCOLOR=WHITE") + "\n" +
                    HtmlLib.TableRowOpen() + "\n";

            s = TeamList.Cast <NflTeam>().Aggregate(s, (current, t) => current + t.BoxHtml(showBackups, catIn, strPos));

            return(s + HtmlLib.TableRowClose() + "\n" + HtmlLib.TableClose() + "\n");
        }
Ejemplo n.º 10
0
        public string SeasonProjection(string metricName, IPrognosticate predictor, DateTime projectionDate)
        {
            //  Start off with the division name
            var s = HtmlLib.TableRowOpen("BGCOLOR='LIGHTGREY'") +
                    HtmlLib.TableDataAttr(HtmlLib.Font("VERDANA", NameOut(), "-1"), "ALIGN='CENTER' COLSPAN='19'") +
                    HtmlLib.TableRowClose() + "\n";

            return(TeamList.Cast <NflTeam>()
                   .Aggregate(s, (current, t) => current + t.SeasonProjection(predictor, metricName, projectionDate)));
        }
Ejemplo n.º 11
0
        public string DivInjuries()
        {
            var s = HtmlLib.TableOpen("BORDER=1 BORDERCOLOR=BLACK BGCOLOR=WHITE") + "\n" +
                    HtmlLib.TableRowOpen() + "\n";

            //foreach ( NflTeam t in TeamList )
            //   s += t.InjuryHtml();
            s = TeamList.Cast <NflTeam>().Aggregate(s, (current, t) => current + t.InjuryHtml());

            return(s + HtmlLib.TableRowClose() + "\n" + HtmlLib.TableClose() + "\n");
        }
Ejemplo n.º 12
0
        private static string SummaryHeader()
        {
            var htmlOut =
                HtmlLib.TableRowOpen() + "\n\t\t"
                + HtmlLib.TableDataAttr(HtmlLib.Bold("AWAY"), "colspan='5' class='gponame'") + "\n\t"
                + HtmlLib.TableDataAttr(HtmlLib.Bold("---"), "colspan='1' class='gponame'") + "\n\t"
                + HtmlLib.TableDataAttr(HtmlLib.Bold("HOME"), "colspan='5' class='gponame'") + "\n\t"
                + HtmlLib.TableRowClose() + "\n";

            return(htmlOut);
        }
Ejemplo n.º 13
0
 private string Row2()
 {
     return(HtmlLib.TableRowOpen() +
            BlankCol() + BlankCol() + BlankCol()
            + SpitUnit("PP", Team.PpRating(), string.Format("Sacks Allowed {0}", Team.TotSacksAllowed))
            + BlankCol() + SpitPlayer("QB", 1, false)
            + BlankCol() + BlankCol()
            + SpitUnit("PO", Team.PoRating(), string.Format("TD - INT ratio {0}-{1}", Team.TotTDp, Team.TotInterceptions))
            + BlankCol() + BlankCol()
            + HtmlLib.TableRowClose() + "\n");
 }
Ejemplo n.º 14
0
        private string DumpPlayerGameMetrics()
        {
            var sb = new StringBuilder();

            sb.Append(HtmlLib.TableOpen("border='0'"));
            sb.Append(HtmlLib.TableRowOpen());
            sb.Append(HtmlLib.TableData(Game.DumpPgmsAsHtml("Home PGMs", Game.HomeTeam)));
            sb.Append(HtmlLib.TableData(Game.DumpPgmsAsHtml("Away PGMS", Game.AwayTeam)));
            sb.Append(HtmlLib.TableRowClose());
            sb.Append(HtmlLib.TableClose());
            return(sb.ToString());
        }
Ejemplo n.º 15
0
        private string DumpLineups()
        {
            var sb = new StringBuilder();

            sb.Append(HtmlLib.TableOpen("border='0'"));
            sb.Append(HtmlLib.TableRowOpen());
            sb.Append(HtmlLib.TableData(Game.HomeLineup.DumpAsHtml("Home Lineup")));
            sb.Append(HtmlLib.TableData(Game.AwayLineup.DumpAsHtml("Away Lineup")));
            sb.Append(HtmlLib.TableRowClose());
            sb.Append(HtmlLib.TableClose());
            return(sb.ToString());
        }
Ejemplo n.º 16
0
        private string GameBlock()
        {
            string s;

            if (_game != null)
            {
                var weekOut = Int32.Parse(_game.Week) > 17 ? "PO" : "W" + _game.Week;
                if (_game.Week.Equals("21"))
                {
                    weekOut = "SB";
                }
                s = HtmlLib.TableOpen("BORDER='1' CELLSPACING='3' CELLPADDING='3'") +
                    HtmlLib.TableRowOpen() +
                    HtmlLib.TableData(_game.AussieDate()) +
                    HtmlLib.TableData(_game.AussieHour(true)) +
                    HtmlLib.TableData(weekOut) +
                    HtmlLib.TableData(_game.Season) +
                    HtmlLib.TableRowClose() +
                    HtmlLib.TableRowOpen() +
                    HtmlLib.TableData(HtmlLib.Bold(_game.HomeTeamName), SetColour(true)) +
                    HtmlLib.TableData("vs. " + _game.AwayTeamName, SetColour(false)) +
                    HtmlLib.TableData(_game.Spread.ToString()) +
                    HtmlLib.TableData(_game.Total.ToString()) +
                    HtmlLib.TableRowClose() +
                    HtmlLib.TableRowOpen();
                if (_game.HomeNflTeam != null)
                {
                    s += HtmlLib.TableData(_game.HomeNflTeam.RecordOut());
                }
                else
                {
                    s += HtmlLib.TableData(" ");
                }
                if (_game.AwayNflTeam != null)
                {
                    s += HtmlLib.TableData(_game.AwayNflTeam.RecordOut());
                }
                else
                {
                    s += HtmlLib.TableData(" ");
                }

                s += HtmlLib.TableData("") +
                     HtmlLib.TableData("") +
                     HtmlLib.TableRowClose() +
                     HtmlLib.TableClose();
            }
            else
            {
                s = "no game object";
            }
            return(s);
        }
Ejemplo n.º 17
0
        private string DumpFantasyPlayers()
        {
            var sb = new StringBuilder();

            sb.Append(HtmlLib.TableOpen("border='0'"));
            sb.Append(HtmlLib.TableRowOpen());
            sb.Append(HtmlLib.TableData(Game.DumpFantasyPlayersAsHtml("Home Fantasy Players", Game.HomeTeam)));
            sb.Append(HtmlLib.TableData(Game.DumpFantasyPlayersAsHtml("Away Fantasy Players", Game.AwayTeam)));
            sb.Append(HtmlLib.TableRowClose());
            sb.Append(HtmlLib.TableClose());
            return(sb.ToString());
        }
Ejemplo n.º 18
0
        public string DumpAsHtml(string header)
        {
            var sb = new StringBuilder();

            sb.Append(HtmlLib.H3(header));
            sb.Append(HtmlLib.TableOpen("border='0'"));
            sb.Append(HtmlLib.TableRowOpen());
            sb.Append(HtmlLib.TableData(DumpOffenceHtml()));
            sb.Append(HtmlLib.TableData(DumpDefenceHtml()));
            sb.Append(HtmlLib.TableRowClose());
            sb.Append(HtmlLib.TableClose());
            return(sb.ToString());
        }
Ejemplo n.º 19
0
        private static string Header(string cHeading)
        {
            var htmlOut = HtmlLib.TableOpen("class='title' cellpadding='0' cellspacing='0' width='100%'") + "\n\t"
                          + HtmlLib.TableRowOpen(TopLine()) + "\n\t\t"
                          + HtmlLib.TableDataAttr(HtmlLib.Bold(cHeading), "colspan='2' class='gponame'") + "\n\t"
                          + HtmlLib.TableRowClose() + "\n\t"
                          + HtmlLib.TableRowOpen() + "\n\t\t"
                          + HtmlLib.TableDataAttr(TopLine(), "id='dtstamp'") + "\n\t\t"
                          + HtmlLib.TableData(HtmlLib.Div("objshowhide", "tabindex='0'")) + "\n\t"
                          + HtmlLib.TableRowClose() + "\n"
                          + HtmlLib.TableClose() + "\n";

            return(htmlOut);
        }
Ejemplo n.º 20
0
        private string DRow3()
        {
            string htm = HtmlLib.TableRowOpen()
                         + SpitPlayer("RCB", 1, true) + BlankCol() + SpitPlayer("FS", 1, true)
                         +
                         SpitUnit("PD", Team.PdRating(),
                                  string.Format("Ints Tdp ratio {0}-{1}", Team.TotIntercepts, Team.TotTDpAllowed))
                         + BlankCol()
                         + BlankCol() + BlankCol() + SpitPlayer("SS", 1, true) + BlankCol() + BlankCol()
                         + SpitPlayer("LCB", 1, true)
                         + HtmlLib.TableRowClose() + "\n";

            return(htm);
        }
Ejemplo n.º 21
0
        public string Kickers()
        {
            //  Start off with the division name
            var s = HtmlLib.TableRowOpen("BGCOLOR='LIGHTGREY'") +
                    HtmlLib.TableDataAttr(HtmlLib.Font("VERDANA", NameOut(), "-1"), "ALIGN='CENTER' COLSPAN='19'") +
                    HtmlLib.TableRowClose() + "\n";

            foreach (NflTeam t in TeamList)
            {
                s          += t.KickerProjection();
                FieldGoals += t.FieldGoals;
            }
            return(s);
        }
Ejemplo n.º 22
0
        private string AwayLine(NFLResult prediction)
        {
            var sb = new StringBuilder();

            sb.Append(HtmlLib.TableRowOpen());
            sb.Append(HtmlLib.TableData(Game.AwayTeam));
            sb.Append(HtmlLib.TableData(ScoreOut(prediction.AwayScore, Game.AwayScore)));
            sb.Append(HtmlLib.TableData(ScoreOut(prediction.AwayTDp, Game.AwayTDp)));
            sb.Append(HtmlLib.TableData(ScoreOut(prediction.AwayTDr, Game.AwayTDr)));
            sb.Append(HtmlLib.TableData(ScoreOut(prediction.AwayFg, Game.AwayFg)));
            sb.Append(HtmlLib.TableData(ScoreOut(prediction.AwayTDd, Game.AwayTDd)));
            sb.Append(HtmlLib.TableData(ScoreOut(prediction.AwayTDs, Game.AwayTDs)));
            sb.Append(HtmlLib.TableRowClose());
            return(sb.ToString());
        }
Ejemplo n.º 23
0
        private static string Prediction(NflTeam team, IPrognosticate predictor)
        {
            var predictionStr = String.Empty;

            if (team != null)
            {
                predictionStr =
                    HtmlLib.TableOpen("BORDER='1' CELLSPACING='0' CELLPADDING='0'") +
                    HtmlLib.TableRowOpen() +
                    HtmlLib.TableDataAttr(team.Name, "COLSPAN='19'") +
                    HtmlLib.TableRowClose() +
                    team.SeasonProjection(predictor, "Spread", DateTime.Now);
            }
            return(predictionStr);
        }
Ejemplo n.º 24
0
        private string Header(string cHeading)
        {
            var htmlOut = HtmlLib.TableOpen("class='title' cellpadding='0' cellspacing='0'") + "\n\t"
                          + HtmlLib.TableRowOpen() + "\n\t\t"
                          + HtmlLib.TableDataAttr(cHeading, "colspan='2' class='gponame'") + "\n\t"
                          + HtmlLib.TableRowClose() + "\n\t"
                          + HtmlLib.TableRowOpen() + "\n\t\t"
                          + HtmlLib.TableDataAttr("Report Date:" + DateTime.Now.ToString("dd MMM yy  HH:mm") +
                                                  "   elapsed:" + TimeTaken, "id='dtstamp'") + "\n\t\t"
                          + HtmlLib.TableData(HtmlLib.Div("objshowhide", "tabindex='0'")) + "\n\t"
                          + HtmlLib.TableRowClose() + "\n"
                          + HtmlLib.TableClose() + "\n";

            return(htmlOut);
        }
Ejemplo n.º 25
0
        private void AwayOffUnits(ref string s)
        {
#if DEBUG
            Utility.Announce("AwayOffUnits");
#endif
            if (_game == null)
            {
                Utility.Announce("AwayOffUnits: null game");
            }
            else
            {
                if ((_game.HomeNflTeam == null) || (_game.AwayNflTeam == null))
                {
                    Utility.Announce("AwayOffUnits: null team");
                }
                else
                {
                    s += HtmlLib.TableOpen("BORDER='1'");

                    s += HtmlLib.TableRowOpen();
                    s += HtmlLib.TableDataAttr(_game.AwayNflTeam.RoList(), "VALIGN='TOP'");
                    s += HtmlLib.TableDataAttr(_game.HomeNflTeam.RdList(), "VALIGN='TOP'");
                    s += HtmlLib.TableRowClose();

                    s += HtmlLib.TableRowOpen();
                    s += HtmlLib.TableDataAttr(_game.AwayNflTeam.RoUnit(_game.Season), "VALIGN='TOP'");
                    s += HtmlLib.TableDataAttr(_game.HomeNflTeam.RdUnit(_game.Season), "VALIGN='TOP'");
                    s += HtmlLib.TableRowClose();

                    s += HtmlLib.TableRowOpen();
                    s += HtmlLib.TableDataAttr(_game.AwayNflTeam.PoList(), "VALIGN='TOP'");
                    s += HtmlLib.TableDataAttr(_game.HomeNflTeam.PdList(), "VALIGN='TOP'");
                    s += HtmlLib.TableRowClose();

                    s += HtmlLib.TableRowOpen();
                    s += HtmlLib.TableDataAttr(_game.AwayNflTeam.PoUnit(_game.Season), "VALIGN='TOP'");
                    s += HtmlLib.TableDataAttr(_game.HomeNflTeam.PdUnit(_game.Season), "VALIGN='TOP'");
                    s += HtmlLib.TableRowClose();

                    s += HtmlLib.TableRowOpen();
                    s += HtmlLib.TableDataAttr(_game.AwayNflTeam.PpUnit(_game.Season), "VALIGN='TOP'");
                    s += HtmlLib.TableDataAttr(_game.HomeNflTeam.PrUnit(_game.Season), "VALIGN='TOP'");
                    s += HtmlLib.TableRowClose();

                    s += HtmlLib.TableClose();
                }
            }
        }
Ejemplo n.º 26
0
        public string PerfRow()
        {
            if ((TeamCode == null) || (TeamCode == "??") || (TeamCode == "bye"))
            {
                return(String.Empty);
            }

            return(HtmlLib.TableRowOpen(RowClass()) + "\n"
                   + HtmlLib.TableData(String.Format("{0}:{1:0#}", Season, Week)) + "\n"
                   + HtmlLib.TableData(GameOut()) + "\n"
                   + HtmlLib.TableData(Game.GameDate.ToString("dd/MM/yyyy")) + "\n"
                   + HtmlLib.TableData(ResultOut()) + "\n"
                   + HtmlLib.TableData(PerfStats.Stat1(_thePlayer.PlayerCat, false)) + "\n"
                   + HtmlLib.TableData(PerfStats.Stat2(_thePlayer.PlayerCat)) + "\n"
                   + HtmlLib.TableRowClose() + "\n");
        }
Ejemplo n.º 27
0
        private string Footer()
        {
            var htmlOut = HtmlLib.TableOpen("class='title' cellpadding='0' cellspacing='0'") + "\n\t"
                          + HtmlLib.TableRowOpen() + "\n\t\t"
                          + HtmlLib.TableDataAttr(_footer, "colspan='2' class='gponame'") + "\n\t"
                          + HtmlLib.TableRowClose() + "\n\t";

            if (ShowElapsedTime)
            {
                htmlOut += HtmlLib.TableRowOpen() + "\n\t\t"
                           + HtmlLib.TableDataAttr("elapsed time:" + TimeTaken, "id='dtstamp'") + "\n\t\t"
                           + HtmlLib.TableData(HtmlLib.Div("objshowhide", "tabindex='0'")) + "\n\t"
                           + HtmlLib.TableRowClose() + "\n";
            }
            htmlOut += HtmlLib.TableClose() + "\n";
            return(htmlOut);
        }
Ejemplo n.º 28
0
 public string PerfHeaders()
 {
     return(HtmlLib.TableRowOpen() + "\n" + HtmlLib.TableRowHeaderOpen("scope='col'") + "\n"
            + HtmlLib.HTMLPadL("Week", 2) + HtmlLib.TableRowHeaderClose() + "\n"
            + HtmlLib.TableRowHeaderOpen("scope='col'") + "\n"
            + HtmlLib.HTMLPadL("Game", 2) + HtmlLib.TableRowHeaderClose() + "\n"
            + HtmlLib.TableRowHeaderOpen("scope='col'") + "\n"
            + HtmlLib.HTMLPadL("Date", 2) + HtmlLib.TableRowHeaderClose() + "\n"
            + HtmlLib.TableRowHeaderOpen("scope='col'") + "\n"
            + HtmlLib.HTMLPadL("Result", 2) + HtmlLib.TableRowHeaderClose() + "\n"
            + HtmlLib.TableRowHeaderOpen("scope='col'") + "\n"
            + HtmlLib.HTMLPadL(Col1Header(), 2) + HtmlLib.TableRowHeaderClose() + "\n"
            + HtmlLib.TableRowHeaderOpen("scope='col'") + "\n"
            + HtmlLib.HTMLPadL(Col2Header(), 2) + HtmlLib.TableRowHeaderClose() + "\n"
            + HtmlLib.TableRowHeaderOpen("scope='col'") + "\n"
            + HtmlLib.TableRowClose() + "\n");
 }
Ejemplo n.º 29
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);
        }
Ejemplo n.º 30
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);
        }