Пример #1
0
        //public static List<CustomHtmlLink> GenerateTreeViewFirstLev(int categoryRowId, string linkPrefix)
        //{

        //    List<CustomHtmlLink> linkList = new List<CustomHtmlLink>();
        //    ListAccess la = new ListAccess();
        //    Category cat = AppStatic.Categories
        //                        .Where(c => c.CategoryRowId == categoryRowId)
        //                        .FirstOrDefault();

        //    if (!String.IsNullOrEmpty(cat.ThirdLevCategoryUrl))
        //    {
        //        CustomHtmlLink htmlLink = new CustomHtmlLink
        //        {
        //            LinkText = cat.ThirdLevCategoryName,
        //            Href = "/" + linkPrefix + "/" + cat.CategoryUrl + "/" + cat.SecondLevCategoryUrl + "/" + cat.ThirdLevCategoryUrl,
        //            Title = cat.ThirdLevCategoryName,
        //            SubLinks = la.RelatedArticleLinks(cat, linkPrefix, 3)
        //        };
        //        //linkList[0].SubLinks=la.RelatedArticleLinks(cat, linkPrefix, 3);

        //        List<Category> secondLevelCats = AppStatic.Categories
        //                                        .Where(c => c.SecondLevCategoryId == cat.SecondLevCategoryId
        //                                        && c.CategoryRowId != categoryRowId).ToList();
        //        foreach (Category _cat in secondLevelCats)
        //        {
        //            //linkList.Add(new CustomHtmlLink
        //            //{
        //            //    LinkText = _cat.SecondLevCategoryName,
        //            //    Href = "/" + linkPrefix + "/" + _cat.CategoryUrl + "/" + _cat.SecondLevCategoryUrl,
        //            //    Title = _cat.SecondLevCategoryName + "-category",
        //            //});

        //            //(!String.IsNullOrEmpty(_cat.ThirdLevCategoryUrl))
        //            //{

        //            //}

        //            //linkList.Last().SubLinks = la.RelatedArticleLinks(_cat, linkPrefix);
        //        }
        //        return linkList;
        //    }

        //    if (!String.IsNullOrEmpty(cat.SecondLevCategoryUrl))
        //    {
        //        List<Category> secondLevelCats = AppStatic.Categories
        //                                        .Where(c => c.CategoryId == cat.CategoryId).ToList();
        //        foreach (Category _cat in secondLevelCats)
        //        {
        //            linkList.Add(new CustomHtmlLink
        //            {
        //                LinkText = _cat.CategoryName,
        //                Href = "/" + linkPrefix + "/" + _cat.CategoryUrl,
        //                Title = _cat.CategoryName
        //            });
        //            if (!String.IsNullOrEmpty(_cat.ThirdLevCategoryUrl))
        //            {
        //                linkList.Last().SubLinks = GenerateRelatedTreeView(_cat.CategoryRowId, linkPrefix);
        //            }
        //            else
        //            {
        //                linkList.Last().SubLinks = la.RelatedArticleLinks(_cat, linkPrefix, 3);
        //            }
        //        }
        //        return linkList;
        //    }

        //    //ListAccess la = new ListAccess();
        //    //linkList = la.RelatedLinks(cat, linkPrefix);

        //    return linkList;
        //}

        public static List <CustomHtmlLink> GenerateTreeViewThirdLev(int secondLevCatId, string linkPrefix)
        {
            List <CustomHtmlLink> linkList = new List <CustomHtmlLink>();
            ListAccess            la       = new ListAccess();

            List <Category> thirdLevCats = AppStatic.Categories
                                           .Where(c => c.SecondLevCategoryId == secondLevCatId &&
                                                  c.ThirdLevCategoryId > 0)
                                           .ToList();

            //List<Category> thirdLevelCats = AppStatic.Categories
            //                                    .Where(c => c.SecondLevCategoryId == cat.SecondLevCategoryId
            //                                     && !String.IsNullOrEmpty(c.ThirdLevCategoryName))
            //                                    .ToList();

            foreach (Category _thirdLevCat in thirdLevCats)
            {
                CustomHtmlLink newCat = new CustomHtmlLink
                {
                    LinkText = _thirdLevCat.ThirdLevCategoryName,
                    Href     = AppStatic.BaseSiteUrl + linkPrefix + "/" + _thirdLevCat.CategoryUrl + "/" + _thirdLevCat.SecondLevCategoryUrl + "/" + _thirdLevCat.ThirdLevCategoryUrl,
                    Title    = _thirdLevCat.ThirdLevCategoryName,
                    SubLinks = la.RelatedArticleLinks(_thirdLevCat, AppStatic.BaseSiteUrl + linkPrefix, 3)
                };
                linkList.Add(newCat);
                //newCat.SubLinks.AddRange(GenerateTreeViewThirdLev(_secondLevCat.SecondLevCategoryId, linkPrefix));
            }

            return(linkList);
        }
