Example #1
0
 private static string Embelish(string result)
 {
     if (result == "Win")
     {
         result = HtmlLib.Bold(result);
     }
     return(result);
 }
Example #2
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);
        }
Example #3
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);
        }
Example #4
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);
        }
Example #5
0
        public string Render()
        {
            var no      = String.Empty;
            var drafted = "";

            if (_mName.Length > 0)
            {
                _mBgColour = _mPlayer.SetColour("RED");
                no         = _mPlayer.JerseyNo;
                if (_mPlayer.IsNewbie())
                {
                    _mName = _mPlayer.Url(HtmlLib.Italics(HtmlLib.Bold(_mName)));
                }
//            drafted = string.Format( " {0} {1}", mPlayer.Drafted, (int) mPlayer.ExperiencePoints );
                drafted = string.Format(" {0} {1}", _mPlayer.Drafted, "");
            }

            var t = PlayerTable(drafted, no);

            var strRet = HtmlLib.TableData((Offset ? "<br>" : "") + t.Render());

            return(strRet);
        }
Example #6
0
        private DataTable LoadBets(ArrayList betList)
        {
            DataTable            dt   = new DataTable();
            DataColumnCollection cols = dt.Columns;

            cols.Add("TEAM", typeof(String));
            cols.Add("GAMECODE", typeof(String));
            cols.Add("TURF", typeof(String));
            cols.Add("SPREAD", typeof(String));
            cols.Add("OPPONENT", typeof(String));
            cols.Add("DATE", typeof(String));
            cols.Add("TIME", typeof(String));
            cols.Add("REASONS", typeof(String));
            cols.Add("AMOUNT", typeof(String));
            cols.Add("RESULT", typeof(String));
            cols.Add("WINNINGS", typeof(String));

            if (betList != null)
            {
                foreach (NFLBet b in betList)
                {
                    if (b.IsValid)
                    {
                        double  amount = (WagerAmount() * (int)b.ConfidenceLevel);
                        DataRow dr     = dt.NewRow();
                        dr["TEAM"]     = HtmlLib.Bold(b.TeamToBetOn);
                        dr["GAMECODE"] = b.Game.GameCode;
                        dr["TURF"]     = (b.IsHome()) ? "v" : "@";
                        dr["SPREAD"]   = HtmlLib.Bold(SpreadOut(b.Handicap()));
                        dr["OPPONENT"] = b.Opponent();
                        dr["DATE"]     = b.Game.GameDate.AddDays(1D).ToShortDateString();
                        if (b.Game.Played())
                        {
                            dr["TIME"] = b.Game.ScoreOut3();
                        }
                        else
                        {
                            dr["TIME"] = MilitaryTime(theWeek.AusHour(b.Game.Hour, b.Game.GameDate.Month).ToString());
                        }
                        dr["REASONS"] = b.ReasonList();
                        dr["AMOUNT"]  = string.Format("{0:#0.00}", amount);
                        dr["RESULT"]  = Embelish(b.Result());
                        switch (b.Result())
                        {
                        case "Win":
                            Wins++;
                            break;

                        case "Loss":
                            Losses++;
                            break;

                        case "Push":
                            Losses++;
                            break;

                        default:
                            //  not played yet
                            break;
                        }
                        if (b.Resolved())
                        {
                            dr["WINNINGS"] = string.Format("{0:#0.00}", b.Winnings(amount));
                        }
                        dt.Rows.Add(dr);
                        TotalInvestment += amount;
                        TotalReturn     += b.Winnings(amount);
                    }
                }
            }

            return(dt);
        }
        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);
        }