protected void Page_Load(object sender, EventArgs e) { if (Request.IsAuthenticated) { int opponentId = Convert.ToInt32(Request.QueryString["opponentId"]); RadDatePicker1.MinDate = DateTime.Now.AddDays(1); if (!IsPostBack) { if (!StoredData.User.TempDivision.Value || !StoredData.User.AccessExpired.Value) { using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext()) { ISingleResult <SelectUserPublicProfileResult> users = dataContext.SelectUserPublicProfile(opponentId); SelectUserPublicProfileResult user = users.First(); opponentLabel.Text = user.FirstName + " " + user.LastName; List <TennisCourt> tennisCourts = dataContext.SelectTennisCourtsByEmailId(StoredData.User.EmailId).ToList(); locationDropDownList.DataSource = tennisCourts; locationDropDownList.DataTextField = "CourtName"; locationDropDownList.DataValueField = "CourtId"; locationDropDownList.DataBind(); locationDropDownList.SelectedValue = StoredData.User.HomeCourt.ToString(); ViewState["UserCourtName"] = locationDropDownList.SelectedItem.Text; } } } } }
protected void Page_Load(object sender, EventArgs e) { if (Request.IsAuthenticated) { int opponentId = Convert.ToInt32(Request.QueryString["opponentId"]); int matchId = Convert.ToInt32(Request.QueryString["matchId"]); matchIdHiddenField.Value = matchId.ToString(); opponentIdHiddenField.Value = opponentId.ToString(); if (!Page.IsPostBack) { using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext()) { ISingleResult <SelectUserPublicProfileResult> users = dataContext.SelectUserPublicProfile(opponentId); SelectUserPublicProfileResult user = users.First(); ISingleResult <SelectMatchResult> matches = dataContext.SelectMatch(matchId); SelectMatchResult match = matches.First(); ISingleResult <SelectMatchPointLogsByMatchIdResult> matchResults = dataContext.SelectMatchPointLogsByMatchId(matchId); SelectMatchPointLogsByMatchIdResult matchResult = matchResults.First(); string winner = string.Empty; if (matchResult.UserId == StoredData.User.UserId) { if (matchResult.Win) { winner = StoredData.User.FirstName + " " + StoredData.User.LastName; } else { winner = user.FirstName + " " + user.LastName; } } else { if (matchResult.Win) { winner = user.FirstName + " " + user.LastName; } else { winner = StoredData.User.FirstName + " " + StoredData.User.LastName; } } matchLabel.Text = string.Format("{0} vs {1} on {2} {3}. Winner: {4} ({5})", StoredData.User.FirstName + " " + StoredData.User.LastName, user.FirstName + " " + user.LastName, match.MatchDate.ToShortDateString(), match.MatchDate.ToShortTimeString(), winner, match.Score); ISingleResult <SelectMatchPointLogsByMatchIdUserIdResult> ratings = dataContext.SelectMatchPointLogsByMatchIdUserId(matchId, StoredData.User.UserId); SelectMatchPointLogsByMatchIdUserIdResult rating = ratings.First(); ownBackhandRadSlider.Value = rating.OwnBackhand.Value; ownCourtCoverageRadSlider.Value = rating.OwnCourtCoverage.Value; ownDropRadSlider.Value = rating.OwnDrop.Value; ownForehandRadSlider.Value = rating.OwnForehand.Value; ownOverheadRadSlider.Value = rating.OwnOverhead.Value; ownServeRadSlider.Value = rating.OwnServe.Value; ownVolleyRadSlider.Value = rating.OwnVolley.Value; opponentBackhandRadSlider.Value = rating.OpponentBackhand.Value; opponentCourtCoverageRadSlider.Value = rating.OpponentCourtCoverage.Value; opponentDropRadSlider.Value = rating.OpponentDrop.Value; opponentForehandRadSlider.Value = rating.OpponentForehand.Value; opponentOverheadRadSlider.Value = rating.OpponentOverhead.Value; opponentServeRadSlider.Value = rating.OpponentServe.Value; opponentVolleyRadSlider.Value = rating.OpponentVolley.Value; } } } }