Пример #2
0
        public ActionResult BetGameList(int seasonId, int?bettingType, int?moneyType)
        {
            SeasonBets model = new SeasonBets();
            ListAccess la    = new ListAccess();

            model.Bets = la.NBABets(seasonId);
            //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/BetGameList.cshtml", model));
        }
Пример #3
0
        public ActionResult PostDetails(string html)
        {
            int _categoryId = 0;

            ListAccess la = new ListAccess();

            ArticleModel model = new ArticleModel();

            model.ArticleContent.LoadArticle(html);
            model.Comments = la.ArticleComments(model.ArticleContent.ArticleId);

            if (model.ArticleContent.CategoryId > 0)
            {
                _categoryId = model.ArticleContent.CategoryId;
            }
            else if (model.ArticleContent.SecondLevCategoryId > 0)
            {
                _categoryId = model.ArticleContent.SecondLevCategoryId;
            }
            else
            {
                _categoryId = model.ArticleContent.ThirdLevCategoryId;
            }

            PageModel.ArticleContent.Title       = model.ArticleContent.Title;
            PageModel.ArticleContent.Description = model.ArticleContent.Description;
            PageModel.ArticleContent.Author      = model.ArticleContent.Author;
            PageModel.ArticleContent.Keywords    = model.ArticleContent.Keywords;

            model.MostViewed = la.MostViewed(_categoryId, 20);

            model.RelatedTreeView = DIYFEHelper.GenerateTreeViewSecondLev(_categoryId, linkPrefix);

            return(View(model));
        }
Пример #4
0
        public ActionResult TeamSchedule(int seasonId, int teamId)
        {
            TeamSchedule model = new DIYFE.Web.Models.Sports.TeamSchedule();

            model.TeamId = teamId;
            model.Games  = new List <Game>();
            ListAccess la = new ListAccess();

            model.Games = la.TeamSchedule(seasonId, teamId);

            return(View("~/Views/Sports/NBA/TeamSchedule.cshtml", model));
        }
Пример #5
0
        //
        // GET: /Products/

        public ActionResult Index()
        {
            PageModel.Title       = "DiyFe Products";
            PageModel.Description = "List of products dealing with ";
            PageModel.Author      = "Do it yourself for everyone.";
            PageModel.Keywords    = "DIY, DIYFE, do it yourself, homesteading, transition";

            ListAccess   la    = new ListAccess();
            ArticleModel model = new ArticleModel();

            //model.MostViewed = la.MostViewed(11, 20);
            //model.CrumbLinkList = new List<CustomHtmlLink>();

            return(View(model));
        }
Пример #6
0
        public static void MBLVersionOneBets(this SeasonBets sBets, AppStatic.Seasons season, AppStatic.BettingSetup bettingSet)
        {
            ListAccess  la          = new ListAccess();
            List <Game> seasonGames = la.MLBBetPotentials((int)season);
            List <Game> teamGames;
            List <Game> bettingSeries = new List <Game>();
            List <Bet>  bettingOpps   = new List <Bet>();
            bool        hasWon        = false;
            TimeSpan    ts;
            DateTime    previousDate = DateTime.MinValue;
            int         gameCount    = 0;

            foreach (Team team in AppStatic.MLBTeams)
            {
            }
        }
Пример #7
0
        public ActionResult GetGameDates(int seasonId)
        {
            var data = new Object {
            };
            List <string>   gameDatesFormated = new List <string>();
            ListAccess      la    = new ListAccess();
            List <DateTime> games = la.AllSeasonGames(seasonId, (int)AppStatic.Leagues.NBA).Select(g => g.GameDate).Distinct().ToList();

            foreach (DateTime date in games)
            {
                gameDatesFormated.Add(date.ToString("yyyyMMdd", System.Globalization.CultureInfo.CreateSpecificCulture("en-US")));
            }

            data = new { success = true, dates = gameDatesFormated };

            return(Json(data));
        }
