Пример #1
0
        // Todo Serviceに移動
        /// <summary>
        /// 予想一覧向け試合情報の取得
        /// </summary>
        /// <param name="memberId"></param>
        /// <param name="target_year"></param>
        /// <param name="target_month"></param>
        /// <param name="target_date"></param>
        /// <returns></returns>
        public static IEnumerable<GameInfoModel> GetGameInfo(Int64 memberId, int target_year, int target_month, int target_date = 0, int sportsId = 0)
        {
            bool articleDispFlg;

            List<GameInfoModel> result;

            OddsService oddsService = new OddsService();

            #region 情報取得する日付の開始と終了を取得し、投稿記事のリンク表示フラグを設定する
            DateTime startDate;
            DateTime endDate;
            switch (target_date)
            {
                // 日付指定がない場合
                case 0:
                    // 当月最初の日付を取得
                    startDate = Convert.ToDateTime(target_year + "/" + target_month + "/01 00:00:00");
                    // 当月の最後の日付を取得
                    endDate = Convert.ToDateTime(target_year + "/" + target_month + "/01 23:59:59").AddMonths(1).AddDays(-1);
                    // 投稿記事を表示
                    articleDispFlg = true;
                    break;
                // 日付指定の場合
                default:
                    // 指定日の前日を取得
                    startDate = Convert.ToDateTime(target_year + "/" + target_month + "/" + target_date + " 00:00:00");
                    // 指定日を取得
                    endDate = Convert.ToDateTime(target_year + "/" + target_month + "/" + target_date + " 23:59:59");
                    // 投稿記事を表示
                    articleDispFlg = false;
                    break;
            }

            int startDateInt = startDate.ParseToInt();
            int endDateInt = endDate.ParseToInt();
            #endregion

            //NPBゲームの取得
            List<GameInfoModel> nbpGames = null;
            IEnumerable<GameInfoViewModelForNBP> npbTmp = null;

            if (sportsId == 0 || sportsId == Constants.NPB_SPORT_ID)
            {
                //予想情報の取得
                var npbExpectTargets = GetPointOfUser(memberId, Constants.NPB_SPORT_ID, startDate, endDate);

                if (npbExpectTargets != null)
                {
                    var npbGameIds = (from t in npbExpectTargets select t.GameID).Distinct().ToList();
                    NpbTopController NpbCtl = new NpbTopController();
                    npbTmp = NpbCtl.GetGameInfo(null, startDateInt, endDateInt, null, null, npbGameIds);
                }

                //TODO GetGameInfoで日付を指定するからには、NULLだった場合の対処が必要ではないか?
                if (npbTmp != null)
                {
                    nbpGames = (from g in npbTmp.ToList()
                                join e in npbExpectTargets on g.GameID equals e.GameID
                                select new GameInfoModel
                                {
                                    TargetYear = target_year,
                                    TargetMonth = target_month,
                                    StartScheduleDate = e.StartScheduleDate,
                                    SportsID = e.SportsID,
                                    ExpectTargetID = e.ExpectTargetID,
                                    GameID = g.GameID,
                                    TeamName = e.BetSelectID == 1 ? g.HomeTeamName : e.BetSelectID == 2 ? g.VisitorTeamName : "引き分け",
                                    TeamNameS = e.BetSelectID == 1 ? g.HomeTeamNameS : e.BetSelectID == 2 ? g.VisitorTeamNameS : "引き分け",
                                    Url = "/npb/game/" + g.GameID + "",
                                    UrlArticle = "/mypage/article/",
                                    HomeTeamName = g.HomeTeamName,
                                    HomeTeamID = g.HomeTeamID,
                                    HomeTeamS = g.HomeTeamNameS,
                                    VisitorTeamName = g.VisitorTeamName,
                                    VisitorTeamS = g.VisitorTeamNameS,
                                    VisitorTeamID = g.VisitorTeamID,
                                    HomeTeamIcon = g.HomeTeamIcon,
                                    VisitorTeamIcon = g.VisitorTeamIcon,
                                    HomeTeamRanking = g.HomeTeamRanking,
                                    VisitorTeamRanking = g.VisitorTeamRanking,
                                    HomeTeamWin = g.HomeTeamWin,
                                    VisitorTeamWin = g.VisitorTeamWin,
                                    HomeTeamUrl = "/npb/teams/" + g.HomeTeamID + "",
                                    VisitorTeamUrl = "/npb/teams/" + g.VisitorTeamID + "",
                                    HomeScore = Convert.ToString(g.HomeTeamScore),
                                    VisitorScore = Convert.ToString(g.VisitorTeamScore),
                                    GameDateScheduled = g.GameDate,
                                    GameTimeScheduled = g.Time,
                                    OddsInfoModel = oddsService.GetOddsInfoByGameID(Constants.NPB_SPORT_ID, g.GameID, memberId),
                                    PreForeRunnerNameSH = g.PreForeRunnerNameSH,
                                    PreForeRunnerEraH = g.PreForeRunnerEraH,
                                    PreForeRunnerNameSV = g.PreForeRunnerNameSV,
                                    PreForeRunnerEraV = g.PreForeRunnerEraV,
                                    ForeRunnerNameSH = g.ForeRunnerNameSH,
                                    ForeRunnerEraH = g.ForeRunnerEraH,
                                    ForeRunnerNameSV = g.ForeRunnerNameSV,
                                    ForeRunnerEraV = g.ForeRunnerEraV,
                                    WinLoseNameSH = g.WinLoseNameSH,
                                    WinLoseEraH = g.WinLoseEraH,
                                    WinLoseNameSV = g.WinLoseNameSV,
                                    WinLoseEraV = g.WinLoseEraV,
                                    IsWinH = g.IsWinH,
                                    IsWinV = g.IsWinV,
                                    WinLoseTextH = g.WinLoseTextH,
                                    WinLoseTextV = g.WinLoseTextV,

                                    WinLose = Convert.ToInt16(e.VorD), //勝敗1:勝ち 2:負け,
                                    BetSelectID = e.BetSelectID,
                                    SituationStatus = e.SituationStatus,
                                    ExpectPoint1 = e.ExpectPoint,
                                    StartDt = startDate

                                }).ToList();
                }
            }

            //MLBゲームの取得
            List<GameInfoModel> mlbGames = null;
            IEnumerable<GameInfoViewModelForMLB> mlbTmp = null;

            if (sportsId == 0 || sportsId == Constants.MLB_SPORT_ID)
            {
                var mlbExpectTargets = GetPointOfUser(memberId, Constants.MLB_SPORT_ID, startDate, endDate);

                if (mlbExpectTargets != null)
                {
                    MlbTopController MlbCtl = new MlbTopController();
                    var mlbGameIds = (from t in mlbExpectTargets select t.GameID).Distinct().ToList();

                    if (mlbGameIds != null)
                        mlbTmp = MlbCtl.GetGameInfo(null, startDateInt, endDateInt, null, null, mlbGameIds);
                }

                //TODO GetGameInfoで日付を指定するからには、NULLだった場合の対処が必要ではないか?
                if (mlbTmp != null)
                {
                    mlbGames = (from g in mlbTmp.ToList()
                                join e in mlbExpectTargets on g.GameID equals e.GameID
                                select new GameInfoModel
                                {
                                    TargetYear = target_year,
                                    TargetMonth = target_month,
                                    StartScheduleDate = e.StartScheduleDate,
                                    SportsID = e.SportsID,
                                    ExpectTargetID = e.ExpectTargetID,
                                    GameID = g.GameID,
                                    TeamName = e.BetSelectID == 1 ? g.HomeTeamName : e.BetSelectID == 2 ? g.VisitorTeamName : "引き分け",
                                    TeamNameS = e.BetSelectID == 1 ? g.HomeTeamNameS : e.BetSelectID == 2 ? g.VisitorTeamNameS : "引き分け",
                                    Url = "/mlb/game/" + g.GameID + "",
                                    UrlArticle = "/mypage/article/",
                                    HomeTeamName = g.HomeTeamName,
                                    HomeTeamID = g.HomeTeamID,
                                    HomeTeamS = g.HomeTeamNameS,
                                    VisitorTeamName = g.VisitorTeamName,
                                    VisitorTeamS = g.VisitorTeamNameS,
                                    VisitorTeamID = g.VisitorTeamID,
                                    HomeTeamIcon = g.HomeTeamIcon,
                                    VisitorTeamIcon = g.VisitorTeamIcon,
                                    HomeTeamRanking = g.HomeTeamRanking,
                                    VisitorTeamRanking = g.VisitorTeamRanking,
                                    HomeTeamWin = g.HomeTeamWin,
                                    VisitorTeamWin = g.VisitorTeamWin,
                                    HomeTeamUrl = "/mlb/teams/" + g.HomeTeamID + "",
                                    VisitorTeamUrl = "/mlb/teams/" + g.VisitorTeamID + "",
                                    HomeScore = Convert.ToString(g.HomeTeamScore),
                                    VisitorScore = Convert.ToString(g.VisitorTeamScore),
                                    GameDateScheduled = g.GameDate,
                                    GameTimeScheduled = g.Time,
                                    OddsInfoModel = oddsService.GetOddsInfoByGameID(Constants.MLB_SPORT_ID, g.GameID, memberId),
                                    PreForeRunnerNameSH = g.PreForeRunnerNameSH,
                                    PreForeRunnerNameSV = g.PreForeRunnerNameSV,
                                    ForeRunnerNameSH = g.ForeRunnerNameSH,
                                    ForeRunnerNameSV = g.ForeRunnerNameSV,

                                    WinLose = Convert.ToInt16(e.VorD), //勝敗1:勝ち 2:負け,
                                    BetSelectID = e.BetSelectID,
                                    SituationStatus = e.SituationStatus,
                                    ExpectPoint1 = e.ExpectPoint,
                                    StartDt = startDate

                                }).ToList();
                }
            }

            //JLGゲームの取得
            List<GameInfoModel> jlgGames = null;
            IEnumerable<JlgGameInfos> jlgTmp = null;

            if (sportsId == 0 || sportsId == Constants.JLG_SPORT_ID)
            {
                var jlgExpectTargets = GetPointOfUser(memberId, Constants.JLG_SPORT_ID, startDate, endDate);

                if (jlgExpectTargets != null)
                {
                    JlgTopController jlgCtl = new JlgTopController();
                    var jlgGameIds = (from t in jlgExpectTargets select t.GameID).Distinct().ToList();

                    if (jlgGameIds != null)
                        jlgTmp = jlgCtl.GetGameInfoByDate(null, startDateInt, endDateInt, null, null, jlgGameIds);
                }

                //TODO GetGameInfoで日付を指定するからには、NULLだった場合の対処が必要ではないか?
                if (jlgTmp != null)
                {
                    jlgGames = (from g in jlgTmp.ToList()
                                join e in jlgExpectTargets on g.GameID equals e.GameID
                                select new GameInfoModel
                                {
                                    TargetYear = target_year,
                                    TargetMonth = target_month,
                                    StartScheduleDate = e.StartScheduleDate,
                                    SportsID = e.SportsID,
                                    ExpectTargetID = e.ExpectTargetID,
                                    GameID = g.GameID,
                                    TeamName = e.BetSelectID == 1 ? g.HomeTeamName : e.BetSelectID == 2 ? g.AwayTeamName : "引き分け",
                                    TeamNameS = e.BetSelectID == 1 ? g.HomeTeamNameS : e.BetSelectID == 2 ? g.AwayTeamNameS : "引き分け",
                                    Url = "/jleague/game/" + g.GameID + "",
                                    UrlArticle = "/mypage/article/",
                                    HomeTeamName = g.HomeTeamName,
                                    HomeTeamID = Convert.ToInt32(g.HomeTeamID),
                                    HomeTeamS = g.HomeTeamNameS,
                                    VisitorTeamName = g.AwayTeamName,
                                    VisitorTeamS = g.AwayTeamNameS,
                                    VisitorTeamID = g.AwayTeamID,
                                    HomeTeamIcon = g.HomeTeamIcon,
                                    VisitorTeamIcon = g.AwayTeamIcon,
                                    HomeTeamRanking = g.HomeTeamRanking,
                                    VisitorTeamRanking = g.AwayTeamRanking,
                                    HomeTeamWin = g.HomeTeamWin,
                                    VisitorTeamWin = g.AwayTeamWin,
                                    HomeTeamUrl = "/jleague/teams/" + g.HomeTeamID + "",
                                    VisitorTeamUrl = "/jleague/teams/" + g.AwayTeamID + "",
                                    HomeScore = g.HomeTeamScore.ToString(),
                                    VisitorScore = g.AwayTeamScore.ToString(),
                                    GameDateScheduled = g.GameDate,
                                    GameTimeScheduled = g.Time,
                                    OddsInfoModel = oddsService.GetOddsInfoByGameID(Constants.JLG_SPORT_ID, g.GameID, memberId),

                                    WinLose = Convert.ToInt16(e.VorD), //勝敗1:勝ち 2:負け,
                                    BetSelectID = e.BetSelectID,
                                    SituationStatus = e.SituationStatus,
                                    ExpectPoint1 = e.ExpectPoint,
                                    StartDt = startDate
                                }).ToList();
                }
            }

            ScoreGameInfo lstScoreHome;
            ScoreGameInfo lstScoreVisitor;

            if (nbpGames != null)
            {
                foreach (var g in nbpGames)
                {
                    // 投稿記事表示フラグ
                    g.ArticleDispFlg = articleDispFlg;

                    //実際の試合日時
                    var giSS = (from gameInfo in npb.GameInfoSS
                                where gameInfo.ID == g.GameID
                                select gameInfo).FirstOrDefault();
                    if (giSS != null)
                    {
                        g.GameDateActual = giSS.GameDate;
                        g.GameTimeActual = giSS.Time;
                    }

                    //スコア
                    lstScoreHome = NpbCommon.GetTeamInfoGTSByGameIDTeamID(g.GameID, g.HomeTeamID);
                    lstScoreVisitor = NpbCommon.GetTeamInfoGTSByGameIDTeamID(g.GameID, g.VisitorTeamID);
                    if (lstScoreHome != null && lstScoreVisitor != null)
                    {
                        g.BottomTop = Utils.GetRoundName(lstScoreHome.TB);
                        g.Inning = lstScoreHome.Inning == null ? 0 : (int)lstScoreHome.Inning;
                    }

                    g.GameStatus = NpbCommon.GetStatusMatch(g.GameID, memberId.ToString());
                    //g.GameStatusSimple = NpbCommon.GetStatusMatch(g.GameID.ToString());

                    if (g.GameStatus == 6 || g.GameStatus == 7)
                    {
                        g.GameDateTime = "試合中 " + g.Inning + g.BottomTop;

                    }

                    // 試合の勝利チーム
                    var winteam = (from gi in npb.GameInfoRGI
                                   join ri in npb.GameResultInfoRGI
                               on gi.RealGameInfoRootRGIId equals ri.RealGameInfoRootRGIId
                                   where
                                   gi.GameID == g.GameID   // 試合
                                   select ri).FirstOrDefault();
                    if (winteam != null)
                    {

                        var win_teamcd = winteam.WinTeamCD;
                        if (win_teamcd == g.HomeTeamID)
                        {
                            // g.TeamName = g.HomeTeamName;
                            // g.TeamNameS = g.HomeTeamS;
                            g.WinnerTeam = 1;
                        }
                        else if (win_teamcd == g.VisitorTeamID)
                        {
                            // g.TeamName = g.VisitorTeamName;
                            // g.TeamNameS = g.VisitorTeamS;
                            g.WinnerTeam = 2;
                        }
                    }
                }
            }

            if (mlbGames != null)
            {
                foreach (var g in mlbGames)
                {
                    // 投稿記事表示フラグ
                    g.ArticleDispFlg = articleDispFlg;

                    //実際の試合日時
                    var ssi = (from ss in mlb.SeasonSchedule
                               join dg in mlb.DayGroup on ss.DayGroupId equals dg.DayGroupId
                               where ss.GameID == g.GameID
                               select new
                               {
                                   GameDate = dg.GameDateJPN,
                                   Time = ss.Time
                               }).FirstOrDefault();

                    if (ssi != null)
                    {
                        g.GameDateActual = ssi.GameDate;
                        g.GameTimeActual = ssi.Time;
                    }

                    //イニング情報とスコアを得る
                    lstScoreHome = MlbCommon.GetTeamInfoGTSByGameIDTeamIDHome(g.GameID, g.HomeTeamID);
                    lstScoreVisitor = MlbCommon.GetTeamInfoGTSByGameIDTeamIDVisitor(g.GameID, g.VisitorTeamID);

                    if (lstScoreHome != null && lstScoreVisitor != null)
                    {
                        g.BottomTop = Utils.GetRoundName(lstScoreHome.TB);
                        g.Inning = lstScoreHome.Inning == null ? 0 : (int)lstScoreHome.Inning;
                    }

                    //ゲームの状態
                    g.GameStatus = MlbCommon.GetStatusMatch(g.GameID, memberId.ToString());
                    //g.GameStatusSimple = MlbCommon.GetStatusMatch(g.GameID.ToString());

                    if (g.GameStatus == 6 || g.GameStatus == 7)
                    {
                        g.GameDateTime = "試合中";

                    }
                    // 試合の勝利チームを得る
                    // MlbTeamInfoDailyResultController.csから引用
                    var query = from realGameInfo in mlb.RealGameInfo
                                join seasonSchedule in mlb.SeasonSchedule on realGameInfo.GameID equals seasonSchedule.GameID
                                join dayGroup in mlb.DayGroup on seasonSchedule.DayGroupId equals dayGroup.DayGroupId
                                where (dayGroup.GameDateJPN.Value == g.GameDateScheduled) && (realGameInfo.GameID == g.GameID && realGameInfo.HomeTeamID == g.HomeTeamID)
                                select new
                                {
                                    WinTeamCD = realGameInfo.HomeScore > realGameInfo.VisitorScore ? realGameInfo.HomeTeamID : (realGameInfo.HomeScore < realGameInfo.VisitorScore ? realGameInfo.VisitorTeamID : null),
                                    WinTeamName = realGameInfo.HomeScore > realGameInfo.VisitorScore ? realGameInfo.HomeTeamName : (realGameInfo.HomeScore < realGameInfo.VisitorScore ? realGameInfo.VisitorTeamName : null)
                                };
                    if (query != null)
                    {
                        if (query.FirstOrDefault() != null)
                        {
                            var mlb_winteam = query.FirstOrDefault().WinTeamCD;
                            if (mlb_winteam == g.HomeTeamID)
                            {
                                //  g.TeamName = g.HomeTeamName;
                                //  g.TeamNameS = g.HomeTeamS;
                                g.WinnerTeam = 1;
                            }
                            else if (mlb_winteam == g.VisitorTeamID)
                            {
                                //  g.TeamName = g.VisitorTeamName;
                                //  g.TeamNameS = g.VisitorTeamS;
                                g.WinnerTeam = 2;
                            }
                        }
                    }

                }
            }

            if (jlgGames != null)
            {
                foreach (var g in jlgGames)
                {
                    // 投稿記事表示フラグ
                    g.ArticleDispFlg = articleDispFlg;

                    //実際の試合日時
                    lstScoreHome = JlgCommon.GetTeamInfoGTSByGameIDTeamID(g.GameID, g.HomeTeamID);
                    lstScoreVisitor = JlgCommon.GetTeamInfoGTSByGameIDTeamID(g.GameID, g.VisitorTeamID);

                    var grlg = (from gameReportLG in jlg.GameReportLG
                                where gameReportLG.GameID == g.GameID
                                select gameReportLG).FirstOrDefault();

                    if (grlg != null)
                    {
                        g.GameDateActual = grlg.GameDate;
                        g.GameTimeActual = grlg.StartTime.ToString();
                    }

                    //ゲームの状態
                    g.GameStatus = JlgCommon.GetStatusMatch(g.GameID, memberId.ToString());
                    //g.GameStatusSimple = JlgCommon.GetStatusMatch(g.GameID.ToString());

                    if (g.GameStatus == 6 || g.GameStatus == 7)
                    {
                        g.GameDateTime = "試合中";
                    }

                    // 試合の勝利チームを得る
                    int WinTeamCD = lstScoreHome.R > lstScoreVisitor.R ? g.HomeTeamID : lstScoreHome.R < lstScoreVisitor.R ? g.VisitorTeamID : 0;
                    if (WinTeamCD == g.HomeTeamID) // Home勝ち点3
                    {
                        // ホーム勝ちののBetSelectID
                        g.WinnerTeam = (int)BetConst.BetSelectID.Home;
                    }
                    else if (WinTeamCD == g.VisitorTeamID)
                    {
                        // アウェー勝ちののBetSelectID
                        g.WinnerTeam = (int)BetConst.BetSelectID.Visitor;
                    }
                    else
                    {
                        // 引き分けのBetSelectID
                        g.WinnerTeam = (int)BetConst.BetSelectID.Draw;
                    }
                }
            }

            List<GameInfoModel> allGames = new List<GameInfoModel> { };

            if (nbpGames != null)
                allGames.AddRange(nbpGames);
            if (mlbGames != null)
                allGames.AddRange(mlbGames);
            if (jlgGames != null)
                allGames.AddRange(jlgGames);

            result = allGames.OrderByDescending(s => s.usingDate).ThenByDescending(t => t.usingTime).ToList();

            return result;
        }
