Пример #1
0
        public static void BankRoll(this ExcelModel model, int dumpAt, int dumpAmount, int aBet, int bBet, int cBet, int dBet)
        {
            model.BetList = model.BetList.OrderBy(e => e.BetDate).ThenByDescending(e => e.Winning).ToList();

            int betIndex = 1;
            bool first = true;

            List<ExcelExport> winList = new List<ExcelExport>();

            foreach (DateTime betDate in model.BetList.GroupBy(bl => bl.BetDate).Select(d => d.Key))
            {
                List<ExcelExport> betsOnDate = model.BetList.Where(g => g.BetDate == betDate).ToList();
                winList.Clear();

                foreach (ExcelExport game in betsOnDate)
                {
                    if (first)
                    {
                        game.RunningTotal = 2000;
                    }
                    else
                    {
                        game.RunningTotal = model.BetList[model.BetList.IndexOf(game) - 1].RunningTotal;
                    }
                    first = false;

                    switch (game.Current)
                    {
                        case "A":
                            game.BetAmount = aBet;
                            break;
                        case "B":
                            game.BetAmount = bBet;
                            break;
                        case "C":
                            game.BetAmount = cBet;
                            break;
                        case "D":
                            game.BetAmount = dBet;
                            break;
                        //case "Loss":
                        //    game.bet
                        //    break;
                        default:
                            //game.Current = "OVER";
                            game.BetAmount = 0;
                            break;
                    }

                    //if (game.RunningTotal < game.BetAmount)
                    //{
                    //    game.BankDump = game.RunningTotal - game.BetAmount;
                    //}

                    game.RunningTotal = game.RunningTotal - game.BetAmount;

                    if (game.Winning == game.Current)
                    {
                        ExcelExport ex = new ExcelExport();
                        ex.AwayTeam = game.AwayTeam;
                        ex.BankDump = game.BankDump;
                        ex.BetAmount = game.BetAmount;
                        ex.BetDate = game.BetDate;
                        ex.BetId = game.BetId;
                        ex.Current = game.Current;
                        ex.HomeTeam = game.HomeTeam;
                        ex.RunningTotal = game.RunningTotal;
                        ex.WinAmount = game.WinAmount;
                        ex.Winning = game.Winning;

                        //game.RunningTotal = game.RunningTotal + game.BetAmount + game.WinAmount;
                        //ex.BetAmount = 0;

                        winList.Add(ex);
                        //betIndex++;
                        //if (betIndex == 18)
                        //{
                        //    game.BankDump = dumpAmount;
                        //    game.RunningTotal = game.RunningTotal - dumpAmount;
                        //}
                    }
                    //else
                    //{
                    //    game.RunningTotal = game.RunningTotal - game.BetAmount;
                    //}
                }

                int index = 0;
                winList = winList.OrderBy(wl => wl.RunningTotal).ToList();
                foreach (ExcelExport win in winList)
                //foreach (ExcelExport win in winList)
                {
                    index = winList.IndexOf(win);
                    if (index > 0)
                    {
                        win.RunningTotal = winList[index - 1].RunningTotal;
                    }

                    win.WinAmount = (win.BetAmount - (win.BetAmount * .1));
                    win.RunningTotal = win.RunningTotal + win.BetAmount + win.WinAmount;
                    //model.BetList.Insert(model.BetList.IndexOf(betsOnDate.Where(b=>b.BetDate == win.BetDate).Last()) +1, win);
                    index++;
                }
                winList = winList.OrderBy(wl => wl.RunningTotal).ToList();
                model.BetList.InsertRange(model.BetList.IndexOf(betsOnDate.Last()) + 1, winList);
                //if (winList.Count > 0)
                //{
                //    model.BetList.InsertRange(model.BetList.IndexOf(betsOnDate.Last()), winList);
                //}
            }
        }
Пример #2
0
        public ActionResult Excel(int seasonId, int? bettingType, int? moneyType)
        {
            ExcelModel model = new ExcelModel();
            model.BetList = new List<ExcelExport>();
            SeasonBets tempModel = new SeasonBets();
            //ListAccess la = new ListAccess();
            //model.Bets = la.NBABets(seasonId);
            //model.TotalGroupBetNumbers();

            tempModel.VersionThree((AppStatic.Seasons)seasonId, AppStatic.BettingSetup.MoneyLine);
            //List<ExcelExport> eeList = new List<ExcelExport>();
            bool hasWon = false;

            //keeps track of amount of best after loss
            int indexLoss = 0;
            foreach (Bet bet in tempModel.Bets)
            {
                hasWon = false;
                foreach (Game game in bet.BetGames)
                {
                    if (hasWon)
                    { break; };

                    ExcelExport ee = new ExcelExport();
                    ee.BetId = bet.BetId;
                    ee.BetDate = game.GameDate;
                    ee.AwayTeam = game.AwayTeamName;
                    ee.HomeTeam = game.HomeTeamName;

                    switch (bet.BetGames.IndexOf(game))
                    {
                        case 0:
                            ee.Current = "A";
                            break;
                        case 1:
                            ee.Current = "B";
                            break;
                        case 2:
                            ee.Current = "C";
                            break;
                        case 3:
                            ee.Current = "D";
                            break;
                        case 4:
                            ee.Current = "Loss";
                            break;
                        default:
                            ee.Current = "OVER";
                            break;
                    }

                    ee.RunningTotal = ee.RunningTotal - ee.BetAmount;

                    if (bet.WinA)
                    {
                        ee.Winning = "A";
                    }
                    if (bet.WinB)
                    {
                        ee.Winning = "B";
                    }
                    if (bet.WinC)
                    {
                        ee.Winning = "C";
                    }
                    if (bet.WinD)
                    {
                        ee.Winning = "D";
                    }
                    if (!bet.WinA && !bet.WinB && !bet.WinC && !bet.WinD)
                    {
                        ee.Winning = "Loss";
                    }

                    model.BetList.Add(ee);

                    if (ee.Winning == ee.Current)
                    {
                        hasWon = true;
                    }
                }
            }

            model.BankRoll(16, 2000, 275, 578, 1214, 2275);

            model.ACount = model.BetList.Where(b => b.Winning == "A" && b.Current == "A").Count();
            model.BCount = model.BetList.Where(b => b.Winning == "B" && b.Current == "B").Count();
            model.CCount = model.BetList.Where(b => b.Winning == "C" && b.Current == "C").Count();
            model.DCount = model.BetList.Where(b => b.Winning == "D" && b.Current == "D").Count();
            model.Loss = model.BetList.Where(b => b.Winning == "Loss" && b.Current == "Loss").Count();
            model.TotalWins = model.ACount + model.BCount + model.CCount + model.DCount;
            model.TotalBets = model.BetList.Count();

            // model.VersionThree((AppStatic.Seasons)seasonId, AppStatic.BettingSetup.MoneyLine);
            //model.Bets = model.Bets.SelectMany(b => b.BetGames).OrderBy(g => g.GameDate).ToList();
            //model.MoneyLineBetsQuitWin();
            //if (bettingType != null)
            //{
            //    switch (bettingType)
            //    {
            //        case 1:
            //            model.Bets.SpreadBetsAll();
            //            break;
            //        case 2:
            //            model.Bets.MoneyLineBetsAll();
            //            break;
            //    }
            //}

            //model.Bets.MoneyLineBetsAll();

            return View("~/Views/Sports/NBA/Excel.cshtml", model);
        }