Пример #8
0
        public ActionResult ThirdLevCategoryList(string categoryUrl, string subCategoryUrl, string subSubCategoryUrl)
        {
            string url        = HttpContext.Request.RawUrl;
            int    catigoryId = DIYFEHelper.GetCatigoryRowId(categoryUrl, subCategoryUrl, subSubCategoryUrl);

            ListAccess   la    = new ListAccess();
            ArticleModel model = new ArticleModel();

            PageModel.ArticleContent.Title       = model.ArticleContent.Title;
            PageModel.ArticleContent.Description = model.ArticleContent.Description;
            PageModel.ArticleContent.Author      = model.ArticleContent.Author;
            PageModel.ArticleContent.Keywords    = model.ArticleContent.Keywords;

            model.MostViewed    = la.MostViewed(11, 20);
            model.CrumbLinkList = DIYFEHelper.GenerateCrumbLinks(catigoryId, linkPrefix);
            model.ArticleList   = la.ArticleList(catigoryId, 1);

            return(View(model));
        }
Пример #9
0
        public ActionResult ProjectDetails(string html)
        {
            int articleId = 2;

            ListAccess la = new ListAccess();

            ArticleModel model = new ArticleModel();

            model.ArticleContent.LoadArticle(html);
            model.Comments = la.ArticleComments(articleId);

            PageModel.ArticleContent.Title       = model.ArticleContent.Title;
            PageModel.ArticleContent.Description = model.ArticleContent.Description;
            PageModel.ArticleContent.Author      = model.ArticleContent.Author;
            PageModel.ArticleContent.Keywords    = model.ArticleContent.Keywords;


            return(View(model));
        }
Пример #10
0
        public ActionResult FirstLevCategoryList(string categoryUrl)
        {
            ListAccess   la    = new ListAccess();
            ArticleModel model = new ArticleModel();

            model.MostViewed = la.MostViewed(11, 20);
            //model.CrumbLinkList = new List<CustomHtmlLink>();
            //AppStatic.Categories.Where(c => c.CategoryUrl == categoryUrl);
            PageModel.ArticleContent.Title       = model.ArticleContent.Title;
            PageModel.ArticleContent.Description = model.ArticleContent.Description;
            PageModel.ArticleContent.Author      = model.ArticleContent.Author;
            PageModel.ArticleContent.Keywords    = model.ArticleContent.Keywords;

            string url        = HttpContext.Request.RawUrl;
            int    catigoryId = DIYFEHelper.GetCatigoryRowId(categoryUrl, "", "");

            model.CrumbLinkList = DIYFEHelper.GenerateCrumbLinks(catigoryId, linkPrefix);
            model.ArticleList   = la.ArticleList(catigoryId, 1);
            // model.RelatedTreeView = DIYFEHelper.GenerateRelatedTreeView(catigoryId, linkPrefix);

            return(View(model));
        }
Пример #11
0
        public ActionResult Index()
        {
            ArticleModel model = new ArticleModel();

            model.ArticleContent.LoadArticle(5);

            PageModel.ArticleContent.Title       = model.ArticleContent.Title;
            PageModel.ArticleContent.Description = model.ArticleContent.Description;
            PageModel.ArticleContent.Author      = model.ArticleContent.Author;
            PageModel.ArticleContent.Keywords    = model.ArticleContent.Keywords;

            ListAccess la = new ListAccess();

            model.MostViewed = la.MostViewed(11, 20);

            string url        = HttpContext.Request.RawUrl;
            int    catigoryId = DIYFEHelper.GetCatigoryRowId(url);

            model.CrumbLinkList = DIYFEHelper.GenerateCrumbLinks(catigoryId, linkPrefix);
            //model.ArticleList = la.ArticleList(catigoryId, 1);

            return(View(model));
        }
