protected void Page_Load(object sender, EventArgs e) { //if the sessiom is null if (Session["attraction"] == null) { Response.Redirect("AttractionPage.aspx"); //brings back to the attraction page } else { //create a new list for attraction List <Attraction> attList = new List <Attraction>(); //retrieve the attraction id from the session and use it to get a attraction from the database Attraction att = AttractionDB.getAttractionByID(Session["attraction"].ToString()); attList.Add(att); //add a vehicle to attraction list lvAttraction.DataSource = attList; //add the attraction list to a list view data source lvAttraction.DataBind(); //bind the data into listview //get all feedbacks of a vehicle List <Review> rvList = ReviewDB.getAllAttractionReviewByID(Convert.ToInt32(Session["attraction"])); attReviews.DataSource = rvList; attReviews.DataBind(); if (rvList.Count == 0) //checking whether there is no feedback available for attraction { lblOutput.Text = "No feedback available for this attraction"; //show the message } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["userAttraction"] == null) { Response.Redirect("LoginForm.aspx"); } lblNoResult.Text = ""; lblFeedback.Visible = false; if (!IsPostBack) { //Displaying upcoming and past bookings lblCustomer.Visible = false; dlCustomer.Visible = false; gvFeedback.Visible = false; lblTitle.Text = "Upcoming Booking"; gvHistory.Visible = false; //Getting current signed in user Attraction attraction = (Attraction)Session["userAttraction"]; //Getting booked rooms from database and display them List <ItemBooking> itemList = ItemBookingDB.getAllTicketItemBooking(); List <ItemBooking> upcoming = new List <ItemBooking>(); List <ItemBooking> history = new List <ItemBooking>(); foreach (ItemBooking it in itemList) { //Checking the date to show only the upcoming events if (it.TicketID.Attraction.OrgEmail == attraction.OrgEmail) { if (it.StartDate > DateTime.Now && it.ItemBookingStatus != "Canceled") { ItemBooking item = it; upcoming.Add(item); gvUpcoming.DataSource = upcoming; gvUpcoming.DataBind(); //Keep the list of upcoming bookings in a session for further use Session["upcoming"] = upcoming; } //Displaying the past bookings else { ItemBooking item = it; history.Add(item); gvHistory.DataSource = history; gvHistory.DataBind(); //Keep the list of past bookings in a session for further use Session["history"] = history; } } } Attraction att = (Attraction)Session["userAttraction"]; //Getting feedback from database and display them List <Review> feedbackList = ReviewDB.getAllAttractionReviewByID(att.AttractionID); gvFeedback.DataSource = feedbackList; gvFeedback.DataBind(); Session["Feedback"] = feedbackList; } }