protected void tennisCourtsRadGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e) { using (FlexibleTennisLeagueDataContext dataContent = new FlexibleTennisLeagueDataContext()) { List <TennisCourt> tennisCourts = new List <TennisCourt>(); if (citiesDropDownList.SelectedItem.Text == "All Cities") { tennisCourts = dataContent.SelectTennisCourtsByLeague(Convert.ToInt32(WebConfigurationManager.AppSettings["LeagueCityId"])).ToList(); } else { tennisCourts = dataContent.SelectTennisCourtByCity(citiesDropDownList.SelectedItem.Text, Convert.ToInt32(WebConfigurationManager.AppSettings["LeagueCityId"])).ToList(); } tennisCourtsRadGrid.DataSource = tennisCourts; //tennisCourtsRadGrid.DataBind(); } }
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) { int? opponentId = null; int? matchId = null; string mode = string.Empty; if (Request.QueryString["opponentId"] != null) { opponentId = Convert.ToInt32(Request.QueryString["opponentId"]); opponentIdHiddenField.Value = opponentId.ToString(); } //RadDatePicker1.MinDate = DateTime.Now; if (Request.QueryString["matchId"] != null) { matchId = Convert.ToInt32(Request.QueryString["matchId"]); matchIdHiddenField.Value = matchId.ToString(); } if (Request.QueryString["mode"] != null) { mode = Request.QueryString["mode"].ToString(); } ViewState["Submitted"] = false; Page.Title = "Report Score"; if (!Page.IsPostBack) { using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext()) { opponentDropDownList.Items.Clear(); List <LeaguePerformance> leaguePerformances = dataContext.SelectLeaguePerformanceByDivision(StoredData.User.Division).ToList(); opponentDropDownList.Items.Add(new ListItem(string.Empty, string.Empty)); foreach (LeaguePerformance leaguePerformance in leaguePerformances) { if (leaguePerformance.UserId != StoredData.User.UserId) { opponentDropDownList.Items.Add(new ListItem(leaguePerformance.FirstName + " " + leaguePerformance.LastName, leaguePerformance.UserId.ToString())); } } opponentDropDownList.SelectedValue = opponentId.ToString(); List <TennisCourt> tennisCourts = dataContext.SelectTennisCourtsByLeague(leaguePerformances[0].LeagueId).ToList(); locationDropDownList.DataSource = tennisCourts; locationDropDownList.DataTextField = "CourtName"; locationDropDownList.DataValueField = "CourtId"; locationDropDownList.DataBind(); //RadDatePicker1.MinDate = Convert.ToDateTime("1/1/2009"); if (!string.IsNullOrEmpty(mode)) { RadDatePicker1.MinDate = DateTime.Now.AddDays(-14); } if (matchId.HasValue) { ISingleResult <SelectMatchResult> matches = dataContext.SelectMatch(matchId); SelectMatchResult match = matches.First(); RadDatePicker1.SelectedDate = match.MatchDate; RadTimePicker1.SelectedDate = match.MatchDate; locationDropDownList.SelectedValue = match.TennisCourt.ToString(); RadDatePicker1.MaxDate = match.MatchDate; } else { locationDropDownList.SelectedValue = StoredData.User.HomeCourt.ToString(); RadDatePicker1.MaxDate = DateTime.Now; } winnerDropDownList.Items.Clear(); winnerDropDownList.Items.Add(new ListItem()); winnerDropDownList.Items.Add(new ListItem(StoredData.User.FirstName + " " + StoredData.User.LastName, StoredData.User.UserId.ToString())); if (opponentId.HasValue) { winnerDropDownList.Items.Add(new ListItem(opponentDropDownList.SelectedItem.Text, opponentDropDownList.SelectedItem.Value)); opponentDropDownList.Enabled = false; } } } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/xml"; //if (!HttpContext.Current.Request.ServerVariables["SERVER_NAME"].Contains("flexibletennisleague")) // return; int leagueId = Convert.ToInt32(Encryption.Decrypt(context.Request.QueryString["League"].ToString(), DateTime.Now.ToString("MMddyymm"))); //int leagueId = 3; List <Court> courts = new List <Court>(); //Get courts from db using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext()) { List <TennisCourt> tennisCourts = dataContext.SelectTennisCourtsByLeague(leagueId).ToList(); foreach (TennisCourt tennisCourt in tennisCourts) { Court court = new Court(); court.Title = tennisCourt.CourtName; court.Link = string.Empty; court.Description = string.Format("{0}, {1}, {2} {3}<br/><br/>Courts : {4}<br/>Lights : {5}<br/>Public : {6}<br/>Court Fees : {7}", tennisCourt.Address, tennisCourt.City, tennisCourt.State, tennisCourt.Zip, tennisCourt.NumberCourts, tennisCourt.HasLights == true ? "Yes" : "No", tennisCourt.IsPublic == true ? "Yes" : "No", tennisCourt.HasFees == true ? "Yes" : "No"); court.Point = string.Format("{0} {1}", tennisCourt.Latitude, tennisCourt.Longitude); courts.Add(court); } } using (XmlTextWriter geoRSS = new XmlTextWriter(HttpContext.Current.Response.OutputStream, System.Text.Encoding.UTF8)) { geoRSS.Formatting = Formatting.Indented; geoRSS.Indentation = 2; geoRSS.WriteStartDocument(true); geoRSS.WriteStartElement("rss"); geoRSS.WriteAttributeString("xmlns:georss", "http://www.georss.org/georss"); geoRSS.WriteAttributeString("version", "2.0"); geoRSS.WriteStartElement("channel"); geoRSS.WriteStartElement("title"); geoRSS.WriteString("courts"); geoRSS.WriteEndElement(); geoRSS.WriteStartElement("link"); geoRSS.WriteEndElement(); geoRSS.WriteStartElement("description"); //geoRSS.WriteString(System.Net.Dns.GetHostEntry(context.Request.UserHostAddress).HostName); geoRSS.WriteEndElement(); for (int counter = 0; counter < courts.Count; counter++) { geoRSS.WriteStartElement("item"); //Title geoRSS.WriteStartElement("title"); geoRSS.WriteString(courts[counter].Title); geoRSS.WriteEndElement(); //link geoRSS.WriteStartElement("link"); geoRSS.WriteEndElement(); //description geoRSS.WriteStartElement("description"); geoRSS.WriteString(courts[counter].Description); geoRSS.WriteEndElement(); //point geoRSS.WriteStartElement("georss:point"); geoRSS.WriteString(courts[counter].Point); geoRSS.WriteEndElement(); geoRSS.WriteEndElement(); } geoRSS.WriteEndElement(); geoRSS.WriteEndElement(); //geoRSS.WriteEndElement(); } }