Пример #12
0
        public ActionResult CreateNBABetting(int seasonId)
        {
            var data = new Object {
            };

            ListAccess  la       = new ListAccess();
            List <Game> NBAGames = la.AllSeasonGames(seasonId, 2);

            List <Team> teams         = AppStatic.NBATeams;
            List <Game> gameList      = new List <Game>();
            List <Game> bettingSeries = new List <Game>();
            List <Bet>  bettingOpps   = new List <Bet>();

            TimeSpan ts;
            DateTime previousDate = DateTime.MinValue;

            int gameCount = 0;

            foreach (Team team in teams)
            {
                gameList = NBAGames.Where(g => g.AwayTeamId == team.TeamId && g.AwayTeamConferenceId != g.HomeTeamConferenceId).OrderBy(g => g.GameDate).ToList();
                for (int i = 0; i < gameList.Count(); i++)
                {
                    if (i != 0)
                    {
                        previousDate = gameList[i - 1].GameDate;
                        ts           = gameList[i].GameDate - previousDate;
                        gameCount    = i;
                        try
                        {
                            while (ts.Days <= 3)
                            {
                                bettingSeries.Add(gameList[gameCount - 1]);
                                ts = gameList[gameCount].GameDate - bettingSeries.Last().GameDate;
                                gameCount++;
                                //if (gameCount > gameList.Count)
                                //{ break;  }
                            }
                        }
                        catch (Exception ex)
                        {
                            //probably index out of range error
                        }
                        if (gameCount > i)
                        {
                            i = gameCount - 1;
                        }

                        #region
                        if (bettingSeries.Count >= 2)
                        {
                            Bet bet = new Bet();
                            bet.WinningBetTeamId = bettingSeries[0].AwayTeamId;
                            bet.SeasonId         = bettingSeries[0].SeasonId;
                            bet.BetStatus        = new List <BetStatus>();
                            foreach (Game game in bettingSeries)
                            {
                                switch (bettingSeries.IndexOf(game))
                                {
                                case 0:
                                    bet.BetADate   = game.GameDate;
                                    bet.BetAGameId = game.GameId;
                                    if (game.WinningTeamId == game.AwayTeamId)
                                    {
                                        //bet.WinningBet = "A";
                                        bet.BetStatus.Add(new BetStatus {
                                            BetStatusTypeId = 1
                                        });
                                        // bet.LosingBetTeamId = game.HomeTeamId;
                                    }
                                    break;

                                case 1:
                                    bet.BetBDate   = game.GameDate;
                                    bet.BetBGameId = game.GameId;
                                    if (game.WinningTeamId == game.AwayTeamId)
                                    {
                                        //bet.WinningBet = "B";
                                        bet.BetStatus.Add(new BetStatus {
                                            BetStatusTypeId = 3
                                        });
                                        //bet.LosingBetTeamId = game.HomeTeamId;
                                    }
                                    break;

                                case 2:
                                    bet.BetCDate   = game.GameDate;
                                    bet.BetCGameId = game.GameId;
                                    if (game.WinningTeamId == game.AwayTeamId)
                                    {
                                        //bet.WinningBet = "C";
                                        bet.BetStatus.Add(new BetStatus {
                                            BetStatusTypeId = 5
                                        });
                                        // bet.LosingBetTeamId = game.HomeTeamId;
                                    }
                                    break;

                                case 3:
                                    bet.BetDDate   = game.GameDate;
                                    bet.BetDGameId = game.GameId;
                                    if (game.WinningTeamId == game.AwayTeamId)
                                    {
                                        //bet.WinningBet = "C";
                                        bet.BetStatus.Add(new BetStatus {
                                            BetStatusTypeId = 7
                                        });
                                        // bet.LosingBetTeamId = game.HomeTeamId;
                                    }
                                    break;
                                }
                            }
                            if (bet.BetStatus.Count() == 0)
                            {
                                if (bet.BetCDate.HasPlayed())
                                {
                                    bet.WinningBet      = "Loss";
                                    bet.LosingBetTeamId = bet.WinningBetTeamId;
                                    bet.BetStatus.Add(new BetStatus {
                                        BetStatusTypeId = 26
                                    });
                                }
                            }

                            bet.InsertBet();

                            // gameCount = 0;
                        }

                        #endregion

                        bettingSeries.Clear();
                    }
                }
                gameList.Clear();
            }


            //foreach (Team team in teams)
            //{
            //    gameList = NBAGames.Where(g => g.AwayTeamId == team.TeamId && g.AwayTeamConferenceId != g.HomeTeamConferenceId).OrderBy(g => g.GameDate).ToList();

            //    for (int i = 0; i < gameList.Count(); i++)
            //    {
            //        if (i != 0)
            //        {
            //            previousDate = gameList[i - 1].GameDate;
            //            ts = gameList[i].GameDate - previousDate;
            //            if (ts.Days <= 3)
            //            {
            //                gameCount++;
            //                if (gameCount >= 2)
            //                {
            //                    if (i - 2 >= 0)
            //                    {
            //                        bettingSeries.Add(gameList[i - 2]);
            //                    }
            //                    bettingSeries.Add(gameList[i - 1]);
            //                    bettingSeries.Add(gameList[i]);

            //                    Bet bet = new Bet();
            //                    bet.WinningBetTeamId = bettingSeries[0].AwayTeamId;
            //                    bet.SeasonId = bettingSeries[0].SeasonId;
            //                    bet.BetStatus = new List<BetStatus>();
            //                    foreach (Game game in bettingSeries)
            //                    {
            //                        switch (bettingSeries.IndexOf(game))
            //                        {
            //                            case 0:
            //                                bet.BetADate = game.GameDate;
            //                                bet.BetAGameId = game.GameId;
            //                                if (game.WinningTeamId == game.AwayTeamId)
            //                                {
            //                                    //bet.WinningBet = "A";
            //                                    bet.BetStatus.Add(new BetStatus { BetStatusTypeId = 1 });
            //                                   // bet.LosingBetTeamId = game.HomeTeamId;
            //                                }
            //                                break;
            //                            case 1:
            //                                bet.BetBDate = game.GameDate;
            //                                bet.BetBGameId = game.GameId;
            //                                if (game.WinningTeamId == game.AwayTeamId)
            //                                {
            //                                    //bet.WinningBet = "B";
            //                                    bet.BetStatus.Add(new BetStatus { BetStatusTypeId = 3 });
            //                                    //bet.LosingBetTeamId = game.HomeTeamId;
            //                                }
            //                                break;
            //                            case 2:
            //                                bet.BetCDate = game.GameDate;
            //                                bet.BetCGameId = game.GameId;
            //                                if (game.WinningTeamId == game.AwayTeamId)
            //                                {
            //                                    //bet.WinningBet = "C";
            //                                    bet.BetStatus.Add(new BetStatus { BetStatusTypeId = 5 });
            //                                   // bet.LosingBetTeamId = game.HomeTeamId;
            //                                }
            //                                break;
            //                        }
            //                    }
            //                    if (bet.BetStatus.Count() == 0)
            //                    {
            //                        if (bet.BetCDate.HasPlayed())
            //                        {
            //                            bet.WinningBet = "Loss";
            //                            bet.LosingBetTeamId = bet.WinningBetTeamId;
            //                            bet.BetStatus.Add(new BetStatus { BetStatusTypeId = 26 });
            //                        }
            //                    }

            //                    bet.InsertBet();

            //                    gameCount = 0;
            //                    bettingSeries.Clear();
            //                    //bet.BetADate = bettingSeries[0].GameDate;
            //                    //bet.BetBDate = bettingSeries[1].GameDate;
            //                    //if (bettingSeries.Count() > 2)
            //                    //{
            //                    //    bet.BetCDate = bettingSeries[2].GameDate;
            //                    //}

            //                }
            //            }
            //            else
            //            {
            //                gameCount = 0;
            //                bettingSeries.Clear();
            //            }
            //        }
            //    }

            //    gameList.Clear();
            //}


            data = new { success = true };

            return(Json(data));
        }
