Beispiel #1
0
    public static AjaxPropListSet getAjaxAllPropListSetWithCityID(int cityid, int proptype, int amenitytype, int roomnum, int sorttype)
    {
        AjaxPropListSet prop_set = new AjaxPropListSet();
        //prop_set.allnums = getNumbersOfCityID(cityid, proptype, amenitytype, roomnum);
        List <PropertyAmenityInfo> propertyList = new List <PropertyAmenityInfo>();

        List <PropertyDetailInfo> prop_detail = new List <PropertyDetailInfo>();


        //  adapter.Fill(customers, "Customers");
        try
        {
            using (SqlConnection con = new SqlConnection(connString))
            {
                /*   @keyword nvarchar(200) ='',
                 * @proptype int= 0,
                 * @roomnum int= 0,
                 * @amenityid int= 0
                 */
                con.Open();
                SqlCommand cmd = new SqlCommand("uspGetAllPropertiesWithCityID", con);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add("@cityid", SqlDbType.Int).Value    = cityid;
                cmd.Parameters.Add("@proptype", SqlDbType.Int).Value  = proptype;
                cmd.Parameters.Add("@roomnum", SqlDbType.Int).Value   = roomnum;
                cmd.Parameters.Add("@amenityid", SqlDbType.Int).Value = amenitytype;
                cmd.Parameters.Add("@ratesort", SqlDbType.Int).Value  = sorttype;
                //   @pagenum int =0,
                //@ratesort int= 0
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    PropertyDetailInfo tmp   = new PropertyDetailInfo();
                    PropertyInfo[]     props = tmp.GetType().GetProperties();
                    foreach (PropertyInfo prop_info in props)
                    {
                        prop_info.SetValue(tmp, Convert.ChangeType(reader[prop_info.Name], prop_info.PropertyType), null);
                    }
                    prop_detail.Add(tmp);
                }

                con.Close();
            }
        }
        catch (Exception ex)
        {
        }

        foreach (PropertyDetailInfo propinfo in prop_detail)
        {
            PropertyAmenityInfo propamenity = new PropertyAmenityInfo();
            propamenity.detail = propinfo;
            try
            {
                using (SqlConnection con = new SqlConnection(connString))
                {
                    con.Open();
                    SqlCommand cmd = new SqlCommand("uspGetAmenity", con);
                    cmd.CommandType = CommandType.StoredProcedure;

                    cmd.Parameters.Add("@propid", SqlDbType.Int).Value = propinfo.ID;

                    SqlDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        AmenityInfo tmp = new AmenityInfo();
                        tmp.ID      = Convert.ToInt32(reader["ID"]);
                        tmp.Amenity = reader["Amenity"].ToString();
                        propamenity.amenity.Add(tmp);
                    }

                    con.Close();
                }
            }
            catch (Exception ex)
            {
            }
            propertyList.Add(propamenity);
        }
        prop_set.propertyList = propertyList;
        prop_set.allnums      = propertyList.Count;
        return(prop_set);
    }
