Ejemplo n.º 1
0
        /// <summary>
        /// ViewModelを取得
        /// </summary>
        /// <param name="groupId">グループID</param>
        /// <param name="loginMemberId">ログイン会員ID</param>
        /// <param name="skipCount">スキップする要素数</param>
        /// <param name="takeCount">返す要素数</param>
        /// <param name="targetYear">付与対象年</param>
        /// <param name="targetMonth">付与対象月</param>
        /// <returns>MyPageGroupDetailsViewModelオブジェクト</returns>
        public MyPageGroupDetailsViewModel GetViewModel(long groupId, long loginMemberId,int skipCount, int takeCount, int targetYear, int targetMonth)
        {
            var viewModel = new MyPageGroupDetailsViewModel();

            //グループ情報を設定する
            viewModel.GroupInfo = new MyPageGroupModel();

            //グループ会員の一覧を取得
            var groupMembers = this.groupInfoService.GetGroupMembers(groupId, loginMemberId).ToArray();

            //グループ会員のポイント情報を取得
            this.pointInfoService.GetMembersWithOnlinePoints(groupMembers, targetYear, targetMonth);

            //グループ会員のランキング情報を取得
            int year = this.systemDatetimeService.TargetYear;
            int month = this.systemDatetimeService.TargetMonth;
            this.groupInfoService.GetRanking(groupId, year, month, groupMembers);

            viewModel.GroupInfo.MemberId = loginMemberId;
            viewModel.GroupInfo.GroupId = groupId;
            viewModel.GroupInfo.GroupName = (from g in dbContext.Groups where g.GroupID == groupId select g.GroupName).FirstOrDefault();
            viewModel.GroupInfo.GroupMembers = groupMembers.ToList();

            return viewModel;
        }
Ejemplo n.º 2
0
        public ActionResult ShowGameInfo(int? type, int? gameDate, int? groupID, int? sports_id)
        {
            MyPageGroupDetailsViewModel viewModel = new MyPageGroupDetailsViewModel();

            Int64 memberId = GetLoginMemberId();
            int gdate = Convert.ToInt32(gameDate); // yyyymmdd

            ViewBag.Type = type;
            //            ViewBag.Link = link;

            viewModel.ListGames = GetTodaysGames(sports_id, gdate);

            //フォローユーザーの予想
            int GameID = 0;

            if (memberId > 0)
            {
                foreach (var g in viewModel.ListGames)
                {
                    switch (g.SportsID)
                    {
                        case Constants.NPB_SPORT_ID:
                            if (g.npbGameInfo != null)
                            {
                                GameID = g.npbGameInfo.GameID;
                            }
                            break;
                        case Constants.MLB_SPORT_ID:
                            if (g.mlbGameInfo != null)
                            {
                                GameID = g.mlbGameInfo.GameID;
                            }
                            break;
                        case Constants.JLG_SPORT_ID:
                            if (g.jlgGameInfo != null)
                            {
                                GameID = g.jlgGameInfo.GameID;
                            }
                            break;
                        default:
                            GameID = 0;
                            break;
                    }
                    if (GameID > 0)
                    {
                        FollowMemberList FollowMember = new FollowMemberList();
                        //ホームの勝ち
                        List<Member> ToWin = Utils.GetExpectingMembers(com, (int)GameID, memberId, CLASSCLASS_GAME, g.SportsID, 1);
                        List<Member> ToDraw = Utils.GetExpectingMembers(com, (int)GameID, memberId, CLASSCLASS_GAME, g.SportsID, 3);
                        List<Member> ToLose = Utils.GetExpectingMembers(com, (int)GameID, memberId, CLASSCLASS_GAME, g.SportsID, 2);
                        FollowMember.FollowMembersBetToWin = ToWin;
                        FollowMember.FollowMembersBetToDraw = ToDraw;
                        FollowMember.FollowMembersBetToLose = ToLose;

                        g.FollowMembers = FollowMember;

                    }
                }
            }
            return PartialView("_NpbGameInfo", viewModel);
        }