protected void Page_Load(object sender, EventArgs e) { pnlBookingHistory.Visible = true; pnlNoBookingHistory.Visible = false; if (!IsPostBack) { try { string UserID = ((Guid)Membership.GetUser().ProviderUserKey).ToString(); List <FlightBooking> Bookings = new List <FlightBooking>(); ISearchManager searchmanager = SearchManagerFactory.GetInstance().Create(); if ((string.IsNullOrWhiteSpace(Request.QueryString["from"])) && (string.IsNullOrWhiteSpace(Request.QueryString["to"]))) { genDateCriteria.InnerText = "Showing all bookings"; Bookings = searchmanager.GetUserBookings(UserID); } else { if ((!string.IsNullOrWhiteSpace(Request.QueryString["from"])) && (!string.IsNullOrWhiteSpace(Request.QueryString["to"]))) { genDateCriteria.InnerText = "Showing bookings made between " + Request.QueryString["from"] + " and " + Request.QueryString["to"]; } else if (string.IsNullOrWhiteSpace(Request.QueryString["from"])) { genDateCriteria.InnerText = "Showing bookings made till " + Request.QueryString["to"]; } else { genDateCriteria.InnerText = "Showing bookings made since " + Request.QueryString["from"]; } Bookings = searchmanager.SearchUserBookings(UserID, Request.QueryString["from"], Request.QueryString["to"]); } if (Bookings.Count > 0) { drpBookings.DataSource = Bookings; drpBookings.DataBind(); } else { pnlBookingHistory.Visible = false; pnlNoBookingHistory.Visible = true; } lblResultsType.InnerText = genDateCriteria.InnerText; } catch (Exception) { Response.Redirect("~/Error.aspx"); } } }