Beispiel #2
0
    //live
    protected void Page_Load(object sender, System.EventArgs e)
    {
        //Response.Clear();
        //Response.StatusCode = 404;
        //Response.End();
        //HttpResponse.RemoveOutputCacheItem("/CityList.aspx");
        //CommonFunctions.Connection.Open ();


        if ((Request.Params["CityID"] != null) && (Request.Params["CityID"].Length > 0))
        {
            try
            {
                cityid = Convert.ToInt32(Request.Params["CityID"]);
            }
            catch (Exception)
            {
            }
        }
        //lblcity.Text = cityid.ToString();
        //cityid = 3031;
        if (cityid == -1)
        {
            Response.Redirect(CommonFunctions.PrepareURL("InternalError.aspx"));
        }

        //  cityid = 3031;
        // propertyset = SearchProvider.getPropertyListInfoSet(strkeyword, 0, 0, 0);
        // propertylist.DataSource = propertyset;
        // propertylist.DataBind();
        // propertytypes = SearchProvider.getPropertyTypeListSet(strkeyword);
        for (int i = 0; i < 4; i++)
        {
            bedroominfo[i] = SearchProvider.getNumbersOfCityID(cityid, 0, 0, i);
        }
        for (int i = 0; i < 5; i++)
        {
            amenity_nums[i] = SearchProvider.getNumbersOfCityID(cityid, 0, amenity_id[i], 0);
        }

        for (int i = 0; i < 3; i++)
        {
            prop_nums[i] = SearchProvider.getNumbersOfCityID(cityid, prop_typeval[i], 0, 0);
        }
        // ajax_proplist = SearchProvider.getAjaxPropListSet(strkeyword, 0, 0, 0, 0, 0);

        // Response.Write(cityid + " City");
        //Response.Write(cityid);

        countryinfo = SearchProvider.getCountryInfoCityID(cityid);

        hyperRegion.NavigateUrl           = "/" + countryinfo.Region.ToLower().Replace(" ", "_") + "/default.aspx";
        hyplnkCountryBackLink.NavigateUrl = "/" + countryinfo.Country.ToLower().Replace(" ", "_") + "/default.aspx";
        hyplnkStateBackLink.NavigateUrl   = "/" + countryinfo.Country.ToLower().Replace(" ", "_") + "/" + countryinfo.StateProvince.ToLower().Replace(" ", "_") + "/default.aspx";

        ltrH11.Text  = countryinfo.City + " Vacations";
        lblcity.Text = Server.HtmlDecode(countryinfo.CityText);
        if (countryinfo.CityText == null || countryinfo.CityText == "")
        {
            lblcity.Text = String.Format("Vacations-abroad.com is a {0} {1} vacation rental directory of short term {0} vacation condos, privately owned {0} villas and {0} rentals by owner. Our unique and exotic boutique {0} hotels and luxury {0} resorts are perfect {0} {1} rentals for family and groups that are looking for vacation rentals in {0} {1}", countryinfo.City, countryinfo.Country);
        }

        DataSet ds = AjaxProvider.getProCatNumsbyCity(cityid);

        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            meta_str += String.Format("{1}s ({0}), ", ds.Tables[0].Rows[i][0], ds.Tables[0].Rows[i][1]).Replace("&", " ");
        }
        int ind_last = meta_str.Length - 2;

        meta_str = meta_str.Substring(0, (ind_last > 0)?ind_last:0);

        if (!IsPostBack)
        {
            txtCityText.Text  = Server.HtmlDecode(countryinfo.CityText).Replace("<br />", Environment.NewLine);
            txtCityText2.Text = Server.HtmlDecode(countryinfo.CityText2).Replace("<br />", Environment.NewLine);
            //txtCityText2.Text = countryinfo.CityText2;
            CityParam.Value = cityid.ToString();
            rproptype_id    = 0;
            rbedroom_id     = 0;
            ramenity_id     = 0;
            rsort_id        = 1;
            pagenum         = 0;
        }
        else
        {
            rproptype_id = Int32.Parse(Request.Form["proptype"]);
            rbedroom_id  = Int32.Parse(Request.Form["roomnums"]);
            ramenity_id  = Int32.Parse(Request.Form["amenitytype"]);
            rsort_id     = Int32.Parse(Request.Form["pricesort"]);
            pagenum      = Int32.Parse(Request.Form["pagenums"]);
        }


        proplistset = SearchProvider.getAjaxAllPropListSetWithCityID(cityid, rproptype_id, ramenity_id, rbedroom_id, rsort_id);
        for (int i = 0; i < proplistset.allnums; i++)
        {
            list_rating.Add(BookDBProvider.getRatingbyID(proplistset.propertyList[i].detail.ID));
        }
        // Response.Write(cityid);
        //<meta name="description" content="<%=countryinfo.City %>, <%=countryinfo.StateProvince %> <%=meta_str %>" />
        //  HtmlMeta newdescription = new HtmlMeta();

        //  newdescription.Name = "description";
        //  newdescription.Content = Server.HtmlDecode(String.Format("Our {0}, {1} vacation rentals and boutique hotels include: {2} ", countryinfo.City, countryinfo.StateProvince,meta_str));
        newdescription = String.Format("Our {0}, {1} vacation rentals and boutique hotels include: {2} ", countryinfo.City, countryinfo.StateProvince, meta_str);
        city_ds        = AjaxProvider.getCityListbyCityNum(cityid);
        //  Page.Header.Controls.Add(newdescription);
    }