Пример #13
0
        public ActionResult InsertNBABetting(int seasonId)
        {
            var data = new Object {
            };

            ListAccess  la       = new ListAccess();
            List <Game> NBAGames = la.AllSeasonGames(seasonId, 2);

            List <Team> teams         = AppStatic.NBATeams;
            List <Game> gameList      = new List <Game>();
            List <Game> bettingSeries = new List <Game>();
            List <Bet>  bettingOpps   = new List <Bet>();

            TimeSpan ts;
            DateTime previousDate = DateTime.MinValue;

            int gameCount = 0;

            foreach (Team team in teams)
            {
                gameList = NBAGames.Where(g => g.AwayTeamId == team.TeamId && g.AwayTeamConferenceId != g.HomeTeamConferenceId).OrderBy(g => g.GameDate).ToList();

                for (int i = 0; i < gameList.Count(); i++)
                {
                    if (i != 0)
                    {
                        previousDate = gameList[i - 1].GameDate;
                        ts           = gameList[i].GameDate - previousDate;
                        if (ts.Days <= 3)
                        {
                            gameCount++;
                            if (gameCount >= 2)
                            {
                                if (i - 2 >= 0)
                                {
                                    bettingSeries.Add(gameList[i - 2]);
                                }
                                bettingSeries.Add(gameList[i - 1]);
                                bettingSeries.Add(gameList[i]);

                                Bet bet = new Bet();
                                bet.WinningBetTeamId = bettingSeries[0].AwayTeamId;
                                bet.SeasonId         = bettingSeries[0].SeasonId;
                                bet.BetStatus        = new List <BetStatus>();
                                foreach (Game game in bettingSeries)
                                {
                                    switch (bettingSeries.IndexOf(game))
                                    {
                                    case 0:
                                        bet.BetADate   = game.GameDate;
                                        bet.BetAGameId = game.GameId;
                                        if (game.WinningTeamId == game.AwayTeamId)
                                        {
                                            bet.WinningBet = "A";
                                            bet.BetStatus.Add(new BetStatus {
                                                BetStatusTypeId = 1
                                            });
                                            bet.LosingBetTeamId = game.HomeTeamId;
                                        }
                                        break;

                                    case 1:
                                        bet.BetBDate   = game.GameDate;
                                        bet.BetBGameId = game.GameId;
                                        if (game.WinningTeamId == game.AwayTeamId)
                                        {
                                            bet.WinningBet = "B";
                                            bet.BetStatus.Add(new BetStatus {
                                                BetStatusTypeId = 3
                                            });
                                            bet.LosingBetTeamId = game.HomeTeamId;
                                        }
                                        break;

                                    case 2:
                                        bet.BetCDate   = game.GameDate;
                                        bet.BetCGameId = game.GameId;
                                        if (game.WinningTeamId == game.AwayTeamId)
                                        {
                                            bet.WinningBet = "C";
                                            bet.BetStatus.Add(new BetStatus {
                                                BetStatusTypeId = 5
                                            });
                                            bet.LosingBetTeamId = game.HomeTeamId;
                                        }
                                        break;
                                    }
                                }
                                if (bet.BetStatus.Count() == 0)
                                {
                                    if (bet.BetCDate.HasPlayed())
                                    {
                                        bet.WinningBet      = "Loss";
                                        bet.LosingBetTeamId = bet.WinningBetTeamId;
                                        bet.BetStatus.Add(new BetStatus {
                                            BetStatusTypeId = 26
                                        });
                                    }
                                }

                                bet.InsertBet();

                                gameCount = 0;
                                bettingSeries.Clear();
                                //bet.BetADate = bettingSeries[0].GameDate;
                                //bet.BetBDate = bettingSeries[1].GameDate;
                                //if (bettingSeries.Count() > 2)
                                //{
                                //    bet.BetCDate = bettingSeries[2].GameDate;
                                //}
                            }
                        }
                        else
                        {
                            gameCount = 0;
                            bettingSeries.Clear();
                        }
                    }
                }

                gameList.Clear();
            }


            data = new { success = true };

            return(Json(data));
        }
