示例#1
0
        public ActionResult ShowGameInfo(int? type, int? link, int? gameDate, int? occasionNo, int? teamID, int? gameID, string lstGameID, int? leagueType = 0, int? round = 0, bool withScoreDetails = false, int seasonId = 0)
        {
            IEnumerable<JlgGameInfos> lstGame = default(IEnumerable<JlgGameInfos>);
            ViewBag.Type = type;
            ViewBag.Link = link;
            var lstgId = new List<int>();

            long memberId = this.GetMemberId();

            if (type == 5)
            {
                int? gDate = jlg.ScheduleInfo.Where(m => m.GameDate > gameDate.Value).Min(m => m.GameDate);
                lstGame = GetGameInfo(gDate, occasionNo, teamID, null, null, 0, 0, withScoreDetails, memberId, seasonId);
            }
            else
            {
                //Convert string to list
                if (type == 6 && !string.IsNullOrEmpty(lstGameID))
                {
                    List<string> listofIDs = lstGameID.Split(',').ToList();
                    lstgId = listofIDs.Select(int.Parse).ToList();
                    lstGame = GetGameInfo(gameDate, occasionNo, teamID, gameID, lstgId, 0, 0, withScoreDetails, memberId, seasonId);
                }
                else
                {
                    lstGame = GetGameInfo(gameDate, occasionNo, teamID, gameID, null, leagueType, round, withScoreDetails, memberId, seasonId);
                }
            }

            if (lstGame != null && lstGame.Any())
            {
                lstGame.ForEach(x => x.ParameterInfo = new JlgGameInfos.ParameterInfoModel
                {
                    ParameterType = type,
                    Link = link,
                    GameDate = gameDate,
                    OccasionNo = occasionNo,
                    TeamId = teamID,
                    GameId = gameID,
                    LstGameId = lstGameID,
                    LeagueType = leagueType,
                    Round = round,
                    WithScoreDetail = withScoreDetails
                });

                var jlsService = new JlgService();
                foreach (var game in lstGame)
                {
                    occasionNo = jlsService.GetOccasionNo(game.GameDate, game.GameKindID);
                    game.OccasionNo = occasionNo ?? 0;

                    //Phase3#2000~2002 試合情報パネル対応
                    //スコア情報を読み込む
                    if (withScoreDetails)
                        game.ScoreDetails = this.GetScoreDetails(game.GameID);
                }
            }

            if (type == 5)  // 次節の試合情報
            {
                return PartialView("_JlgNextGames", lstGame);
            }

            if (withScoreDetails)
                return PartialView("_JlgGameCard", lstGame);
            else
                return PartialView("_JlgGameInfo", lstGame);
        }
        public ActionResult Index()
        {
            var jlgService = new JlgService();

            var jType = jlgService.GetJlgType(Request.Url.AbsoluteUri);

            //Jリーグ初期表示用viewModel
            var jlgScheduleResultViewModel = new JlgScheduleResultViewModel();

            jlgScheduleResultViewModel.JType = jType;

            var gameKindDictionary = GetGameKind(jType);

            var pageSettingsDictionary = GetPageSettings(jType);

            jlgScheduleResultViewModel.JLeagueMenu = Convert.ToInt32(pageSettingsDictionary[JLeagueMenuKey]);

            jlgScheduleResultViewModel.JLeagueSubMenu = 2;

            jlgScheduleResultViewModel.PageName = Convert.ToString(pageSettingsDictionary[PageNameKey]);

            jlgScheduleResultViewModel.PageTitle = Convert.ToString(pageSettingsDictionary[PageTitleKey]);

            jlgScheduleResultViewModel.GameKind = Convert.ToInt32(gameKindDictionary[GameKindKey]);

            jlgScheduleResultViewModel.GameKindName = Convert.ToString(gameKindDictionary[GameKindNameKey]);

            jlgScheduleResultViewModel.OccasionNo = jlgService.GetOccasionNo(DateTime.Now.ParseToInt(), jlgScheduleResultViewModel.GameKind);

            jlgScheduleResultViewModel.MaxOccasionNo = GetMaxOccasionNoByGameKind(jlgScheduleResultViewModel.GameKind);

            jlgScheduleResultViewModel.SeasonId = jlgService.GetSeasonId(DateTime.Now.ParseToInt(), jlgScheduleResultViewModel.GameKind);

            if (jType == JlgConst.JType.Jleaguecup)
            {
                //Todo:決勝ラウンド開放までの一時対応
                jlgScheduleResultViewModel.SeasonId = 4;
                jlgScheduleResultViewModel.OccasionNo = 1;

                //最終ラウンド用
                var queryNb = (from si in jlgEntities.ScheduleInfo
                               join gcat in jlgEntities.GameCategory on si.GameCategoryId equals gcat.GameCategoryId
                               join gs in jlgEntities.GameSchedule on gcat.GameScheduleId equals gs.GameScheduleId
                               where gs.GameKindID == JlgConstants.JLG_GAMEKIND_NABISCO
                               where si.GameCategoryId == JlgConstants.JLG_GAMECATEGORY_NABISCO_FINAL
                               select new JlgScheduleResultNabiscoInfoModel
                               {
                                   finalRoundName = si.RoundName,
                                   finalRound = (int)si.Round,
                                   finalOccasion = (int)si.OccasionNo
                               }).ToList();
                List<JlgScheduleResultNabiscoInfoModel> ScheduleInfoNb = queryNb;
                var FinalCnt = GetFinalOcasionCnt();
                jlgScheduleResultViewModel.finalCnt = (int)FinalCnt;
            }

            return View(jlgScheduleResultViewModel);
        }