public static string GetCities(string searchterm)
        {
            JavaScriptSerializer jss = new JavaScriptSerializer();

            ISearchManager searchmanager = SearchManagerFactory.GetInstance().Create();

            return(jss.Serialize(searchmanager.GetCities().Where(e => e.Name.ToLower().Contains(searchterm))));
        }
        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");
                }
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         SearchManagerFactory sf     = SearchManagerFactory.GetInstance();
         List <City>          cities = sf.Create().GetCities();
         dpCity.Items.Add("None");
         foreach (City c in cities)
         {
             ListItem item = new ListItem(c.Name, c.CityId.ToString());
             dpCity.Items.Add(item);
         }
         dpCity.DataBind();
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SearchManagerFactory sf     = SearchManagerFactory.GetInstance();
                List <City>          cities = sf.Create().GetCities();

                foreach (City c in cities)
                {
                    ListItem item = new ListItem(c.Name, c.CityId.ToString());
                    dpCity.Items.Add(item);
                }

                long hotelId = Convert.ToInt64(Request.QueryString["hotelid"]);

                Hotel hotel = GetHotelByIdFromDataset(hotelId);
                if (hotel != null)
                {
                    txtHotelId.Text   = hotel.HotelId.ToString();
                    txtHotelName.Text = hotel.HotelName;
                    txtBrief.Text     = hotel.BriefNote;
                    txtAddress.Text   = hotel.Address;

                    for (int i = 0; i < cities.Count; ++i)
                    {
                        if (hotel.CityID == cities[i].CityId)
                        {
                            dpCity.SelectedIndex = i;
                            break;
                        }
                    }

                    dpStarRanking.SelectedIndex = hotel.StarRanking;
                    txtPincode.Text             = hotel.Pincode;
                    txtContact.Text             = hotel.ContactNo;
                    txtEMail.Text   = hotel.Email;
                    txtPhoto.Text   = hotel.PhotoUrl;
                    txtWebsite.Text = hotel.WebsiteURL;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ISearchManager Manager = SearchManagerFactory.GetInstance().Create();
            City           From    = new City();

            From.CityId = 32;
            From.Name   = "Bangalore";

            City To = new City();

            To.CityId = 58;
            To.Name   = "Bangalore";

            SearchInfo info = new SearchInfo();

            info.FromCity  = From;
            info.ToCity    = To;
            info.Direction = TravelDirection.Return;
            info.Class     = TravelClass.Economy;

            Manager.SearchForFlights(info);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    long   FromCityId  = Convert.ToInt64(Request.QueryString["frmid"].ToString());
                    long   ToCityId    = Convert.ToInt64(Request.QueryString["toid"].ToString());
                    string flightclass = Request.QueryString["clss"].ToString();
                    int    td          = Convert.ToInt16(Request.QueryString["td"].ToString());

                    hdnTravelDirection.Value = td.ToString();
                    lblHeaderDepart.Text     = Convert.ToDateTime(Request.QueryString["depart_date"]).ToString("ddd, dd MMM, yyyy");
                    lblHeaderReturn.Text     = Convert.ToDateTime(Request.QueryString["return_date"]).ToString("ddd, dd MMM, yyyy");

                    TravelDirection traveldirection = (TravelDirection)td;
                    SearchInfo      searchinfo      = new SearchInfo();
                    City            fromcity        = new City();
                    searchinfo.OnwardDateOfJourney = Convert.ToDateTime(Request.QueryString["depart_date"]);
                    searchinfo.ReturnDateOfJourney = Convert.ToDateTime(Request.QueryString["return_date"]);
                    fromcity.CityId = FromCityId;
                    City tocity = new City();
                    tocity.CityId = ToCityId;
                    TravelClass travelclass = (TravelClass)Enum.Parse(typeof(TravelClass), flightclass);
                    searchinfo.FromCity  = fromcity;
                    searchinfo.ToCity    = tocity;
                    searchinfo.Class     = travelclass;
                    searchinfo.Direction = traveldirection;

                    ISearchManager searchmanager = SearchManagerFactory.GetInstance().Create();
                    SearchLog      searchlog     = searchmanager.SearchForFlights(searchinfo);

                    SearchResult searchresult = searchlog.GetSearchResult(TravelDirection.OneWay);

                    List <TravelSchedule> lstTravelSchedule = searchresult.GetTravelSchedules();
                    dlOuterOnward.DataSource = lstTravelSchedule;
                    dlOuterOnward.DataBind();

                    Session["flightbookingonwardresults"] = lstTravelSchedule;

                    if (lstTravelSchedule.Count > 0)
                    {
                        lblOneWayFromCity.Text = lblHeaderFromCity.Text = lstTravelSchedule[0].GetSchedules()[0].RouteInfo.FromCity.Name;
                        lblOneWayToCity.Text   = lblHeaderToCity.Text = lstTravelSchedule[0].GetSchedules()[0].RouteInfo.ToCity.Name;
                    }

                    if (traveldirection == TravelDirection.Return)
                    {
                        SearchResult searchresultreturn = searchlog.GetSearchResult(TravelDirection.Return);

                        List <TravelSchedule> lstTravelScheduleReturn = searchresultreturn.GetTravelSchedules();
                        dlOuterReturn.DataSource = lstTravelScheduleReturn;
                        dlOuterReturn.DataBind();

                        Session["flightbookingreturnresults"] = lstTravelScheduleReturn;

                        if (lstTravelScheduleReturn.Count > 0)
                        {
                            lblReturnFromCity.Text = lstTravelScheduleReturn[0].GetSchedules()[0].RouteInfo.FromCity.Name;
                            lblReturnToCity.Text   = lstTravelScheduleReturn[0].GetSchedules()[0].RouteInfo.ToCity.Name;
                        }
                    }
                    else
                    {
                        outbound_div.Style.Add("width", "70%");
                        return_div.Visible             = false;
                        lblHeaderReturn.Visible        = false;
                        lblHeaderDateSeparator.Visible = false;
                    }
                }
                catch
                {
                    Response.Redirect("~/Error.aspx");
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    //Get all the information from query string
                    long   FromCityId   = Convert.ToInt64(Request.QueryString["fromid"].ToString());
                    long   ToCityId     = Convert.ToInt64(Request.QueryString["toid"].ToString());
                    string FromCityName = Request.QueryString["fromCityName"].ToString();
                    string ToCityName   = Request.QueryString["toCityName"].ToString();
                    string flightclass  = Request.QueryString["class"].ToString();
                    int    td           = Convert.ToInt16(Request.QueryString["td"].ToString());
                    string adults       = Request.QueryString["adults"].ToString();

                    //Display the header information
                    lblAdults.Text           = adults;
                    hdnTravelDirection.Value = td.ToString();
                    if (Request.QueryString["depart_date"] != null)
                    {
                        lblHeaderDepart.Text = Convert.ToDateTime(Request.QueryString["depart_date"]).ToString("ddd, dd MMM, yyyy");
                    }

                    if (Request.QueryString["return_date"] != null)
                    {
                        lblHeaderReturn.Text = Convert.ToDateTime(Request.QueryString["return_date"]).ToString("ddd, dd MMM, yyyy");
                    }

                    TravelDirection traveldirection = (TravelDirection)td;

                    City fromcity = new City();
                    fromcity.CityId = FromCityId;
                    fromcity.Name   = FromCityName;

                    City tocity = new City();
                    tocity.CityId = ToCityId;
                    tocity.Name   = ToCityName;

                    DateTime onwardDateOfJourney = new DateTime();

                    if (Request.QueryString["depart_date"] != null)
                    {
                        onwardDateOfJourney = Convert.ToDateTime(Request.QueryString["depart_date"]);
                    }

                    DateTime returnDateOfJourney = new DateTime();
                    if (Request.QueryString["return_date"] != null)
                    {
                        returnDateOfJourney = Convert.ToDateTime(Request.QueryString["return_date"]);
                    }
                    TravelClass travelclass = (TravelClass)Enum.Parse(typeof(TravelClass), flightclass);

                    //Calling the Parameterized Constructor
                    //This is done once the class variables are set to private set
                    //and a paramterized constructor is introduced
                    //Using VS - Effectively - CR - STYCBG09.01
                    SearchInfo searchinfo = new SearchInfo(fromcity, tocity, onwardDateOfJourney, returnDateOfJourney, Convert.ToInt32(adults), travelclass, traveldirection);

                    //Contact the search manager and get all the schedules as a search log
                    ISearchManager searchmanager = SearchManagerFactory.GetInstance().Create();
                    SearchLog      searchlog     = searchmanager.SearchForFlights(searchinfo);

                    SearchResult searchresult = searchlog.GetSearchResult(TravelDirection.OneWay);

                    List <TravelSchedule> lstTravelSchedule = searchresult.GetTravelSchedules();
                    dlOuterOnward.DataSource = lstTravelSchedule;
                    dlOuterOnward.DataBind();

                    Session["flightbookingonwardresults"] = lstTravelSchedule;
                    Session["SearchInfo"] = searchinfo;

                    if (lstTravelSchedule.Count > 0)
                    {
                        lblOneWayFromCity.Text = lblHeaderFromCity.Text = searchinfo.FromCity.Name;
                        lblOneWayToCity.Text   = lblHeaderToCity.Text = searchinfo.ToCity.Name;
                    }

                    if (traveldirection == TravelDirection.Return)
                    {
                        SearchResult searchresultreturn = searchlog.GetSearchResult(TravelDirection.Return);

                        List <TravelSchedule> lstTravelScheduleReturn = searchresultreturn.GetTravelSchedules();
                        dlOuterReturn.DataSource = lstTravelScheduleReturn;
                        dlOuterReturn.DataBind();

                        Session["flightbookingreturnresults"] = lstTravelScheduleReturn;

                        if (lstTravelScheduleReturn.Count > 0)
                        {
                            lblReturnFromCity.Text = searchinfo.ToCity.Name;
                            lblReturnToCity.Text   = searchinfo.FromCity.Name;
                        }
                    }
                    else
                    {
                        outbound_div.Style.Add("width", "70%");
                        return_div.Visible             = false;
                        lblHeaderReturn.Visible        = false;
                        lblHeaderDateSeparator.Visible = false;
                    }
                }
                catch (Exception ex)
                {
                    lblError.Visible = true;
                    lblError.Text    = ex.Message;
                }
            }
        }