Пример #14
0
        public static List <CustomHtmlLink> GenerateRelatedTreeView(int categoryRowId, string linkPrefix)
        {
            List <CustomHtmlLink> linkList = new List <CustomHtmlLink>();
            ListAccess            la       = new ListAccess();
            Category cat = AppStatic.Categories
                           .Where(c => c.CategoryRowId == categoryRowId)
                           .FirstOrDefault();

            linkList.Add(new CustomHtmlLink
            {
                LinkText = cat.CategoryName,
                Href     = AppStatic.BaseSiteUrl + linkPrefix + "/" + cat.CategoryUrl,
                Title    = cat.CategoryName,
                SubLinks = GenerateTreeViewSecondLev(categoryRowId, linkPrefix)    //la.RelatedArticleLinks(cat, linkPrefix, 3)
            });

            //if (!String.IsNullOrEmpty(cat.ThirdLevCategoryUrl))
            //{
            //    CustomHtmlLink htmlLink = new CustomHtmlLink
            //    {
            //        LinkText = cat.ThirdLevCategoryName,
            //        Href = "/" + linkPrefix + "/" + cat.CategoryUrl + "/" + cat.SecondLevCategoryUrl + "/" + cat.ThirdLevCategoryUrl,
            //        Title = cat.ThirdLevCategoryName,
            //        SubLinks = la.RelatedArticleLinks(cat, linkPrefix, 3)
            //    };
            //    //linkList[0].SubLinks=la.RelatedArticleLinks(cat, linkPrefix, 3);

            //    List<Category> secondLevelCats = AppStatic.Categories
            //                                    .Where(c => c.SecondLevCategoryId == cat.SecondLevCategoryId
            //                                    && c.CategoryRowId != categoryRowId).ToList();
            //    foreach (Category _cat in secondLevelCats)
            //    {
            //        //linkList.Add(new CustomHtmlLink
            //        //{
            //        //    LinkText = _cat.SecondLevCategoryName,
            //        //    Href = "/" + linkPrefix + "/" + _cat.CategoryUrl + "/" + _cat.SecondLevCategoryUrl,
            //        //    Title = _cat.SecondLevCategoryName + "-category",
            //        //});

            //        //(!String.IsNullOrEmpty(_cat.ThirdLevCategoryUrl))
            //        //{

            //        //}

            //        //linkList.Last().SubLinks = la.RelatedArticleLinks(_cat, linkPrefix);
            //    }
            //    return linkList;
            //}

            //if (!String.IsNullOrEmpty(cat.SecondLevCategoryUrl))
            //{
            //    List<Category> secondLevelCats = AppStatic.Categories
            //                                    .Where(c => c.CategoryId == cat.CategoryId).ToList();
            //    foreach (Category _cat in secondLevelCats)
            //    {
            //        linkList.Add(new CustomHtmlLink
            //        {
            //            LinkText = _cat.CategoryName,
            //            Href = "/" + linkPrefix + "/" + _cat.CategoryUrl,
            //            Title = _cat.CategoryName
            //        });
            //        if (!String.IsNullOrEmpty(_cat.ThirdLevCategoryUrl))
            //        {
            //            linkList.Last().SubLinks = GenerateRelatedTreeView(_cat.CategoryRowId, linkPrefix);
            //        }
            //        else
            //        {
            //            linkList.Last().SubLinks = la.RelatedArticleLinks(_cat, linkPrefix, 3);
            //        }
            //    }
            //    return linkList;
            //}

            //ListAccess la = new ListAccess();
            //linkList = la.RelatedLinks(cat, linkPrefix);

            return(linkList);
        }
