コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            GetWeatherInfo();               //get the weather informatio
        }
        bool verification = true;           //initialize the verification is true

        if (Session["countryName"] != null) //if the session for countryName is not null
        {
            //show the top 4 of attraction into gridview
            List <Attraction> attractions = AttractionDB.getTOP4AttractionByCountry(Session["countryName"].ToString(), verification);
            dlAttraction.DataSource = attractions;
            dlAttraction.DataBind();
        }
        else
        {
            Response.Redirect("AHRPage.aspx");
        }

        //show the top 4 of hotel into gridview
        List <Hotel> hotels = HotelDB.getTOP4HotelByCountry(Session["countryName"].ToString(), verification);

        dlHotel.DataSource = hotels;
        dlHotel.DataBind();
        //show the top 4 of restaurant into gridview
        List <Restaurant> restaurants = RestaurantDB.getTOP4RestaurantByCountry(Session["countryName"].ToString(), verification);

        dlRestaurant.DataSource = restaurants;
        dlRestaurant.DataBind();

        //if the session of countryName is not null
        if (Session["countryName"] != null)
        {
            //show the country name in label
            lblCountry.Text = Session["countryName"].ToString();
        }
    }