protected void Page_Load(object sender, EventArgs e) { if (!Request.IsAuthenticated) { Response.Redirect(WebConfigurationManager.AppSettings["LoginPageURL"].ToString()); } if (!Page.IsPostBack) { //Hide next division panel if the current user is not signed up for next division. if (StoredData.User.NextDivision == StoredData.User.Division) { nextLeaguePanel.Visible = false; } using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext()) { if (StoredData.User.TempDivision.Value || StoredData.User.AccessExpired.Value) { warningImage.Visible = true; warningLinkButton.Visible = true; if (StoredData.User.TempDivision.Value) { warningLinkButton.Text = "Your account is still being created. You will not be able to schedule matches or report scores. Please wait for the email confirming your account activation."; } else if (StoredData.User.AccessExpired.Value) { warningLinkButton.Text = "Your access has expired. Please click here to subscribe to the current season and regain access."; warningLinkButton.PostBackUrl = WebConfigurationManager.AppSettings["NewLeagueRegisterURL"].ToString(); } } else { leagueRadGrid.Rebind(); nextLeagueRadGrid.Rebind(); } List <SelectDivisionResult> selectDivisionResult = dataContext.SelectDivision(StoredData.User.Division).ToList(); if (selectDivisionResult.Count > 0) { leagueLabel.Text = selectDivisionResult[0].Division; } if (StoredData.User.NextDivision != StoredData.User.Division) { List <SelectDivisionResult> selectNextDivisionResult = dataContext.SelectDivision(StoredData.User.NextDivision.Value).ToList(); if (selectNextDivisionResult.Count > 0) { nextLeagueLabel.Text = selectNextDivisionResult[0].Division + " (Your Next Season)"; } } } } }
protected void Page_Load(object sender, EventArgs e) { if (!Request.IsAuthenticated) { Response.Redirect(WebConfigurationManager.AppSettings["LoginPageURL"].ToString()); } RadAjaxManager.GetCurrent(Page).AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(Schedule_AjaxRequest); if (!Page.IsPostBack) { using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext()) { if (!StoredData.User.TempDivision.Value && !StoredData.User.AccessExpired.Value) { var upcomingMatches = dataContext.GetUpcomingMatches(StoredData.User.UserId); upcomingMatchesRadGrid.DataSource = upcomingMatches; upcomingMatchesRadGrid.DataBind(); var previousMatches = dataContext.GetPreviousMatches(StoredData.User.UserId); previousMatchesRadGrid.DataSource = previousMatches; previousMatchesRadGrid.DataBind(); List <SelectDivisionResult> selectDivisionResult = dataContext.SelectDivision(StoredData.User.Division.Value).ToList(); foreach (SelectDivisionResult result in selectDivisionResult) { if (result.StartDate > DateTime.Now) { warningImage.Visible = true; warningLinkButton.Visible = true; warningLinkButton.Text = "Although you may play practice matches with members in your league. You will not be able to record scores until the league start date of " + result.StartDate.ToShortDateString(); HyperLink1.Visible = false; Image1.Visible = false; } } } else { warningImage.Visible = true; warningLinkButton.Visible = true; Image1.Visible = false; HyperLink1.Visible = false; if (StoredData.User.TempDivision.Value) { warningLinkButton.Text = "Your account is still being created. You will not be able to schedule matches or report scores. Please wait for the email confirming your account activation."; } else if (StoredData.User.AccessExpired.Value) { warningLinkButton.Text = "Your access has expired. Please click here to subscribe to the current season and regain access."; warningLinkButton.PostBackUrl = WebConfigurationManager.AppSettings["NewLeagueRegisterURL"].ToString(); } } } } }
protected void Page_Load(object sender, EventArgs e) { if (!Request.IsAuthenticated) { Response.Redirect(WebConfigurationManager.AppSettings["LoginPageURL"].ToString()); } if (!Page.IsPostBack) { using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext()) { List <Performance> performances = dataContext.SelectPerformanceByUserId(StoredData.User.UserId).ToList(); Performance seasonPerformance = performances.Find(p => p.DivisionId == StoredData.User.Division); seasonWinsLabel.Text = string.Format("{0}W - {1}L", seasonPerformance.Win, seasonPerformance.Loss); seasonPointsLabel.Text = seasonPerformance.TotalPoints.ToString(); overallWinsLabel.Text = string.Format("{0}W - {1}L", performances.Sum(p => p.Win), performances.Sum(p => p.Loss)); overallPointsLabel.Text = performances.Sum(p => p.TotalPoints).ToString(); ISingleResult <SelectDivisionResult> divisions = dataContext.SelectDivision(StoredData.User.Division); SelectDivisionResult division = divisions.First(); List <SelectRatingsByUserIdStartEndDateResult> ratings = dataContext.SelectRatingsByUserIdStartEndDate(StoredData.User.UserId, division.StartDate, division.EndDate).ToList(); List <SelectRatingsByUserIdStartEndDateResult> validOwnRatings = ratings.FindAll(p => p.OwnForehand.HasValue); if (validOwnRatings.Count > 0) { DrawRateOwnPerformanceChart(validOwnRatings); DrawRateOwnDetailPerformanceChart(validOwnRatings); } List <SelectOpponentRatingsByUserIdStartEndDateResult> opponentRatings = dataContext.SelectOpponentRatingsByUserIdStartEndDate(StoredData.User.UserId, division.StartDate, division.EndDate).ToList(); List <SelectOpponentRatingsByUserIdStartEndDateResult> validOpponentRatings = opponentRatings.FindAll(p => p.OpponentForehand.HasValue); if (validOpponentRatings.Count > 0) { DrawRateOthersPerformanceChart(validOpponentRatings); DrawRateOpponentServeChart(validOpponentRatings); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!Request.IsAuthenticated) { Response.Redirect(WebConfigurationManager.AppSettings["LoginPageURL"].ToString()); } ChangePassword1.SuccessPageUrl = WebConfigurationManager.AppSettings["SuccessPageURL"].ToString(); photoRadWindow1.NavigateUrl = WebConfigurationManager.AppSettings["PhotoUploadNavigateURL"].ToString(); //if (!Page.IsPostBack) //{ // upcomingLeagueButton.Attributes.Add("onclick", "this.style.display='none';"); //} using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext()) { if (!Page.IsPostBack) { List <TennisCourt> tennisCourts = dataContext.SelectTennisCourtsByLeague(Convert.ToInt32(WebConfigurationManager.AppSettings["LeagueCityId"])).ToList(); homeCourtDropDownList.Items.Add(string.Empty); foreach (TennisCourt tennisCourt in tennisCourts) { homeCourtDropDownList.Items.Add(new ListItem(tennisCourt.CourtName, tennisCourt.CourtId.ToString())); } int userNextDivision = 0; ISingleResult <SelectUserByEmailIdResult> users = dataContext.SelectUserByEmailId(HttpContext.Current.User.Identity.Name); foreach (SelectUserByEmailIdResult user in users) { firstNameTextBox.Text = user.FirstName; lastNameTextBox.Text = user.LastName; zipTextBox.Text = user.Zip; phoneTextBox.Text = user.Phone; homeCourtDropDownList.SelectedValue = user.HomeCourt.ToString(); nTRPDropDownList.Text = user.NTRPRanking.ToString(); ageGroupDropDownList.SelectedValue = user.AgeGroup; racquetHandDropDownList.SelectedValue = user.RacquetHand; favoriteShotDropDownList.SelectedValue = user.FavoriteShot; racquetTextBox.Text = user.Racquet; facebookTextBox.Text = user.Facebook; linkedInTextBox.Text = user.LinkedIn; mySpaceTextBox.Text = user.MySpace; orkutTextBox.Text = user.Orkut; if (user.ProfileImageName.HasValue) { profileImage.ImageUrl = string.Format("~/ProfileImages/{0}.jpg", user.ProfileImageName.ToString()); } if (user.NextDivision.HasValue) { userNextDivision = user.NextDivision.Value; } if (user.EmailPost.HasValue) { postEmailCheckBox.Checked = user.EmailPost.Value; } playTypeDropDownList.SelectedValue = user.Interest; } //List<SelectDivisionByLeagueIdResult> selectDivisionByLeagueIdResult = dataContext.SelectDivisionByLeagueId(Convert.ToInt32(WebConfigurationManager.AppSettings["LeagueCityId"])).ToList(); //SelectDivisionByLeagueIdResult nextDivision = selectDivisionByLeagueIdResult.Find(p => p.DivisionId == selectDivisionByLeagueIdResult.Max(q => q.DivisionId)); List <SelectDivisionResult> selectDivisionResult = dataContext.SelectDivision(StoredData.User.NextDivision).ToList(); if (StoredData.User.Division != StoredData.User.NextDivision) { ViewState["NextDivision"] = StoredData.User.NextDivision; ViewState["NextDivisionText"] = selectDivisionResult[0].Division; upcomingLeagueLabel.Text = string.Format("{0} {1} - {2}", selectDivisionResult[0].Division, selectDivisionResult[0].StartDate.ToShortDateString(), selectDivisionResult[0].EndDate.ToShortDateString()); upcomingLeagueButton.Visible = true; } else { upcomingLeagueLabel.Text = string.Format("You are currently subscribed to the {0} {1} - {2}", selectDivisionResult[0].Division, selectDivisionResult[0].StartDate.ToShortDateString(), selectDivisionResult[0].EndDate.ToShortDateString()); } } List <SelectProfileImageByEmailIdResult> selectProfileImageByEmailIdResult = dataContext.SelectProfileImageByEmailId(HttpContext.Current.User.Identity.Name).ToList(); if (selectProfileImageByEmailIdResult.Count > 0) { profileImage.ImageUrl = string.Format("~/ProfileImages/{0}.jpg", selectProfileImageByEmailIdResult[0].ProfileImageName.ToString()); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Request.IsAuthenticated) { Response.Redirect(WebConfigurationManager.AppSettings["LoginPageURL"].ToString()); } Guid userId = new Guid(Request.QueryString["UserId"]); using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext()) { ISingleResult <SelectUserPublicProfileByProfileIdResult> users = dataContext.SelectUserPublicProfileByProfileId(userId); SelectUserPublicProfileByProfileIdResult user = users.First(); userLabel.Text = user.FirstName + " " + user.LastName; //Load Image if (user.ProfileImageName.HasValue) { profileImage.ImageUrl = string.Format("~/ProfileImages/{0}.jpg", user.ProfileImageName.ToString()); } divisionLabel.Text = user.Division; homeCourtLabel.Text = user.CourtName; ntrpRankingLabel.Text = user.NTRPRanking.ToString(); ageGroupLabel.Text = user.AgeGroup; racquetHandLabel.Text = user.RacquetHand; favoriteShotLabel.Text = user.FavoriteShot; racquetLabel.Text = user.Racquet; if (!StoredData.User.TempDivision.Value || (user.DivisionId != StoredData.User.Division) || !StoredData.User.AccessExpired.Value) { emailHyperLink.Text = user.EmailId; emailHyperLink.NavigateUrl = string.Format("mailto:{0}", user.EmailId); phoneLabel.Text = user.Phone; facebookHyperLink.Text = user.Facebook; facebookHyperLink.NavigateUrl = user.Facebook; linkedInHyperLink.Text = user.LinkedIn; linkedInHyperLink.NavigateUrl = user.LinkedIn; myspaceHyperLink.Text = user.MySpace; myspaceHyperLink.NavigateUrl = user.MySpace; orkutHyperLink.Text = user.Orkut; orkutHyperLink.NavigateUrl = user.Orkut; } List <Performance> performances = dataContext.SelectPerformanceByUserId(user.UserId).ToList(); Performance seasonPerformance = performances.Find(p => p.DivisionId == user.DivisionId); seasonWinsLabel.Text = string.Format("{0}W - {1}L", seasonPerformance.Win, seasonPerformance.Loss); seasonPointsLabel.Text = seasonPerformance.TotalPoints.ToString(); overallWinsLabel.Text = string.Format("{0}W - {1}L", performances.Sum(p => p.Win), performances.Sum(p => p.Loss)); overallPointsLabel.Text = performances.Sum(p => p.TotalPoints).ToString(); if (!StoredData.User.TempDivision.Value) { List <GetUpcomingMatchesResult> upcomingMatches = dataContext.GetUpcomingMatches(user.UserId).ToList(); upcomingMatchesRadGrid.DataSource = upcomingMatches; upcomingMatchesRadGrid.DataBind(); List <GetPreviousMatchesResult> previousMatches = dataContext.GetPreviousMatches(user.UserId).ToList(); previousMatchesRadGrid.DataSource = previousMatches; previousMatchesRadGrid.DataBind(); int upcomingMatchCount = Convert.ToInt32(upcomingMatches.Count(p => p.UserId == StoredData.User.UserId)); int previousMatchCount = Convert.ToInt32(previousMatches.Count(p => p.UserId == StoredData.User.UserId)); } //Get availability List <SelectAvailabilitiesByUserIdResult> availabilities = dataContext.SelectAvailabilitiesByUserId(user.UserId).ToList(); SetAvailabilities(availabilities); if (StoredData.User.TempDivision.Value || StoredData.User.AccessExpired.Value) { matchRequestLinkButton.Enabled = false; } else { List <SelectDivisionResult> selectDivisionResult = dataContext.SelectDivision(StoredData.User.Division.Value).ToList(); foreach (SelectDivisionResult result in selectDivisionResult) { if (result.StartDate > DateTime.Now) { matchRequestLinkButton.Enabled = false; } } } //TODO: Have to uncomment these lines below //if ((upcomingMatchCount + previousMatchCount) < 2) matchRequestLinkButton.Attributes.Add("onClick", string.Format("openRadWindow('{0}'); return false;", user.UserId)); //else //matchRequestLinkButton.Attributes.Add("onClick", "alert('You have already played two matches against this player for the season. You cannot play against a player more than twice.');return false;"); //matchRequestLinkButton.PostBackUrl = WebConfigurationManager.AppSettings["MatchRequestPath"].ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (!Request.IsAuthenticated) { Response.Redirect(WebConfigurationManager.AppSettings["LoginPageURL"].ToString()); } RadAjaxManager.GetCurrent(Page).AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(Schedule_AjaxRequest); RadScheduler1.CustomAttributeNames = new string[] { "UserId" }; if (!StoredData.User.TempDivision.Value && !StoredData.User.AccessExpired.Value) { using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext()) { if (!Page.IsPostBack) { List <SelectDivisionResult> selectDivisionResult = dataContext.SelectDivision(StoredData.User.Division.Value).ToList(); foreach (SelectDivisionResult result in selectDivisionResult) { if (result.StartDate > DateTime.Now) { warningImage.Visible = true; warningLinkButton.Visible = true; warningLinkButton.Text = "Although you may play practice matches with members in your league. You will not be able to record scores until the league start date of " + result.StartDate.ToShortDateString(); } else { List <LeaguePerformance> leaguePerformance = dataContext.SelectLeaguePerformanceByDivision(StoredData.User.Division).ToList(); leaguePerformance.Remove(leaguePerformance.Find(p => p.UserId == StoredData.User.UserId)); playersRadGrid.DataSource = leaguePerformance; } } } //If a player has been selected from the players grid - get appointments fro both players //else just get appointment for current user. List <DLL.Appointment> appointments = new List <DLL.Appointment>(); bool opponentAvailabilitySet = false; if (playersRadGrid.SelectedItems.Count > 0) { int opponentId = Convert.ToInt32(playersRadGrid.SelectedItems[0].OwnerTableView.DataKeyValues[playersRadGrid.SelectedItems[0].ItemIndex]["UserId"]); appointments = GetAppointments(StoredData.User.UserId, opponentId, out opponentAvailabilitySet); } else { appointments = GetAppointments(StoredData.User.UserId, -1, out opponentAvailabilitySet); } RadScheduler1.DataSource = appointments; } } else { RadScheduler1.Enabled = false; playersRadGrid.Enabled = false; warningImage.Visible = true; warningLinkButton.Visible = true; if (StoredData.User.TempDivision.Value) { warningLinkButton.Text = "Your account is still being created. You will not be able to schedule matches or report scores. Please wait for the email confirming your account activation."; } else if (StoredData.User.AccessExpired.Value) { warningLinkButton.Text = "Your access has expired. Please click here to subscribe to the current season and regain access."; warningLinkButton.PostBackUrl = WebConfigurationManager.AppSettings["NewLeagueRegisterURL"].ToString(); } } }