Пример #15
0
        public static void ExcelFormat(this SeasonBets sBets, AppStatic.Seasons season, AppStatic.BettingSetup bettingSet)
        {
            ListAccess  la          = new ListAccess();
            List <Game> seasonGames = la.AllSeasonGames((int)season, (int)AppStatic.Leagues.NBA);
            List <Game> teamGames;
            List <Game> bettingSeries = new List <Game>();
            List <Bet>  bettingOpps   = new List <Bet>();
            bool        hasWon        = false;
            TimeSpan    ts;
            DateTime    previousDate = DateTime.MinValue;
            int         gameCount    = 0;

            foreach (Team team in AppStatic.NBATeams)
            {
                teamGames = seasonGames.Where(sg => sg.AwayTeamId == team.TeamId || sg.HomeTeamId == team.TeamId).OrderBy(sg => sg.GameDate).ToList();
                for (int i = 0; i < teamGames.Count(); i++)
                {
                    while (i < teamGames.Count() && teamGames[i].AwayTeamId == team.TeamId)// && bettingSeries.Count <= 3)
                    {
                        if (teamGames[i].GameId == 105651)
                        {
                            var testOne = true;
                        }
                        if (teamGames[i].GameId == 105651)
                        {
                            var testOne = true;
                        }
                        bettingSeries.Add(teamGames[i]);
                        i++;
                    }

                    if (bettingSeries.Count >= 3)
                    {
                        //i--;
                        Bet bet = new Bet();
                        bet.BetGames = new List <Game>();
                        bet.BetGames.AddRange(bettingSeries);
                        bet.BetADate = bettingSeries[0].GameDate;
                        foreach (Game game in bettingSeries)
                        {
                            if (game.AwayTeamId == game.WinningTeamId)
                            {
                                if (game.AwayTeamSpread < 0)
                                {
                                    int dif = game.HomeTeamScore - game.AwayTeamScore;
                                    if (dif <= game.AwayTeamSpread)
                                    {
                                        hasWon = true;
                                    }
                                }
                                else
                                {
                                    hasWon = true;
                                }
                            }
                            else
                            {
                                if (game.AwayTeamSpread > 0 && (game.HomeTeamScore - game.AwayTeamScore) <= game.AwayTeamSpread && game.WinningTeamId != 0)
                                {
                                    hasWon = true;
                                }
                            }

                            if (hasWon)
                            {
                                int winIndex = bettingSeries.IndexOf(game);
                                switch (winIndex)
                                {
                                case 0:
                                    bet.WinA = true;
                                    sBets.TotalA++;
                                    break;

                                case 1:
                                    bet.WinB = true;
                                    sBets.TotalB++;
                                    break;

                                case 2:
                                    bet.WinC = true;
                                    sBets.TotalC++;
                                    break;

                                case 3:
                                    bet.WinD = true;
                                    sBets.TotalD++;
                                    break;
                                }
                                break;
                            }
                            else
                            {
                                bet.Loss = true;
                            }
                        }
                        if (!hasWon)
                        {
                            sBets.TotalGroupLoss++;
                        }
                        bet.BetId = sBets.Bets.Count + 1;
                        sBets.Bets.Add(bet);
                        hasWon = false;
                        bettingSeries.Clear();

                        #region
                        //switch (bettingSet)
                        //{
                        //    //case AppStatic.BettingSetup.MoneyLine:
                        //    //    foreach (Game game in bettingSeries)
                        //    //    {
                        //    //        if (game.AwayTeamId == game.WinningTeamId)
                        //    //        {

                        //    //        }
                        //    //    }

                        //    //    break;
                        //    //case AppStatic.BettingSetup.Spread:
                        //    //    break;
                        //    //case AppStatic.BettingSetup.Spread3Point:
                        //    //    break;

                        //}
                        #endregion

                        #region
                        //if (bettingSeries.Count >= 2)
                        //{
                        //    Bet bet = new Bet();
                        //    bet.WinningBetTeamId = bettingSeries[0].AwayTeamId;
                        //    bet.SeasonId = bettingSeries[0].SeasonId;
                        //    bet.BetStatus = new List<BetStatus>();
                        //    foreach (Game game in bettingSeries)
                        //    {
                        //        switch (bettingSeries.IndexOf(game))
                        //        {
                        //            case 0:
                        //                bet.BetADate = game.GameDate;
                        //                bet.BetAGameId = game.GameId;
                        //                if (game.WinningTeamId == game.AwayTeamId)
                        //                {
                        //                    //bet.WinningBet = "A";
                        //                    bet.BetStatus.Add(new BetStatus { BetStatusTypeId = 1 });
                        //                    // bet.LosingBetTeamId = game.HomeTeamId;
                        //                }
                        //                break;
                        //            case 1:
                        //                bet.BetBDate = game.GameDate;
                        //                bet.BetBGameId = game.GameId;
                        //                if (game.WinningTeamId == game.AwayTeamId)
                        //                {
                        //                    //bet.WinningBet = "B";
                        //                    bet.BetStatus.Add(new BetStatus { BetStatusTypeId = 3 });
                        //                    //bet.LosingBetTeamId = game.HomeTeamId;
                        //                }
                        //                break;
                        //            case 2:
                        //                bet.BetCDate = game.GameDate;
                        //                bet.BetCGameId = game.GameId;
                        //                if (game.WinningTeamId == game.AwayTeamId)
                        //                {
                        //                    //bet.WinningBet = "C";
                        //                    bet.BetStatus.Add(new BetStatus { BetStatusTypeId = 5 });
                        //                    // bet.LosingBetTeamId = game.HomeTeamId;
                        //                }
                        //                break;
                        //            case 3:
                        //                bet.BetDDate = game.GameDate;
                        //                bet.BetDGameId = game.GameId;
                        //                if (game.WinningTeamId == game.AwayTeamId)
                        //                {
                        //                    //bet.WinningBet = "C";
                        //                    bet.BetStatus.Add(new BetStatus { BetStatusTypeId = 7 });
                        //                    // bet.LosingBetTeamId = game.HomeTeamId;
                        //                }
                        //                break;
                        //        }
                        //    }
                        //    if (bet.BetStatus.Count() == 0)
                        //    {
                        //        if (bet.BetCDate.HasPlayed())
                        //        {
                        //            bet.WinningBet = "Loss";
                        //            bet.LosingBetTeamId = bet.WinningBetTeamId;
                        //            bet.BetStatus.Add(new BetStatus { BetStatusTypeId = 26 });
                        //        }
                        //    }

                        //    bet.InsertBet();

                        // gameCount = 0;
                        //}

                        #endregion
                    }
                    else
                    {
                        bettingSeries.Clear();
                    }
                }
                teamGames.Clear();
            }
            sBets.Bets = sBets.Bets.OrderBy(b => b.BetADate).ToList();
            //TODAY'S BETS
            sBets.TodaysBets = sBets.Bets.SelectMany(g => g.BetGames)
                               .Where(g => g.GameDate.ToShortDateString() == DateTime.Today.ToShortDateString() && g.GameStatusTypeId == 1).ToList();
            sBets.TomorrowBets = sBets.Bets.SelectMany(g => g.BetGames).Where(g => g.GameDate.ToShortDateString() == DateTime.Today.AddDays(1).ToShortDateString() && g.GameStatusTypeId == 1).ToList();

            int bankOne          = 800;
            int bankOneWinAmount = 100;
            int bankOneIndex     = 1;

            int bankTwo          = 800;
            int bankTwoWinAmount = 100;
            int bankTwoIndex     = 1;

            int bankThree          = 800;
            int bankThreeWinAmount = 100;
            int bankThreeIndex     = 1;

            int bankBetIndex = 1;

            int tempA = 0;
            int tempB = 0;
            int tempC = 0;

            foreach (Bet bet in sBets.Bets)
            {
                if (bankBetIndex == 3)
                {
                    bankBetIndex = 1;
                }
                else
                {
                    bankBetIndex++;
                }

                if (!bet.Loss)
                {
                    switch (bankBetIndex)
                    {
                    case 1:
                        bankOne = bankOne + bankOneWinAmount;
                        tempC   = (int)(Math.Round(bankOne * .1) / 2);
                        tempB   = (int)(Math.Round(tempC * .1) / 2);
                        tempA   = (int)(Math.Round(tempB * .1) / 2);

                        break;

                    case 2:
                        bankTwo = bankTwo + bankTwoWinAmount;

                        break;

                    case 3:
                        bankThree = bankThree + bankThreeWinAmount;

                        break;
                    }
                }
            }

            //List<Game> games = la.AllSeasonGames((int)AppStatic.Seasons._2011, (int)AppStatic.Leagues.NBA);
            //int[] teamIds = games.Select(g => g.AwayTeamId);
        }