예제 #1
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";
     }
 }
예제 #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");
 }
예제 #3
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());
        }
예제 #4
0
        private void RecentMeetings(ref string s)
        {
            //RosterLib.Utility.Announce( "Doing Recent Meetings");

            var s1             = String.Empty;
            var nonDeletedRecs = 0;

            s1 += HtmlLib.TableOpen("border='1'");
            s1 += HtmlLib.TableHeader("Season");
            s1 += HtmlLib.TableHeader("Week");
            s1 += HtmlLib.TableHeader("AT");
            s1 += HtmlLib.TableHeader("AS");
            s1 += HtmlLib.TableHeader("HT");
            s1 += HtmlLib.TableHeader("HS");
            s1 += HtmlLib.TableHeader("Spread");
            s1 += HtmlLib.TableHeader("O/U") + "<br>\n\n";
            //RosterLib.Utility.Announce(s1);
            var now         = DateTime.Now;
            var ts          = new TimeSpan((3 * 365), 0, 0, 0);
            var threeYrsAgo = now.Subtract(ts);

            //RosterLib.Utility.Announce( string.Format("3 years ago was {0}", threeYrsAgo ) );
            //RosterLib.Utility.Announce(string.Format("Getting games between {0} and {1}", game.AwayTeam, game.HomeTeam ));
            if (Utility.TflWs != null)
            {
                var ds = Utility.TflWs.GetGamesBetween(_game.AwayTeam, _game.HomeTeam, threeYrsAgo);
                if (ds != null)
                {
                    // RosterLib.Utility.Announce(string.Format("found {0} Recent Meetings", ds.Tables[0].Rows.Count));
                    for (var i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        if (ds.Tables[0].Rows[i].RowState != DataRowState.Deleted)
                        {
                            nonDeletedRecs++;
                            var theGame = new NFLGame(ds.Tables[0].Rows[i]);
                            s1 += theGame.ResultRow() + "<br>\n\n";
                        }
                    }
                    s1 += HtmlLib.TableClose() + "<br>\n\n";
                }
                else
                {
                    Utility.Announce("Null game set");
                }

                if (nonDeletedRecs > 0)
                {
                    s += s1;
                }
                else
                {
                    s += "<br>No Previous Meetings<br>";
                }
            }
            else
            {
                Utility.Announce("No Librarian!");
            }
        }
예제 #5
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");
        }
예제 #6
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");
        }
예제 #7
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());
        }
예제 #8
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);
        }
예제 #9
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());
        }
예제 #10
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());
        }
예제 #11
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());
        }
예제 #12
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);
        }
예제 #13
0
        private string PredictionHtml()
        {
            var prediction = Game.GetPrediction("unit");
            var sb         = new StringBuilder();

            sb.Append(HtmlLib.TableOpen("border='1'"));
            sb.Append(PredictionHtmlHeader());

            sb.Append(AwayLine(prediction));
            sb.Append(HomeLine(prediction));

            sb.Append(HtmlLib.TableClose());

            return(sb.ToString());
        }
예제 #14
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);
        }
예제 #15
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();
                }
            }
        }
예제 #16
0
        private string Footer(bool showResults)
        {
            string s = HtmlLib.TableOpen();

            s += FooterRow("Investment", "${0:###0.00}", TotalInvestment);

            if (showResults)
            {
                s += FooterRow("Return", "${0:###0.00}", TotalReturn);
                s += FooterRow("ROI", "{0:###0.0}%", ((TotalReturn / TotalInvestment) - 1.0D) * 100.0D);
                s += FooterRow("Total P/L", "${0:###0.00}", (TotalReturn - TotalInvestment));
                s += FooterRow("Record ", "{0}", RecordOut);
            }

            return(s + HtmlLib.TableClose());
        }
예제 #17
0
        private string StdFooter()
        {
            //  a table with some magic numbers
            string footer = "";

            footer  = HtmlLib.TableOpen("border='0' cellpadding='1' cellspacing='1'");
            footer += AddFooterLine("Mean", Average());
            footer += AddFooterLine("Max", Int32.Parse(string.Format("{0:0}", Maximum)));
            footer += AddFooterLine("Min", Int32.Parse(string.Format("{0:0}", Minimum)));
            footer += AddFooterLine("Variance", Variance());
            footer += AddFooterLine("Std Deviation", Decimal.Parse(StandardDeviation().ToString()));
            footer += AddFooterLine("Percentile 33", Int32.Parse(string.Format("{0:0}", Percentile33)));
            footer += AddFooterLine("Percentile 67", Int32.Parse(string.Format("{0:0}", Percentile67)));
            footer += AddFooterLine("Total", CumulativeTotal);
            footer += AddFooterLine("Team average", (CumulativeTotal / 32));
            return(footer + HtmlLib.TableClose());
        }
