示例#1
0
        public string CardDefence()
        {
            var theSeason = Utility.CurrentSeason();

            if (Utility.CurrentWeek() == "0")
            {
                theSeason = Utility.LastSeason();
            }
            Team.PrUnit(theSeason);
            Team.RdUnit(theSeason);
            Team.PdUnit(theSeason);

            var innerTable =
                HtmlLib.TableOpen("class='title' cellpadding='1' cellspacing='1' border='0' width='950'") + "\n\t"
                + DRow3() + DRow2() + DRow1()
                + 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("DEFENCE", "ALIGN='RIGHT'") + HtmlLib.TableRowClose() +
                   HtmlLib.TableRowOpen() + HtmlLib.TableDataAttr(innerTable, "COLSPAN='2'") + HtmlLib.TableRowClose() +
                   HtmlLib.TableClose());
        }
        private string SeasonOut(string metric, DateTime projectionDate)
        {
            IPrognosticate predictor;

            if (metric.Equals("Spread"))
            {
                //predictor = new NibblePredictor(Utility.CurrentSeason());  //  which is more accurate??
                predictor = new UnitPredictor
                {
                    TakeActuals     = true,
                    AuditTrail      = false,
                    WriteProjection = true,
                    StorePrediction = true,
                    RatingsService  = new UnitRatingsService(new TimeKeeper(null))
                }
            }
            ;
            else
            {
                predictor = new WizPredictor();
            }
            var s = HtmlLib.TableOpen("border=1 cellpadding='0' cellspacing='0'");

#if !DEBUG
            //  to save time testing
            if (Nfc != null)
            {
                s += Nfc.SeasonProjection(metric, predictor, projectionDate);
            }
#endif
            if (Afc != null)
            {
                s += Afc.SeasonProjection(metric, predictor, projectionDate);
            }
            return(s);
        }
示例#3
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);
        }