Esempio n. 1
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        if ((Request.Params["CountryID"] != null) && (Request.Params["CountryID"].Length > 0))
        {
            try
            {
                countryid = Convert.ToInt32(Request.Params["CountryID"]);
            }
            catch (Exception)
            {
            }
        }

        if (countryid == -1)
        {
            Response.Redirect(CommonFunctions.PrepareURL("InternalError.aspx"));
        }

        List <SqlParameter> param = new List <SqlParameter>();

        param.Add(new SqlParameter("@countryid", countryid));//[uspGetCountry_Prop_StateInfo]
        ds_allinfo = BookDBProvider.getDataSet("uspGetCountry_Prop_StateInfo", param);

        if (ds_allinfo.Tables.Count != 4)
        {
            Response.Redirect(CommonFunctions.PrepareURL("InternalError.aspx"));
        }

        region  = ds_allinfo.Tables[0].Rows[0]["Region"].ToString();
        country = ds_allinfo.Tables[0].Rows[0]["Country"].ToString();

        string vText = "Vacations-abroad.com is a " + country + " accommodation directory of " + country + " rentals by owner and privately owned " + country + " holiday accommodation. Our short term " + country + " rentals include luxury " +
                       country + " holiday homes, " + country + " vacation homes and " + country + " vacation home rentals which are perfect for group or family vacation rentals in " + country + " " + region;

        if (!IsPostBack)
        {
            //For country description
            lblCountryInfo.Text = ds_allinfo.Tables[0].Rows[0]["countryText"].ToString().Replace(Environment.NewLine, "<br />");
            txtCountryText.Text = ds_allinfo.Tables[0].Rows[0]["countryText"].ToString().Replace("<br />", Environment.NewLine);

            if (lblCountryInfo.Text == null || lblCountryInfo.Text == "")
            {
                lblCountryInfo.Text = vText;
                txtCountryText.Text = vText;
            }

            lblInfo2.Text = ds_allinfo.Tables[0].Rows[0]["countryText2"].ToString().Replace(Environment.NewLine, "<br />");
            if (string.IsNullOrEmpty(lblInfo2.Text) || lblInfo2.Text == "")
            {
                OrangeTitle.Visible = false;
            }
            txtCountryText2.Text = ds_allinfo.Tables[0].Rows[0]["countryText2"].ToString().Replace("<br />", Environment.NewLine);
        }



        /*    /////// common for postback and ! postback
         *  List<string> vList = new List<string>();
         *  DataTable dt = new DataTable();
         *  DataFunctions obj = new DataFunctions();
         *  DataTable dtCategories = new DataTable();
         *  DBConnection obj1 = new DBConnection();
         *
         *  try
         *  {
         *      if (!IsPostBack)
         *      {
         *          dt = obj.PropertiesByCase(vList, countryid, "Country");
         *          DataView dv = dt.DefaultView;
         *          dv.Sort = "category asc";
         *          dt = dv.ToTable();
         *          Session["dt"] = dt;
         *           int[] i = new int[4];
         *          i = FindNumAmenities(dt);
         *
         *          dtCategories = obj.FindNumCategories(dt);
         *          DataView dvMax = dtCategories.DefaultView;
         *          dvMax.Sort = "count desc";
         *          DataTable dtMax = dvMax.ToTable();
         *          int vCategoryCount = 0;
         *          string firstCategory = "";
         *          string subCategory = "";
         *          foreach (DataRow row in dtMax.Rows)
         *          {
         *              int index = dtMax.Rows.IndexOf(row);
         *              if (index == 0)
         *              {
         *                  firstCategory = row["category"].ToString();
         *                  subCategory = dt.Rows[0]["SubCategory"].ToString();
         *              }
         *              string vTemp = row["category"].ToString() + " (" + row["count"].ToString() + ")";
         *              vTemp = vTemp.Replace(" ", "&nbsp;");
         *              vCategoryCount = vCategoryCount + Convert.ToInt32(row["count"].ToString());
         *          }
         *
         *          if (!IsPostBack)
         *          {
         *
         *              //dtlStates.DataSource = dtCategories;
         *              //dtlStates.DataBind();
         *          }
         *          //numbedrooms filter
         *          dtCategories = obj.FindNumBedrooms(dt);
         *          int vBedCount = 0;
         *          foreach (DataRow row in dtCategories.Rows)
         *          {
         *              vBedCount += Convert.ToInt32(row["count"]);
         *          }
         *
         *          Page page = (Page)HttpContext.Current.Handler;
         *          if (Request.QueryString["category"] != null)
         *          {
         *              Response.Clear();
         *              Response.StatusCode = 404;
         *              Response.End();
         *          }
         *          if (dt.Rows.Count <= 10)
         *          {
         *              //Implement 404 logic less then 10 property with Prorerty in URL - Develop By Nimesh Sapovadiya
         *              if(Request.QueryString["category"] != null)
         *              {
         *                  Response.Clear();
         *                  Response.StatusCode = 404;
         *                  Response.End();
         *              }
         *              string dispString = "";
         *              string dispString2 = "";
         *              if (subCategory.Contains("_"))
         *              {
         *                  string[] strSplit = subCategory.Split('_');
         *                  dispString = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1]) + "s";
         *              }
         *              else
         *              {
         *                  dispString = UppercaseFirst(subCategory) + "s";
         *              }
         *              firstCategory = dt.Rows[0]["category"].ToString();
         *              if (firstCategory.Contains("_"))
         *              {
         *                  string[] strSplit = firstCategory.Split('_');
         *                  dispString2 = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1]) + "s";
         *              }
         *              else
         *              {
         *                  dispString2 = UppercaseFirst(firstCategory) + "s";
         *              }
         *
         *              altTag = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals";
         *              ltrH11.Text = char.ToUpper(country[0]) + country.Substring(1) + " Vacations";
         *              hyplnkBackLink.NavigateUrl = "/" + region.ToLower().Replace(" ", "_")+"/default.aspx";
         *              ltrBackText.Text = region + "<<";
         *      hyplnkAllProps.NavigateUrl = "/" + country.ToLower().Replace(" ", "_") + "/countryproperties.aspx";
         *              ltrAllProps.Text = " View all " + char.ToUpper(country[0]) + country.Substring(1) + " properties";
         *              string scountry=char.ToUpper(country[0]) + country.Substring(1);
         *              country = scountry;
         *              ltrHeading.Text = scountry + " Vacation Rentals and Boutique Hotels";
         *
         *              page.Title = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals, Boutique Hotels | Vacations Abroad";
         *
         *             string tempcountry1 = CommonFunctions.GetSiteAddress() + "/" + country.ToLower().Replace(" ", "_") +
         *                                         "/default.aspx";
         *
         *            /*  HtmlMeta description = new HtmlMeta();
         *              description.Name = "description";
         *              description.Content = "Plan your next " + char.ToUpper(country[0]) + country.Substring(1) + " vacation: where to stay and places to visit ";
         *              head.Controls.Add(description);
         *
         *          }
         *          else
         *          {
         *
         *              if (Request.QueryString["category"] != null)
         *              {
         *                  firstCategory = Convert.ToString(Request.QueryString["category"]);
         *              }
         *              {
         *                  string dispString = "";
         *                  string dispString2 = "";
         *                  if (subCategory.Contains("_"))
         *                  {
         *                      string[] strSplit = subCategory.Split('_');
         *                      dispString = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1])+"s";
         *                  }
         *                  else
         *                  {
         *                      dispString = UppercaseFirst(subCategory) + "s";
         *                  }
         *                  if (firstCategory.Contains("_"))
         *                  {
         *                      string[] strSplit = firstCategory.Split('_');
         *                      dispString2 = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1]) + "s";
         *                  }
         *                  else
         *                  {
         *                      dispString2 = UppercaseFirst(firstCategory) + "s";
         *                  }
         *                  altTag = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals";
         *                  ltrH11.Text = char.ToUpper(country[0]) + country.Substring(1) + " Vacations";
         *                  hyplnkBackLink.NavigateUrl = "/" + region.ToLower().Replace(" ", "_")+"/default.aspx";
         *                  ltrBackText.Text = region + " Vacations <<";
         *      hyplnkAllProps.NavigateUrl = "/" + country.ToLower().Replace(" ", "_") + "/countryproperties.aspx";
         *      ltrAllProps.Text = " View all " + char.ToUpper(country[0]) + country.Substring(1) + " properties";
         *                  string scountry = char.ToUpper(country[0]) + country.Substring(1);
         *                  country = scountry;
         *                  ltrHeading.Text = scountry + " Vacation Rentals and Boutique Hotels";
         *
         *                  //ltrCountryThing.Text = char.ToUpper(country[0]) + country.Substring(1);
         *                  page.Title = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals, Boutique Hotels | Vacations Abroad";
         *
         *              }
         *              if (firstCategory == "bandb")
         *              {
         *                  firstCategory = "B&B";
         *              }
         *
         *
         *              DataTable dtCategory = dt.Clone();
         *              foreach (DataRow dr in dt.Rows)
         *              {
         *                  string vTemp = dr["Category"].ToString();
         *                  if (vTemp.ToLower().Replace(" ", "").Trim() == firstCategory.ToLower().Replace("_", " ").Replace(" ", ""))
         *                  {
         *                      subCategory = dr["SubCategory"].ToString();
         *                      dtCategory.ImportRow(dr);
         *                  }
         *              }
         *              DataView dv1 = dtCategory.DefaultView;
         *              dv1.Sort = "MinNightRate desc";
         *
         *              if (Request.QueryString["category"] != null)
         *              {
         *                  string dispString = "";
         *                  if (firstCategory.Contains("_"))
         *                  {
         *                      string[] strSplit = firstCategory.Split('_');
         *                      dispString = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1])+"s";
         *                  }
         *                  else
         *                  {
         *                      dispString = UppercaseFirst(firstCategory) + "s";
         *                  }
         *                  ltrH11.Text = char.ToUpper(country[0]) + country.Substring(1) + " Vacations";
         *                  page.Title = char.ToUpper(country[0]) + country.Substring(1) + "Vacation Rentals, Boutique Hotels | Vacations Abroad";
         *                  altTag = subCategory + " in " + country;
         *                  Label3.Text = altTag;
         *              }
         *              else
         *              {
         *                  string dispString = "";
         *                  string dispString2 = "";
         *                  if (subCategory.Contains("_"))
         *                  {
         *                      string[] strSplit = subCategory.Split('_');
         *                      dispString = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1]) + "s";
         *                  }
         *                  else
         *                  {
         *                      dispString = UppercaseFirst(subCategory) + "s";
         *                  }
         *                  if (firstCategory.Contains("_"))
         *                  {
         *                      string[] strSplit = firstCategory.Split('_');
         *                      dispString2 = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1]) + "s";
         *                  }
         *                  else
         *                  {
         *                      dispString2 = UppercaseFirst(firstCategory) + "s";
         *                  }
         *                  altTag = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals";
         *                  ltrH11.Text = char.ToUpper(country[0]) + country.Substring(1) + " Vacations";
         *                  page.Title = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals, Boutique Hotels | Vacations Abroad";
         *
         *              }
         *              string tempcountry = CommonFunctions.GetSiteAddress() + "/" + country.ToLower().Replace(" ", "_") +
         *                                          "/default.aspx";
         *
         *
         *          }
         *
         *          ViewState["firstCategory"] = firstCategory;
         *          DataTable dt1 = new DataTable();
         *          try
         *          {
         *              dt1 = VADBCommander.CountryTextInd(countryid.ToString(), firstCategory);
         *          }
         *          catch (Exception ex) { lblInfo.Text = ex.Message; }
         *
         *          string vText = "Vacations-abroad.com is a " + country + " accommodation directory of " + country + " rentals by owner and privately owned " + country + " holiday accommodation. Our short term " + country + " rentals include luxury " +
         *         country + " holiday homes, " + country + " vacation homes and " + country + " vacation home rentals which are perfect for group or family vacation rentals in " + country + " " + region;
         *
         *          if (dt1.Rows.Count > 0)
         *          {
         *
         *              if (dt1.Rows[0]["countryText"] != null)
         *              {
         *                  if (!IsPostBack)
         *                  {
         *                      lblCountryInfo.Text = dt1.Rows[0]["countryText"].ToString();
         *                      txtCountryText.Text = dt1.Rows[0]["countryText"].ToString().Replace("<br />", Environment.NewLine);
         *                  }
         *                  ////Editor.Value = dt.Rows[0]["cityText"].ToString();
         *              }
         *              else
         *              {
         *                  lblCountryInfo.Text = vText;
         *                  txtCountryText.Text = vText;
         *              }
         *              if (dt1.Rows[0]["countryText2"] != null)
         *              {
         *                  if (!IsPostBack)
         *                  {
         *                      lblInfo2.Text = dt1.Rows[0]["countryText2"].ToString();
         *                      if (string.IsNullOrEmpty(lblInfo2.Text) || lblInfo2.Text == "")
         *                      {
         *                          OrangeTitle.Visible = false;
         *                      }
         *                      txtCountryText2.Text = dt1.Rows[0]["countryText2"].ToString().Replace("<br />", Environment.NewLine);
         *                  }
         *              }
         *              else
         *              {
         *                  OrangeTitle.Visible = false;
         *              }
         *          }
         *          else
         *          {
         *              lblCountryInfo.Text = vText;
         *              txtCountryText.Text = vText;
         *              OrangeTitle.Visible = false;
         *          }
         *      }
         *  }
         *  catch (Exception ex) { lblInfo.Text = ex.Message; }
         *
         *  DBConnection obj3 = new DBConnection();
         *  SqlDataReader reader = obj3.ExecuteRecordSetArtificial("SELECT Cities.* FROM Cities WHERE (Cities.StateProvinceID = " + stateprovinceid + ") " + "AND EXISTS ( SELECT * FROM Properties WHERE (Properties.IfFinished = 1) AND (Properties.IfApproved = 1) AND " + "(Properties.CityID = Cities.ID)  AND NOT EXISTS (SELECT * FROM Auctions WHERE PropertyID = Properties.ID)) ORDER " + "BY City");
         *  string states1 = "";
         *  string regionCountry = "";
         *  foreach (DataRow dr in MainDataSet.Tables["CountriesRegion"].Rows)
         *  {
         *      string temp = "/" + dr["Country"].ToString().ToLower().Replace(" ", "_") + "/default.aspx";
         *      temp = temp.ToLower();
         *      temp = temp.Replace(' ', '_');
         *      rtLow3.Text += "<li><a href=\"" + temp + "\"><span class=\"tdNoSleeps\">" + dr["Country"].ToString().Replace(" ", "&nbsp;") + ",&nbsp; </span></a></li>";
         *      states1 += "<a href=\"" + temp + "\"><span class=\"tdNoSleeps\" style=\"font-weight:normal;font-style:normal\">" + dr["Country"].ToString().Replace(" ", "&nbsp;") + "</span></a>, ";
         *      regionCountry = dr["Region"].ToString();
         *  }
         *  states1 = "";
         *  foreach (DataRow dr in MainDataSet.Tables["StateProvinces"].Rows)
         *  {
         *      string temp = "/" + country.ToLower().Replace(" ", "_") + "/" + dr["StateProvince"].ToString().ToLower().Replace(" ", "_") + "/default.aspx";
         *      states1 += "<a href=\"" + temp + "\"><span class=\"tdNoSleeps\" style=\"font-weight:normal;font-style:normal\">" + dr["StateProvince"].ToString().Replace(" ", "&nbsp;") + "</span></a>, ";
         *  }
         *
         *  states1 = "";
         *  string str_states = "";
         *
         *  int ind = 0;
         *  // string cls = " class='borderright' ";
         *  string cls = "border-right:1px solid #0094ff;";
         *  string li = "";
         *  foreach (DataRow dr in MainDataSet.Tables["StateProvinces"].Rows)
         *  {
         *      DataFunctions objcate = new DataFunctions();
         *      DataTable dt1 = new DataTable();
         *      dt = obj.PropertiesByCase(vList, Convert.ToInt32(dr["id"]), "State");
         *
         *      //li =" style='"+ ((ind > 4) ? "border-top:0px;" : "")+ (((ind++ % 5) == 4) ? cls : "")+"'";
         *
         *      string temp = "/" + country.ToLower().Replace(" ", "_") + "/" + dr["StateProvince"].ToString().ToLower().Replace(" ", "_") + "/default.aspx";
         *      states1 += "<li"+li +"><a href='" + temp + "' class='StateTitle'>" + dr["StateProvince"].ToString().Replace(" ", "&nbsp;") + "</a><br/> ";
         *      states1 += "<a href=\"" + temp + "\"><div class='drop-shadow effect4'><img width='160' height='125' src='/images/" + Convert.ToString(dt.Rows[0]["PhotoImage"]) + "' alt='" + Convert.ToString(dr["StateProvince"]) +" ' title='" + Convert.ToString(dr["StateProvince"])  + "' /></div></a></li>";
         *      //states1 += "<a href=\"" + temp + "\"><div class='drop-shadow effect4'><img width='160' height='125' src='/images/" + Convert.ToString(dt.Rows[0]["PhotoImage"]) + "' alt='" + Convert.ToString(dr["StateProvince"]) + " vacation rentals and boutique hotels in "+country+"' title='" + Convert.ToString(dr["StateProvince"]) + " vacation rentals and boutique hotels in " + country + "' /></div></a></li>";
         *      // states1 += "<a href=\"" + temp + "\"><div class='drop-shadow effect4'><img width='160' height='125' src='/images/" + Convert.ToString(dt.Rows[0]["PhotoImage"]) + "' alt='" + Convert.ToString(dr["propnum"]) + " properties in " + Convert.ToString(dr["StateProvince"]) + "' title='" + Convert.ToString(dr["propnum"]) + " properties in " + Convert.ToString(dr["StateProvince"]) + "' /></div></a></li>";
         *      //states1 += "<a href=\"" + temp + "\"><div class='drop-shadow effect4'><img width='160' height='125' src='/images/" + Convert.ToString(dt.Rows[0]["PhotoImage"]) + "' alt='" + Convert.ToString(dr["propnum"]) + " properties in " + Convert.ToString(dr["StateProvince"]) + "' title='" + Convert.ToString(dr["propnum"]) + " properties in " + Convert.ToString(dr["StateProvince"]) + "' /></div></a></li>";
         *      str_states += Convert.ToString(dr["StateProvince"]) + ", ";
         *      str_keyword += Convert.ToString(dr["StateProvince"]) + " " + country + ", ";
         *  }
         *  //rtLow3.Text = rtLow3.Text.Remove(rtLow3.Text.Length - 1, 1);
         *  rtHd3.InnerHtml = regionCountry + " Countries: ";
         *
         *
         *
         *
         *
         *  Statesul.InnerHtml = states1;
         *  //Page.Header.Controls.Add(new LiteralControl("<link href='http://vacations-abroad.com/css/StyleSheetBig4.css' rel='stylesheet' type='text/css'></script>"));
         *
         *
         *
         *  //For the meta tag
         *  str_meta = "(%number%) %country% vacation rentals and boutique hotels in %states% etc.";
         *  str_meta = str_meta.Replace("%country%", country).Replace("%states%", str_states).Replace("%number%", Convert.ToString(num_properties));
         *  str_keyword = str_keyword + "etc.";
         */
        //For meta tag
        int    num_states = ds_allinfo.Tables[1].Rows.Count;
        string str_states = "";

        for (int ind_state = 0; ind_state < num_states; ind_state++)
        {
            string  comma = (ind_state == (num_states - 1)) ? "" : ", ";
            DataRow row   = ds_allinfo.Tables[1].Rows[ind_state];
            str_states  += (row["StateProvince"].ToString() + comma);
            str_keyword += String.Format("{0} {1}{2}", row["StateProvince"].ToString(), country, comma);
        }

        string num_properties = ds_allinfo.Tables[3].Rows[0][0].ToString();

        if (num_states == 0)
        {
            Response.Redirect("/default.aspx");
        }
        // str_meta = String.Format("({0}) {1} vacation rentals and boutique hotels in {2} etc.", num_properties, country, str_states);
        str_meta    = String.Format("Explore {0} while staying in our vacation rentals and boutique hotels.", country);
        str_keyword = str_keyword + " etc.";


        //For google map
        List <SqlParameter> sparam = new List <SqlParameter>();

        sparam.Add(new SqlParameter("@countryid", countryid));
        ds_citylocations = BookDBProvider.getDataSet("uspGetCityLocationListbyCountry", sparam);

        markers = CommonProvider.getMarkersJsonString(ds_citylocations);
        sparam.Clear();
        sparam.Add(new SqlParameter("@country", country));
        ds_airports      = BookDBProvider.getDataSet("usp_list_airports_bycountry", sparam);
        airports_markers = CommonProvider.getMarkersJsonString(ds_airports, "airport");
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!int.TryParse(Request["CountryID"].ToString(), out countryid))
        {
            countryid = 0;
        }
        if (countryid == 0)
        {
            return;
        }
        List <SqlParameter> sparam = new List <SqlParameter>();

        sparam.Add(new SqlParameter("@countryid", countryid));
        ds_citylocations = BookDBProvider.getDataSet("uspGetCityLocationListbyCountry", sparam);

        markers = CommonProvider.getMarkersJsonString(ds_citylocations);

        /*
         * ClientScriptManager cs = Page.ClientScript;
         * string url = Request.Url.AbsoluteUri;
         * string[] token = url.Split('/');
         *
         * //cs.RegisterStartupScript(Page.GetType(), "JSON", "alert(" + token.Length + ");", true);
         * if (Convert.ToInt32(Request.QueryString["StateProvinceID"]) != null && Convert.ToInt32(Request.QueryString["StateProvinceID"]) > 0)
         * {
         *  SqlConnection con = CommonFunctions.GetConnection();
         *  CitiesAdapter = new SqlDataAdapter(STR_SELECTCitiesFROMCitiesWHERECitiesStateProvinceID, con);//CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), String.Format(STR_SELECTCitiesFROMCitiesWHERECitiesStateProvinceID), SqlDbType.Int);
         *  CitiesAdapter.SelectCommand.Parameters.Add("@StateId", SqlDbType.Int);
         *  CitiesAdapter.SelectCommand.Parameters["@StateId"].Value = Convert.ToInt32(Request.QueryString["StateProvinceID"]);
         *
         *
         *  //cs.RegisterStartupScript(Page.GetType(), "JSON", "alert(" + Convert.ToInt32(Request.QueryString["StateProvinceID"]) + ");", true);
         *
         *  DataTable dt = new DataTable();
         *  CitiesAdapter.Fill(dt);
         *  List<Location> eList = new List<Location>();
         *  string maxLat = "";
         *  string maxLong = "";
         *  foreach (DataRow dr in dt.Rows)
         *  {
         *      try
         *      {
         *          Location e1 = new Location();
         *          e1.title = dr["City"].ToString();
         *          e1.lat = Convert.ToDouble(dr["Latitude"]);
         *          e1.lng = Convert.ToDouble(dr["Longitude"]); ;
         *          e1.description = dr["City"].ToString();
         *          string temp = "/" + dr["Country"].ToString().ToLower().Replace(" ", "_") +
         *           "/" + dr["StateProvince"].ToString().ToLower().Replace(" ", "_") + "/" + dr["City"].ToString().ToLower().Replace(" ", "_") + "/default.aspx";
         *          e1.URL = temp;
         *          eList.Add(e1);
         *      }
         *      catch { }
         *  }
         *  // Response.Write(CitiesAdapter.SelectCommand.CommandText);
         *  string ans = JsonConvert.SerializeObject(eList, Formatting.Indented);
         *
         *
         *
         *  // ClientScriptManager cs = Page.ClientScript;
         *  cs.RegisterStartupScript(Page.GetType(), "JSON", "initialize(" + ans + ");", true);
         * }
         * else
         *  if (token.Length == 4)
         *  {
         *      SqlConnection con = CommonFunctions.GetConnection();
         *      CitiesAdapter = new SqlDataAdapter(STR_SELECTCitiesFROMCitiesWHERECitiesCountryId, con);//CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), String.Format(STR_SELECTCitiesFROMCitiesWHERECitiesStateProvinceID), SqlDbType.Int);
         *      CitiesAdapter.SelectCommand.Parameters.Add("@CountryID", SqlDbType.Int);
         *      CitiesAdapter.SelectCommand.Parameters["@CountryID"].Value = Convert.ToInt32(Request.QueryString["CountryID"]);
         *
         *      DataTable dt = new DataTable();
         *      CitiesAdapter.Fill(dt);
         *      List<Location> eList = new List<Location>();
         *      string maxLat = "";
         *      string maxLong = "";
         *      foreach (DataRow dr in dt.Rows)
         *      {
         *          try
         *          {
         *              Location e1 = new Location();
         *              e1.title = dr["City"].ToString();
         *              e1.lat = Convert.ToDouble(dr["Latitude"]);
         *              e1.lng = Convert.ToDouble(dr["Longitude"]); ;
         *              e1.description = dr["City"].ToString();
         *              string temp = "/" + dr["Country"].ToString().ToLower().Replace(" ", "_") +
         *               "/" + dr["StateProvince"].ToString().ToLower().Replace(" ", "_") + "/" + dr["City"].ToString().ToLower().Replace(" ", "_") + "/default.aspx";
         *              e1.URL = temp;
         *              eList.Add(e1);
         *          }
         *          catch { }
         *      }
         *      // Response.Write(CitiesAdapter.SelectCommand.CommandText);
         *      string ans = JsonConvert.SerializeObject(eList, Formatting.Indented);
         *
         *
         *
         *
         *      cs.RegisterStartupScript(Page.GetType(), "JSON", "initialize(" + ans + ");", true);
         *  }
         */
    }
    protected void Page_Load(object sender, System.EventArgs e)
    {
        //Check the state province id;
        if (!Int32.TryParse(Request["StateProvinceID"].ToString(), out stateprovinceid))
        {
            stateprovinceid = -1;
        }
        if (stateprovinceid == -1)
        {
            Response.Redirect("/internalerror.aspx");
        }

        List <SqlParameter> sparam = new List <SqlParameter>();

        sparam.Add(new SqlParameter("@stateid", stateprovinceid));

        countryinfo     = CommonProvider.ConvertToClassFromDataSet <CountryInfoWithCityID>(BookDBProvider.getDataSet("uspGetCountryInfoWithStateID", sparam));
        str_propcate[0] = String.Format("{0} {1}", countryinfo.StateProvince, str_propcate[0]);
        str_propcate[1] = String.Format("{0} {1}", countryinfo.StateProvince, str_propcate[1]);

        //For H1 title, state province text, links
        hyperRegion.NavigateUrl           = "/" + countryinfo.Region.ToLower().Replace(" ", "_") + "/default.aspx";
        hyplnkCountryBackLink.NavigateUrl = "/" + countryinfo.Country.ToLower().Replace(" ", "_") + "/default.aspx";


        ltrHeading.Text = String.Format("{0} Vacation Rentals and Boutique Hotels", countryinfo.StateProvince);

        //For stepbox radio button value, description text
        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;
            rproptype_id = 0;
            rbedroom_id  = 0;
            ramenity_id  = 0;
            rsort_id     = 0;
            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"]);
        }


        ltrH1.Text       = countryinfo.StateProvince + " Vacations";
        lblcityInfo.Text = Server.HtmlDecode(countryinfo.CityText).Replace(Environment.NewLine, "<br />");
        if (countryinfo.CityText == null || countryinfo.CityText == "")
        {
            lblcityInfo.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);
            txtCityText.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);
        }

        //Get the step box value

        List <SqlParameter> numparam = new List <SqlParameter>();

        for (int i = 0; i < 4; i++)
        {
            numparam.Clear();
            numparam.Add(new SqlParameter("@stateid", stateprovinceid));
            numparam.Add(new SqlParameter("@roomnum", i));
            numparam.Add(new SqlParameter("@amenityid", ramenity_id));
            numparam.Add(new SqlParameter("@proptype", rproptype_id));
            bedroominfo[i] = CommonProvider.getScalarValueFromDB("uspGetStatePropNumsByCondition", numparam);
        }

        for (int i = 0; i < 5; i++)
        {
            numparam.Clear();
            numparam.Add(new SqlParameter("@stateid", stateprovinceid));
            numparam.Add(new SqlParameter("@roomnum", rbedroom_id));
            numparam.Add(new SqlParameter("@proptype", rproptype_id));
            numparam.Add(new SqlParameter("@amenityid", amenity_id[i]));
            amenity_nums[i] = CommonProvider.getScalarValueFromDB("uspGetStatePropNumsByCondition", numparam);
        }

        for (int i = 0; i < 3; i++)
        {
            numparam.Clear();
            numparam.Add(new SqlParameter("@stateid", stateprovinceid));
            numparam.Add(new SqlParameter("@proptype", prop_typeval[i]));
            // numparam.Add(new SqlParameter("@roomnum", rbedroom_id));
            //numparam.Add(new SqlParameter("@proptype", rproptype_id));
            // numparam.Add(new SqlParameter("@amenityid", ramenity_id));
            prop_nums[i] = CommonProvider.getScalarValueFromDB("uspGetStatePropNumsByCondition", numparam);
        }


        //Get the property list for the state province

        List <SqlParameter> dsparam = new List <SqlParameter>();

        dsparam.Add(new SqlParameter("@stateid", stateprovinceid));
        dsparam.Add(new SqlParameter("@proptype", rproptype_id));
        dsparam.Add(new SqlParameter("@roomnum", rbedroom_id));
        dsparam.Add(new SqlParameter("@amenityid", ramenity_id));
        dsparam.Add(new SqlParameter("@ratesort", rsort_id));
        ds_PropList = BookDBProvider.getDataSet("uspGetStatePropListByCondition", dsparam);

        if (!IsPostBack)
        {
            if (ds_PropList.Tables[0].Rows.Count == 0)
            {
                Response.StatusCode = 404;
                // Response.Status = "There is no state province";
                Response.End();
            }
        }

        //Get the city location info
        List <SqlParameter> param = new List <SqlParameter>();

        param.Clear();
        param.Add(new SqlParameter("@stateid", stateprovinceid));
        param.Add(new SqlParameter("@proptype", rproptype_id));
        param.Add(new SqlParameter("@roomnum", rbedroom_id));
        param.Add(new SqlParameter("@amenityid", ramenity_id));
        ds_citylocations = BookDBProvider.getDataSet("uspGetCityLocationListbyCondition", param);
        markers          = CommonProvider.getMarkersJsonString(ds_citylocations);

        sparam.Clear();
        sparam.Add(new SqlParameter("@state", countryinfo.StateProvince));
        ds_airports     = BookDBProvider.getDataSet("usp_list_airports_bystate", sparam);
        airport_markers = CommonProvider.getMarkersJsonString(ds_airports, "airport");


        lblInfo2.Text = Server.HtmlDecode(countryinfo.CityText2).Replace(Environment.NewLine, "<br />");

        param.Clear();
        param.Add(new SqlParameter("@stateid", stateprovinceid));
        //For state list
        ds_statelist = BookDBProvider.getDataSet("uspGetStateNameListbyCondition", param);

        int citycount = ds_citylocations.Tables[0].Rows.Count;

        for (int stid = 0; stid < citycount; stid++)
        {
            DataRow drow  = ds_citylocations.Tables[0].Rows[stid];
            string  comma = (stid == (citycount - 1)) ? "" : ", ";
            city_lists += (drow["City"] + comma);
            list_city.Add(drow["City"].ToString());
        }

        /*
         *
         *      HtmlHead head = Page.Header;
         *
         *
         *
         *
         *      //FillCitiesColumn();
         *      /* HtmlMeta description = new HtmlMeta();
         *
         *       description.Name = "description";
         *       description.Content = Description.Text.Replace("%country%", country).Replace("%stateprovince%", stateprovince).
         *           Replace("%cities%", cities);
         *       // Description OVER RIDE area
         *
         *       string DescripReplacement = MainDataSet.Tables["Location"].Rows[0]["descriptionoverride"].ToString();
         *       if (DescripReplacement.Length > 0)
         *           description.Content = DescripReplacement;
         *      description.Content = "Plan your next " + stateprovince + " vacation: where to stay and places to visit!";
         *
         *      head.Controls.Add(description);
         *      /////
         *      List<SqlParameter> param = new List<SqlParameter>();
         *      param.Add(new SqlParameter("@stid", stateprovinceid));
         *      ds_PTypeNum = BookDBProvider.getDataSet("uspGetPropNumListbyState", param);
         *
         * ///*       if (!IsPostBack)
         * //      {
         *          List<SqlParameter> sparam = new List<SqlParameter>();
         *          sparam.Add(new SqlParameter("@stid", stateprovinceid));
         *          ds_PropList = BookDBProvider.getDataSet("uspGetStatePropList", sparam);
         *
         *           sparam.Clear();
         *          sparam.Add(new SqlParameter("@stid", stateprovinceid));
         *          ds_citylocations = BookDBProvider.getDataSet("uspGetCityLocationListbyCondition", sparam);
         *
         *      markers = CommonProvider.getMarkersJsonString(ds_citylocations);
         *      // }
         *
         *      if (IsPostBack)
         *      {
         *          ptype = int.Parse(Request["ptypes"]);
         *          psleep = int.Parse(Request["psleep"]);
         *      }
         *
         *      for (int i=0; i < 4; i++)
         *      {
         *          param.Clear();
         *          param.Add(new SqlParameter("@stid", stateprovinceid));
         *          param.Add(new SqlParameter("@sleep", i));
         *          param.Add(new SqlParameter("@ptype", ptype));
         *          DataSet ds_tmp = BookDBProvider.getDataSet("uspGetStatePropNumListbySleep",param);
         *          sleeps[i] = int.Parse(ds_tmp.Tables[0].Rows[0]["Num"].ToString());
         *      }
         *
         *
         *
         *
         *      Page page1 = (Page)HttpContext.Current.Handler;
         *
         *
         *      HtmlMeta newdescription = new HtmlMeta();
         *
         *      int counts = AjaxProvider.getPropertyNumsbyState(stateprovinceid);
         *
         *      string str_meta = "(%counts%) %state% vacation rentals and boutique hotels in %cities%.";
         *      newdescription.Name = "description";
         *      newdescription.Content = str_meta.Replace("%state%", stateprovince ).Replace("%cities%", str_cities).Replace("%counts%", ds_PropList.Tables[0].Rows.Count.ToString());
         *
         *      head.Controls.Add(newdescription);
         *
         *
         *
         *      HtmlMeta keywords = new HtmlMeta();
         *
         *      keywords.Name = "keywords";
         *      keywords.Content = Keywords.Text.Replace("%country%", country).Replace("%stateprovince%", stateprovince).
         *          Replace("%cities%", cities);
         *      keywords.Content = page1.Title;
         *      head.Controls.Add(keywords);
         *     // ((System.Web.UI.WebControls.Image)Master.FindControl("Logo")).AlternateText = page1.Title;
         *     // Page.Header.Controls.Add(new LiteralControl("<link href='http://vacations-abroad.com/css/StyleSheetBig4.css' rel='stylesheet' type='text/css'></script>"));
         */
    }