예제 #18
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);
        }
예제 #19
0
        private string TeamListOut()
        {
            var s            = HtmlLib.TableOpen("BORDER=1 BORDERCOLOR=BLACK") + "\n" + HtmlLib.TableRowOpen() + "\n";
            var nCount       = 0;
            var myEnumerator = DivList.GetEnumerator();

            while (myEnumerator.MoveNext())
            {
                nCount++;
                if (nCount == 5)
                {
                    s     += HtmlLib.TableRowClose() + "\n" + HtmlLib.TableRowOpen();
                    nCount = 0;
                }

                var d      = (NFLDivision)myEnumerator.Current;
                var strPos = Focus ?? string.Empty;
                s += d.DivHtml(ShowBackups, StrCat, strPos);
            }

            return(s + HtmlLib.TableRowClose() + "\n" + HtmlLib.TableClose() + "\n");
        }
예제 #20
0
        private string InjuryListOut()
        {
            var s = HtmlLib.TableOpen("BORDER=1 BORDERCOLOR=BLACK") + "\n" +
                    HtmlLib.TableRowOpen() + "\n";
            var nCount       = 0;
            var myEnumerator = DivList.GetEnumerator();

            while (myEnumerator.MoveNext())
            {
                nCount++;
                if (nCount == 5)
                {
                    s     += HtmlLib.TableRowClose() + "\n" + HtmlLib.TableRowOpen();
                    nCount = 0;
                }

                var d = (NFLDivision)myEnumerator.Current;
                s += d.DivInjuries();
            }

            return(s + HtmlLib.TableRowClose() + "\n" +
                   HtmlLib.TableClose() + "\n");
        }
예제 #21
0
        public string BodyOut()
        {
            var rowCount = 0;
            var bBlank   = false;
            var tot      = new int[_columns.Count];

            for (var i = 0; i < _columns.Count; i++)
            {
                tot[i] = 0;
            }

            var sLastData = "";
            var s         = "";

            if (Body != null)
            {
                s += HtmlLib.TableOpen("border=1 cellpadding='3' cellspacing='3'");
                s += ColHeaders();
                //  now just add a series of rows for each record
                for (var j = 0; j < Body.DefaultView.Count; j++)
                {
                    rowCount++;
                    if (IsEven(rowCount))
                    {
                        s += HtmlLib.TableRowOpen("BGCOLOR='MOCCASIN'");
                    }
                    else
                    {
                        s += HtmlLib.TableRowOpen();
                    }

                    if (DoRowNumbers)
                    {
                        s += HtmlLib.TableDataAttr(
                            rowCount.ToString(
                                CultureInfo.InvariantCulture),
                            "ALIGN='RIGHT' VALIGN='TOP'");
                    }

                    //  plug in the data for each column defined
                    for (var i = 0; i < _columns.Count; i++)
                    {
                        var col = ( ReportColumn )_columns[i];
                        var dc  = Body.Columns[col.Source];

                        var sVal  = Body.DefaultView[j][col.Source].ToString();
                        var sData = FormatData(dc, col.Format, sVal);

                        if (col.CanAccumulate)
                        {
                            Totals = true;
                            if (sVal.Length > 0)
                            {
                                tot[i] += QuantityOf(sVal);
                            }
                        }

                        if (i == 0)
                        {
                            if (sData == sLastData)
                            {
                                bBlank = true;
                            }
                            else
                            {
                                sLastData = sData;
                                bBlank    = false;
                            }
                        }
                        if (i > 5)
                        {
                            bBlank = false;
                        }
                        if (bBlank && !CarryRow)
                        {
                            sData = " ";
                        }

                        if (col.BackGroundColourDelegateFromRole != null)
                        {
                            s += HtmlLib.TableDataAttr(
                                sData, AttrFor(
                                    dc,
                                    col.BackGroundColourDelegateFromRole,
                                    sVal));
                        }
                        else
                        {
                            s += HtmlLib.TableDataAttr(
                                sData,
                                AttrFor(
                                    dc,
                                    col.BackGroundColourDelegate,
                                    sVal));
                        }
                    }
                    s += HtmlLib.TableRowClose();
                }
                s += TotalLine(tot);
                s += AverageLine(tot, rowCount);
                s += HtmlLib.TableClose();
            }
            return(s);
        }