Exemplo n.º 1
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);
        }