public static HotelCapacityFactory getFactory() { if (factory == null) { factory = new HotelCapacityFactory(); } return(factory); }
protected void Page_Load(object sender, EventArgs e) { //private reservation = (Reservation)Session["Reservation"]; search = (Search)HttpContext.Current.Session["search"]; //I can not use private to define search //Response.Write(search.StartingDate); //4/2/2016 starting = search.StartingDate; ending = search.EndingDate; destination = search.Destination; //DBMgr dbm = new DBMgr(); //List<HotelRoomQuantity> hotels = dbm.getHotelCapacityByDes("Hawaii"); if (!IsPostBack) { //get hotels by destination //hotels = dbm.getHotelCapacityByDes(destination); hotels = Clone.cloneHotels(HotelCapacityFactory.getFactory().getHotelsByDestination(destination).getHotelCapacityByDestination()); lblDestination.Text = destination; lblStart.Text = starting; lblEnd.Text = ending; //gets available rooms on selected dates List <HotelRoomQuantity> hotelList = getAvailableRooms(starting, ending, destination); if (hotelList.Count == 0) { lblNoAvail.Text = "No available rooms."; } //binds the list of hotels by destination to the list view control lstView.DataSource = hotelList; lstView.DataBind(); //if (!IsPostBack) //{ ////Add items to DropDown //for (int i = 0; i < hotels.Count; i++) //{ // ListItem newItem = new ListItem() // { // Value = i.ToString(), // Text = hotels[i].H_name + " / " + hotels[i].R_type + " / " + hotels[i].Quantity, // }; // radList.Items.Add(newItem); //} } }