示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            using (SBEntities db = new SBEntities())
            {
                UserSession user = Helper.GetUserSession();

                _gameKey = int.Parse(Page.RouteData.Values["id"].ToString());
                _userKey = user.userKey;

                GameDetails gd = db.GetGame(_gameKey);
                LiteralGameName.Text    = gd.Game.GameName;
                LiteralGameDetails.Text = Helper.FormatTextToHtml(gd.Game.OverView);
                try
                {
                    LiteralReleaseDate.Text = ((DateTime)gd.Game.ReleaseDate).ToShortDateString();
                }
                catch
                {
                    LiteralReleaseDate.Text = "Not Set";
                }
                LiteralGameSystemName.Text = gd.GameSystemName;
                _gameImage = gd.Game.CoverImage;

                GameFollowerDetails gfd = db.GetGameFollowerDetails(user.userKey, _gameKey);
                _followCount = gfd.FollowerCount;
                _following   = gfd.UserFollowing;

                RepeaterUpcomingBattles.DataSource = db.GetGameUpcomingBattles(_gameKey, _userKey).ToList();
                RepeaterUpcomingBattles.DataBind();

                RepeaterUpcomingBattles.Visible = RepeaterUpcomingBattles.Items.Count > 0;
                LabelNoBattles.Visible          = RepeaterUpcomingBattles.Items.Count == 0;
            }
        }