Пример #2
0
        /// <summary>
        /// 当日のゲーム情報取得
        /// </summary>
        /// <param name="sports_id"></param>
        /// <param name="today"></param>
        /// <returns></returns>
        public List<MyPageGroupDetailsViewModel.MyPageGameInfoViewModel> GetTodaysGames(int? sports_id, int today)
        {
            Int64 memberId = GetLoginMemberId();
            List<MyPageGroupDetailsViewModel.MyPageGameInfoViewModel> ListGames = new List<MyPageGroupDetailsViewModel.MyPageGameInfoViewModel>();

            List<GameInfoViewModel> npbGameInfos = new List<GameInfoViewModel>();
            List<GameInfoViewModel> mlbGameInfos = new List<GameInfoViewModel>();
            List<JlgGameInfos> jlgGameInfos = new List<JlgGameInfos>();

            // グループメンバ0が予想している試合のみを選択
            var query = (from et in com.ExpectTarget
                         join ep in com.ExpectPoint on et.ExpectTargetID equals ep.ExpectTargetID
                         join pt in com.Point on ep.PointID equals pt.PointID
                         join gm in com.GroupMember on pt.MemberID equals gm.MemberID
                         where et.ClassClass == CLASSCLASS_GAME
                         && pt.MemberID == memberId
                         orderby et.SportsID, et.UniqueID
                         select et);
            if (query != null)
            {
                List<int> npbGameIDlist = (from q in query where q.SportsID == Constants.NPB_SPORT_ID select q.UniqueID).Distinct().ToList();
                List<int> mlbGameIDlist = (from q in query where q.SportsID == Constants.MLB_SPORT_ID select q.UniqueID).Distinct().ToList();
                List<int> jlgGameIDlist = (from q in query where q.SportsID == Constants.JLG_SPORT_ID select q.UniqueID).Distinct().ToList();

                NpbTopController NpbCtl = new NpbTopController();
                MlbTopController MlbCtl = new MlbTopController();
                JlgTopController jlgCtl = new JlgTopController();

                switch (sports_id)
                {

                    case Constants.NPB_SPORT_ID:
                        foreach (var game_id in npbGameIDlist)
                        {
                            IEnumerable<GameInfoViewModel> npbs = NpbCtl.GetGameInfo(null, null, null, null, game_id, null);
                            if (npbs != null)
                            {
                                GameInfoViewModel npbGameInfo = npbs.FirstOrDefault();
                                if (npbGameInfo != null)
                                {
                                    if (npbGameInfo.GameDate == today)
                                    {
                                        npbGameInfos.Add(npbGameInfo);
                                    }
                                }
                            }

                        }

                        if (npbGameInfos != null)
                        {
                            foreach (var s in npbGameInfos)
                            {
                                MyPageGroupDetailsViewModel.MyPageGameInfoViewModel g = new MyPageGroupDetailsViewModel.MyPageGameInfoViewModel();
                                g.SportsID = Constants.NPB_SPORT_ID;
                                g.GameTypeName = s.GameTypeName;
                                g.statusMatch = NpbCommon.GetStatusMatch(s.GameID, memberId.ToString());
                                g.SortKey = g.SportsID.ToString() + s.GameTypeName + s.GameID.ToString();
                                g.npbGameInfo = s;
                                ListGames.Add(g);
                            }
                        }
                        break;
                    case Constants.MLB_SPORT_ID:
                        foreach (var game_id in mlbGameIDlist)
                        {
                            IEnumerable<GameInfoViewModel> mlbs = MlbCtl.GetGameInfo(null, null, null, null, game_id, null);
                            if (mlbs != null)
                            {
                                GameInfoViewModel mlbGameInfo = mlbs.FirstOrDefault();
                                if (mlbGameInfo != null)
                                {
                                    if (mlbGameInfo.GameDate == today)
                                    {
                                        mlbGameInfos.Add(mlbGameInfo);
                                    }
                                }
                            }

                        }

                        if (mlbGameInfos != null)
                        {
                            foreach (var s in mlbGameInfos)
                            {
                                MyPageGroupDetailsViewModel.MyPageGameInfoViewModel g = new MyPageGroupDetailsViewModel.MyPageGameInfoViewModel();
                                g.SportsID = Constants.MLB_SPORT_ID;
                                g.GameTypeName = s.GameTypeName;
                                g.statusMatch = MlbCommon.GetStatusMatch(s.GameID, memberId.ToString());
                                g.SortKey = g.SportsID.ToString() + s.GameTypeName + s.GameID.ToString();
                                g.mlbGameInfo = s;
                                ListGames.Add(g);
                            }
                        }
                        break;

                    case Constants.JLG_SPORT_ID:
                        foreach (var game_id in jlgGameIDlist)
                        {
                            IEnumerable<JlgGameInfos> jlgs = jlgCtl.GetGameInfo(null, null, null, game_id, null, null, null);
                            if (jlgs != null)
                            {
                                JlgGameInfos jlgGameInfo = jlgs.FirstOrDefault();
                                if (jlgGameInfo != null)
                                {
                                    if (jlgGameInfo.GameDate == today)
                                    {
                                        jlgGameInfos.Add(jlgGameInfo);
                                    }
                                }
                            }

                        }

                        if (jlgGameInfos != null)
                        {
                            foreach (var s in jlgGameInfos)
                            {
                                MyPageGroupDetailsViewModel.MyPageGameInfoViewModel g = new MyPageGroupDetailsViewModel.MyPageGameInfoViewModel();
                                g.SportsID = Constants.JLG_SPORT_ID;
                                g.GameTypeName = s.GameKindName;
                                g.statusMatch = JlgCommon.GetStatusMatch(s.GameID, memberId.ToString());
                                g.SortKey = g.SportsID.ToString() + s.GameKindName + s.GameID.ToString();
                                g.jlgGameInfo = s;
                                ListGames.Add(g);
                            }
                        }

                        break;
                }

            }

            var result = ListGames.OrderBy(s => s.SortKey).ToList();
            ScoreGameInfo lstScoreHome;
            ScoreGameInfo lstScoreVisitor;
            foreach (var r in result)
            {
                switch (r.SportsID)
                {
                    case Constants.NPB_SPORT_ID:
                        lstScoreHome = NpbCommon.GetTeamInfoGTSByGameIDTeamID(r.npbGameInfo.GameID, r.npbGameInfo.HomeTeamID);
                        lstScoreVisitor = NpbCommon.GetTeamInfoGTSByGameIDTeamID(r.npbGameInfo.GameID, r.npbGameInfo.VisitorTeamID);
                        r.npbGameInfo.BottomTop = Utils.GetRoundName(lstScoreHome.TB);
                        r.npbGameInfo.Round = Convert.ToInt32(lstScoreHome.Inning);
                        r.npbGameInfo.HomeTeamR = lstScoreHome.R;
                        r.npbGameInfo.VisitorTeamR = lstScoreVisitor.R;
                        r.gOdds = NpbCommon.GetOddsInfoByGameID(r.npbGameInfo.GameID);
                        break;
                    case Constants.MLB_SPORT_ID:
                        lstScoreHome = MlbCommon.GetTeamInfoGTSByGameIDTeamIDHome(r.mlbGameInfo.GameID, r.mlbGameInfo.HomeTeamID);
                        lstScoreVisitor = MlbCommon.GetTeamInfoGTSByGameIDTeamIDVisitor(r.mlbGameInfo.GameID, r.mlbGameInfo.VisitorTeamID);
                        r.mlbGameInfo.BottomTop = Utils.GetRoundName(lstScoreHome.TB);
                        r.mlbGameInfo.Round = Convert.ToInt32(lstScoreHome.Inning);
                        r.mlbGameInfo.HomeTeamR = lstScoreHome.R;
                        r.mlbGameInfo.VisitorTeamR = lstScoreVisitor.R;
                        r.gOdds = MlbCommon.GetOddsInfoByGameID(r.mlbGameInfo.GameID);
                        break;
                    case Constants.JLG_SPORT_ID:
                        lstScoreHome = JlgCommon.GetTeamInfoGTSByGameIDTeamID(r.jlgGameInfo.GameID, Convert.ToInt32(r.jlgGameInfo.HomeTeamID));
                        lstScoreVisitor = JlgCommon.GetTeamInfoGTSByGameIDTeamID(r.jlgGameInfo.GameID, r.jlgGameInfo.AwayTeamID);
                        r.jlgGameInfo.Round = Convert.ToInt32(lstScoreHome.Inning);
                        r.jlgGameInfo.HomeTeamR = Convert.ToInt32(lstScoreHome.R);
                        r.jlgGameInfo.AwayTeamR = Convert.ToInt32(lstScoreVisitor.R);
                        r.gOdds = JlgCommon.GetOddsInfoByGameID(r.jlgGameInfo.GameID);
                        break;
                    default:
                        break;
                }
            }

            return result;
        }