Exemple #1
0
 protected void State_datagrid_PageIndexChanging1(object sender, GridViewPageEventArgs e)
 {
     State_datagrid.PageIndex  = e.NewPageIndex;
     Session["curPage"]        = e.NewPageIndex;
     State_datagrid.DataSource = (DataTable)Session["dt"];
     State_datagrid.DataBind();
 }
Exemple #2
0
    protected void rdoTypes_SelectedIndexChanged(object sender, EventArgs e)
    {
        //recalculate #totals for other rdo's
        if (Session["dt"] != null)
        {
            DataTable     dtCategories = new DataTable();
            DataFunctions obj          = new DataFunctions();
            DataTable     dt           = (DataTable)Session["dt"];

            State_datagrid.DataSource = dt;
            State_datagrid.DataBind();

            dtCategories = dt;
            string[] vTypeSelect;
            vTypeSelect    = rdoTypes.SelectedItem.Text.Split('(');
            vTypeSelect[0] = vTypeSelect[0].Replace(" ", " ");

            if (vTypeSelect[0].Trim() != "Display All")
            {
                dtCategories.DefaultView.RowFilter = "Category = '" + vTypeSelect[0].Trim() + "'";
            }

            //
            Session["dtRecalc"] = dtCategories.DefaultView.ToTable();
            //numbedrooms rdo
            dtCategories = obj.FindNumBedrooms(dtCategories.DefaultView.ToTable());


            rdoBedrooms.Items[0].Text = "0-2 Bedrooms (" + dtCategories.Rows[0]["count"].ToString() + ")  ";
            rdoBedrooms.Items[1].Text = "3-4 Bedrooms (" + dtCategories.Rows[1]["count"].ToString() + ")  ";
            rdoBedrooms.Items[2].Text = "5+ Bedrooms (" + dtCategories.Rows[2]["count"].ToString() + ")  ";
            int vBedCount = 0;
            foreach (DataRow row in dtCategories.Rows)
            {
                vBedCount += Convert.ToInt32(row["count"]);
            }
            rdoBedrooms.Items[3].Text = "Display All (" + vBedCount.ToString() + ") ";
            //rdoBedrooms.DataBind();

            //amenities rdo
            int[] i = new int[4];
            i = FindNumAmenities(dt.DefaultView.ToTable());

            rdoFilter.Items[0].Text = "Hot Tub (" + i[0].ToString() + ") ";
            rdoFilter.Items[1].Text = "Internet (" + i[1].ToString() + ") ";
            rdoFilter.Items[2].Text = "Pets (" + i[2].ToString() + ") ";
            rdoFilter.Items[3].Text = "Pool (" + i[3].ToString() + ") ";
            rdoFilter.Items[4].Text = "Display All (" + dt.DefaultView.ToTable().Rows.Count.ToString() + ") ";
            //rdoFilter.DataBind();
        }
        rdoBedrooms.SelectedIndex = 3;

        rdoFilter.SelectedIndex = 4;
    }
Exemple #3
0
    protected void rdoBedrooms_SelectedIndexChanged(object sender, EventArgs e)
    {
        DataTable dtBedrooms = new DataTable();
        DataTable dt         = new DataTable();

        //if (rdoBedrooms.SelectedIndex != 3)
        //{
        //recalculate #totals for other rdo's

        if (Session["dtRecalc"] != null)  //top filter selected changed
        {
            if (Session["dt"] != null)
            {
                State_datagrid.DataSource = (DataTable)Session["dt"];
                State_datagrid.DataBind();
            }

            dt = (DataTable)Session["dtRecalc"];
            //sort out bedrooms selected
            if (rdoBedrooms.SelectedIndex != 3)
            {
                dtBedrooms = dt.DefaultView.ToTable();

                if (rdoBedrooms.SelectedIndex == 0)
                {
                    dtBedrooms.DefaultView.RowFilter = "NumBedrooms < 3";
                }
                else if (rdoBedrooms.SelectedIndex == 1)
                {
                    dtBedrooms.DefaultView.RowFilter = "NumBedrooms > 2 AND NumBedrooms < 5";
                }
                else if (rdoBedrooms.SelectedIndex == 2)
                {
                    dtBedrooms.DefaultView.RowFilter = "NumBedrooms > 4";
                }
            }
            else
            {
                dtBedrooms = dt.DefaultView.ToTable();
            }

            //amenities rdo
            int[] i = new int[4];

            i = FindNumAmenities(dtBedrooms.DefaultView.ToTable());

            rdoFilter.Items[0].Text = "Hot Tub (" + i[0].ToString() + ") ";
            rdoFilter.Items[1].Text = "Internet (" + i[1].ToString() + ") ";
            rdoFilter.Items[2].Text = "Pets (" + i[2].ToString() + ") ";
            rdoFilter.Items[3].Text = "Pool (" + i[3].ToString() + ") ";
            rdoFilter.Items[4].Text = "Display All (" + dtBedrooms.DefaultView.ToTable().Rows.Count.ToString() + ") ";
        }
        else
        {
            State_datagrid.DataSource = (DataTable)Session["dt"];
            State_datagrid.DataBind();

            dt = (DataTable)Session["dt"];

            if (rdoBedrooms.SelectedIndex != 3)
            {
                dtBedrooms = dt.DefaultView.ToTable();

                if (rdoBedrooms.SelectedIndex == 0)
                {
                    dtBedrooms.DefaultView.RowFilter = "NumBedrooms < 3";
                }
                else if (rdoBedrooms.SelectedIndex == 1)
                {
                    dtBedrooms.DefaultView.RowFilter = "NumBedrooms > 2 AND NumBedrooms < 5";
                }
                else if (rdoBedrooms.SelectedIndex == 2)
                {
                    dtBedrooms.DefaultView.RowFilter = "NumBedrooms > 4";
                }
            }
            else
            {
                dtBedrooms = dt.DefaultView.ToTable();
            }

            //amenities rdo
            int[] i = new int[4];

            i = FindNumAmenities(dtBedrooms.DefaultView.ToTable());

            rdoFilter.Items[0].Text = "Hot Tub (" + i[0].ToString() + ") ";
            rdoFilter.Items[1].Text = "Internet (" + i[1].ToString() + ") ";
            rdoFilter.Items[2].Text = "Pets (" + i[2].ToString() + ") ";
            rdoFilter.Items[3].Text = "Pool (" + i[3].ToString() + ") ";
            rdoFilter.Items[4].Text = "Display All (" + dtBedrooms.DefaultView.ToTable().Rows.Count.ToString() + ") ";
        }
        rdoFilter.SelectedIndex = 4;
        //rdoFilter.DataBind();
    }
Exemple #4
0
    protected void btnFilter_Click(object sender, EventArgs e)
    {
        DataTable     dt           = new DataTable();
        DataTable     dtCategories = new DataTable();
        DataFunctions obj          = new DataFunctions();
        List <string> vList        = new List <string>();

        try
        {
            //1.get main table  2.filter out by type  3.filter out by bedrooms  4.filter out by amenities
            //1.
            //dt = obj.PropertiesByCase(vList, cityid, "City");
            if (Session["dt"] != null)
            {
                dt = (DataTable)Session["dt"];
            }

            //2.
            string[] vTypeSelect;
            vTypeSelect    = rdoTypes.SelectedItem.Text.Split('(');
            vTypeSelect[0] = vTypeSelect[0].Replace("&nbsp;", " ");

            if (vTypeSelect[0].Trim() != "Display All")
            {
                dt.DefaultView.RowFilter = "Category = '" + vTypeSelect[0].Trim() + "'";
            }

            //3.
            if (rdoBedrooms.SelectedIndex != 3)
            {
                DataTable dtBedrooms = dt.DefaultView.ToTable();
                if (rdoBedrooms.SelectedIndex == 0)
                {
                    dtBedrooms.DefaultView.RowFilter = "NumBedrooms < 3";
                }
                else if (rdoBedrooms.SelectedIndex == 1)
                {
                    dtBedrooms.DefaultView.RowFilter = "NumBedrooms > 2 AND NumBedrooms < 5";
                }
                else if (rdoBedrooms.SelectedIndex == 2)
                {
                    dtBedrooms.DefaultView.RowFilter = "NumBedrooms > 4";
                }
                dt = dtBedrooms.DefaultView.ToTable();
            }

            //4.
            if (rdoFilter.SelectedIndex != 4)
            {
                DataTable dtAmenities = dt.DefaultView.ToTable();
                if (rdoFilter.SelectedIndex == 0)
                {
                    dtAmenities.DefaultView.RowFilter = "HotTub LIKE 'Hot Tub%'";
                }
                else if (rdoFilter.SelectedIndex == 1)
                {
                    dtAmenities.DefaultView.RowFilter = "InternetAccess LIKE 'Internet Access%'";
                }
                else if (rdoFilter.SelectedIndex == 2)
                {
                    dtAmenities.DefaultView.RowFilter = "Petfriendly LIKE 'Pet%'";
                }
                else if (rdoFilter.SelectedIndex == 3)
                {
                    dtAmenities.DefaultView.RowFilter = "PrivPool LIKE 'Private%' OR SharedPool LIKE 'Shared%'";
                }
                dt = dtAmenities.DefaultView.ToTable();
            }

            State_datagrid.DataSource = dt.DefaultView.ToTable();
            State_datagrid.DataBind();
        }
        catch (Exception ex) { lblInfo.Text = ex.Message; }
    }
Exemple #5
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        DBConnection obj = new DBConnection();
        DataTable    dt  = new DataTable();

        if (Request.QueryString["county"] != null)
        {
            try
            {
                countyID = Convert.ToInt32(Request.QueryString["county"]);
            }
            catch (Exception)
            {
            }
        }

        //GET REGION, COUNTRY, STATE
        try
        {
            string vCityID    = "";
            string vCountryID = "";
            string vStateID   = "";

            dt = VADBCommander.CountyStateCountryRegionInd(countyID.ToString());
            if (dt.Rows.Count > 0)
            {
                region        = dt.Rows[0]["region"].ToString();
                country       = dt.Rows[0]["country"].ToString();
                stateprovince = dt.Rows[0]["stateprovince"].ToString();
                county        = dt.Rows[0]["countyName"].ToString();
                stateID       = Convert.ToInt32(dt.Rows[0]["StateID"]);
                countryid     = Convert.ToInt32(dt.Rows[0]["countryid"]);
            }
        }
        catch (Exception ex) { lblInfo.Text = ex.Message; }
        finally { obj.CloseConnection(); }

        //CommonFunctions.Connection.Open ();
        // StateCodeInfo.Text = SqlDbType.Int.
        CitiesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), String.Format(STR_SELECTCitiesFROMCitiesWHERECitiesStateProvinceID), SqlDbType.Int);

        //const string STR_SELECTPropertiesInfo = "SELECT Properties.Name, Properties.NumBedrooms, Properties.NumBaths, Properties.NumSleeps, Properties.NumTVs, Properties.NumVCRs, Properties.CityID, Properties.NumCDPlayers, Properties.ID, CASE WHEN EXISTS (SELECT * FROM PropertiesAmenities INNER JOIN Amenities ON PropertiesAmenities.AmenityID = Amenities.ID WHERE (PropertiesAmenities.PropertyID = Properties.ID) AND (Amenities.Amenity = 'Beach Front')) THEN 'Beach Front' ELSE '' END AS BeachFront, CASE WHEN EXISTS (SELECT * FROM PropertiesAmenities INNER JOIN Amenities ON PropertiesAmenities.AmenityID = Amenities.ID WHERE (PropertiesAmenities.PropertyID = Properties.ID) AND (Amenities.Amenity = 'Seaside')) THEN 'Seaside' ELSE '' END AS Seaside, CASE WHEN EXISTS (SELECT * FROM PropertiesAmenities INNER JOIN Amenities ON PropertiesAmenities.AmenityID = Amenities.ID WHERE (PropertiesAmenities.PropertyID = Properties.ID) AND (Amenities.Amenity = 'Lake Front')) THEN 'Lake Front' ELSE '' END AS LakeFront, CASE WHEN EXISTS (SELECT * FROM PropertiesAmenities INNER JOIN Amenities ON PropertiesAmenities.AmenityID = Amenities.ID WHERE (PropertiesAmenities.PropertyID = Properties.ID) AND (Amenities.Amenity = 'River Front')) THEN 'River Front' ELSE '' END AS RiverFront, CASE WHEN EXISTS (SELECT * FROM PropertiesAmenities INNER JOIN Amenities ON PropertiesAmenities.AmenityID = Amenities.ID WHERE (PropertiesAmenities.PropertyID = Properties.ID) AND (Amenities.Amenity = 'Ski In Ski Out')) THEN 'Ski In Ski Out' ELSE '' END AS Ski, Cities.City, StateProvinces.StateProvince, Countries.Country, Regions.Region, MinimumNightlyRentalTypes.Name AS MinimumNightlyRental, PropertyTypes.Name AS Type FROM Properties INNER JOIN Cities ON Properties.CityID = Cities.ID INNER JOIN StateProvinces ON StateProvinces.ID = Cities.StateProvinceID INNER JOIN Countries ON StateProvinces.CountryID = Countries.ID INNER JOIN Regions ON Countries.RegionID = Regions.ID INNER JOIN Users ON Properties.UserID = Users.ID LEFT OUTER JOIN MinimumNightlyRentalTypes ON Properties.MinimumNightlyRentalID = MinimumNightlyRentalTypes.ID LEFT OUTER JOIN PropertyTypes ON Properties.TypeID = PropertyTypes.ID WHERE (Properties.IfFinished = 1) AND (Properties.IfApproved = 1) AND (Cities.StateProvinceID = @StateProvinceID) AND NOT EXISTS (SELECT * FROM Auctions WHERE PropertyID = Properties.ID) ORDER BY StateProvinces.StateProvince, Cities.City, Type, CASE WHEN EXISTS (SELECT * FROM Invoices WHERE (PropertyID = Properties.ID) AND (PaymentAmount >= InvoiceAmount) AND (GETDATE() <= Invoices.RenewalDate)) THEN 1 ELSE 0 END DESC, Properties.ID";
        string STR_SELECTPropertiesInfo = "SELECT Properties.Name, Properties.NumBedrooms, Properties.Name2, Properties.NumBaths, Properties.NumSleeps, Properties.NumTVs, Properties.NumVCRs, Properties.CityID," +
                                          " Properties.NumCDPlayers, Properties.ID," +
                                          " CASE WHEN EXISTS (SELECT * FROM PropertiesAmenities INNER JOIN Amenities" +
                                          " ON PropertiesAmenities.AmenityID = Amenities.ID WHERE (PropertiesAmenities.PropertyID = Properties.ID)" +
                                          " AND (Amenities.Amenity = 'Beach Front')) THEN 'Beach Front' ELSE '' END AS BeachFront," +
                                          " CASE WHEN EXISTS (SELECT * FROM PropertiesAmenities INNER JOIN Amenities" +
                                          " ON PropertiesAmenities.AmenityID = Amenities.ID WHERE (PropertiesAmenities.PropertyID = Properties.ID)" +
                                          " AND (Amenities.Amenity = 'Seaside')) THEN 'Seaside' ELSE '' END AS Seaside," +
                                          " CASE WHEN EXISTS (SELECT * FROM PropertiesAmenities INNER JOIN Amenities" +
                                          " ON PropertiesAmenities.AmenityID = Amenities.ID WHERE (PropertiesAmenities.PropertyID = Properties.ID)" +
                                          " AND (Amenities.Amenity = 'Lake Front')) THEN 'Lake Front' ELSE '' END AS LakeFront," +
                                          " CASE WHEN EXISTS (SELECT * FROM PropertiesAmenities INNER JOIN Amenities" +
                                          " ON PropertiesAmenities.AmenityID = Amenities.ID WHERE (PropertiesAmenities.PropertyID = Properties.ID)" +
                                          " AND (Amenities.Amenity = 'River Front')) THEN 'River Front' ELSE '' END AS RiverFront," +
                                          " CASE WHEN EXISTS (SELECT * FROM PropertiesAmenities INNER JOIN Amenities" +
                                          " ON PropertiesAmenities.AmenityID = Amenities.ID WHERE (PropertiesAmenities.PropertyID = Properties.ID)" +
                                          " AND (Amenities.Amenity = 'Ski In Ski Out')) THEN 'Ski In Ski Out' ELSE '' END AS Ski," +
                                          " Cities.City, StateProvinces.StateProvince, Countries.Country, Regions.Region," +
                                          " MinimumNightlyRentalTypes.Name AS MinimumNightlyRental, PropertyTypes.Name AS Type " +
                                          "FROM Properties INNER JOIN Cities ON Properties.CityID = Cities.ID" +
                                          " INNER JOIN StateProvinces ON StateProvinces.ID = Cities.StateProvinceID" +
                                          " INNER JOIN Countries ON StateProvinces.CountryID = Countries.ID" +
                                          " INNER JOIN Regions ON Countries.RegionID = Regions.ID" +
                                          " INNER JOIN Users ON Properties.UserID = Users.ID" +
                                          " LEFT OUTER JOIN MinimumNightlyRentalTypes ON Properties.MinimumNightlyRentalID = MinimumNightlyRentalTypes.ID" +
                                          " LEFT OUTER JOIN PropertyTypes ON Properties.TypeID = PropertyTypes.ID, counties " +
                                          "WHERE (Properties.IfFinished = 1) AND (Properties.IfApproved = 1) " +
                                          "AND ( counties.county='" + countyID + "' ) " +
                                          "and (cities.id=counties.cityID) " +
                                          " AND NOT EXISTS (SELECT * FROM Auctions WHERE PropertyID = Properties.ID) " +
                                          "ORDER BY StateProvinces.StateProvince, Cities.City, Properties.NumBedrooms, Properties.NumSleeps," +
                                          " CASE WHEN EXISTS (SELECT * FROM Invoices WHERE (PropertyID = Properties.ID)" +
                                          " AND (PaymentAmount >= InvoiceAmount) AND (GETDATE() <= Invoices.RenewalDate))" +
                                          " THEN 1 ELSE 0 END DESC, Properties.ID";

        PropertiesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), String.Format(STR_SELECTPropertiesInfo), SqlDbType.Int);

        //Dummyadapter = CommonFunctions.PrepareAdapter()
        AmenitiesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), "SELECT Amenities.ID, Amenity," +
                                                          " PropertiesAmenities.PropertyID " +
                                                          "FROM Amenities INNER JOIN PropertiesAmenities ON Amenities.ID = PropertiesAmenities.AmenityID" +
                                                          " INNER JOIN Properties ON PropertiesAmenities.PropertyID = Properties.ID " +
                                                          " INNER JOIN Cities ON Properties.CityID = Cities.ID " +
                                                          " INNER JOIN Counties ON Cities.ID = Counties.CityID " +
                                                          "WHERE (Properties.IfFinished = 1) AND (Properties.IfApproved = 1) AND (Counties.county = @countyID)" +
                                                          " AND NOT EXISTS (SELECT * FROM Auctions WHERE PropertyID = Properties.ID) AND (Amenities.Amenity NOT IN" +
                                                          " ('Lake Front', 'Beach Front', 'River Front', 'Seaside', 'Ski In Ski Out', 'TV', 'VCR', 'CD Player'))",
                                                          SqlDbType.Int);

        LocationAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), "SELECT StateProvinces.ID AS StateProvinceID," +
                                                         " StateProvinces.StateProvince, Countries.ID AS CountryID, Countries.Country, Regions.ID AS RegionID," +
                                                         " Regions.Region, stateprovinces.titleoverride, stateprovinces.descriptionoverride " +
                                                         "FROM StateProvinces INNER JOIN Countries ON StateProvinces.CountryID = Countries.ID" +
                                                         " INNER JOIN Regions ON Countries.RegionID = Regions.ID WHERE (counties.county = @countyID)",
                                                         SqlDbType.Int);

        HtmlHead head = Page.Header;

        HtmlMeta keywords    = new HtmlMeta();
        HtmlMeta description = new HtmlMeta();

        DataBind();

        if (!IsPostBack)
        {
            //INDIVIDUAL CITY TEXT INSERT HERE*****
            //DBConnection obj = new DBConnection();
            //DataTable dt = new DataTable();
            string vText = county + " Region on Vacations-abroad.com is a " + county + " Regional directory  of " + county + " Regional rentals by owner and privately owned " +
                           county + " Regional vacation accommodation. Our short term " + county + " Regional rentals include luxury or budget " + county + " Regional vacation homes, " + county + " Regional vacation apartments and " + county + " Regional vacation condos that are perfect for family and group vacations in the " + county + " Region of " + country + " ";

            //TOP DEFAULT TEXT
            txtCityText.Text = vText;
            lblcityInfo.Text = vText;

            //BOTTOM, NO DEFAULT TEXT

            try
            {
                dt = VADBCommander.CityTextByCountyInd(countyID.ToString());
            }
            catch (Exception ex) { lblInfo.Text = ex.Message; }
            finally { obj.CloseConnection(); }

            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0]["cityText"] != null)
                {
                    lblcityInfo.Text = dt.Rows[0]["cityText"].ToString();
                    txtCityText.Text = dt.Rows[0]["cityText"].ToString().Replace("<br />", Environment.NewLine);
                }
                if (dt.Rows[0]["cityText2"] != null)
                {
                    lblInfo2.Text     = dt.Rows[0]["cityText2"].ToString();
                    txtCityText2.Text = dt.Rows[0]["cityText2"].ToString().Replace("<br />", Environment.NewLine);
                }
            }

            if (String.IsNullOrEmpty(lblcityInfo.Text))
            {
                //IF EMPTY VALUES OR 'DELETES' FROM ADMIN FOR TOP
                txtCityText.Text = vText;
                lblcityInfo.Text = vText;
            }
            //NO NEED TO CHECK IF EMPTY FOR BOTTOM, OK TO SHOW NOTHING

            List <string> vList        = new List <string>();
            DataTable     dt1          = new DataTable();
            DataTable     dtCategories = new DataTable();
            try
            {
                DataFunctions objF = new DataFunctions();
                dt1                       = objF.PropertiesByCase(vList, countyID, "Counties");
                Session["dt"]             = dt1;
                State_datagrid.DataSource = dt1;
                State_datagrid.DataBind();

                //add num of properties w/amenities to chk texts
                int[] i = new int[4];
                i = FindNumAmenities(dt1);

                rdoFilter.Items[0].Text += " (" + i[0].ToString() + ") ";
                rdoFilter.Items[1].Text += " (" + i[1].ToString() + ") ";
                rdoFilter.Items[2].Text += " (" + i[2].ToString() + ") ";
                rdoFilter.Items[3].Text += " (" + i[3].ToString() + ") ";
                //rdoFilter.Items[4].Text += " in " + city;
                rdoFilter.Items[4].Text += " (" + dt1.Rows.Count.ToString() + ") ";

                //numbedrooms filter
                dtCategories = objF.FindNumBedrooms(dt1);
                rdoBedrooms.Items[0].Text += " (" + dtCategories.Rows[0]["count"].ToString() + ")  ";
                rdoBedrooms.Items[1].Text += " (" + dtCategories.Rows[1]["count"].ToString() + ")  ";
                rdoBedrooms.Items[2].Text += " (" + dtCategories.Rows[2]["count"].ToString() + ")  ";
                int vBedCount = 0;
                foreach (DataRow row in dtCategories.Rows)
                {
                    vBedCount += Convert.ToInt32(row["count"]);
                }
                rdoBedrooms.Items[3].Text += " (" + vBedCount.ToString() + ") ";
                rdoBedrooms.DataBind();


                //create rdo items from categories table
                dtCategories = objF.FindNumCategories(dt1);
                int vCategoryCount = 0;

                foreach (DataRow row in dtCategories.Rows)
                {
                    string vTemp = row["category"].ToString() + " (" + row["count"].ToString() + ")";
                    vTemp = vTemp.Replace(" ", "&nbsp;");
                    rdoTypes.Items.Add(vTemp + " ");
                    vCategoryCount = vCategoryCount + Convert.ToInt32(row["count"].ToString());
                }
                rdoTypes.Items.Add("Display&nbsp;All&nbsp;(" + vCategoryCount.ToString() + ") ");
                rdoTypes.SelectedIndex = rdoTypes.Items.Count - 1;
                rdoTypes.DataBind();

                //add cities to right column
                dt = VADBCommander.CitiesInCountyList(countyID.ToString());
                foreach (DataRow datarow in dt.Rows)
                {
                    if (datarow["city"] is string)
                    {
                        string temp = CommonFunctions.GetSiteAddress() + "/" + country +
                                      "/" + stateprovince + "/" + datarow["city"].ToString() + "/default.aspx";
                        temp = temp.ToLower();
                        temp = temp.Replace(' ', '_');

                        //divCitiesRt.InnerHtml += "<a href=\"" + temp + "\">" + datarow["city"].ToString().Replace(" ", "&nbsp;") + "&nbsp;Vacation&nbsp;Rentals</a>\n";
                        divCitiesRt.InnerHtml += "<a href=\"" + temp + "\">" + datarow["city"].ToString().Replace(" ", "&nbsp;") + "</a>,  ";
                    }
                }
                divCitiesRt.InnerHtml = divCitiesRt.InnerHtml.Remove(divCitiesRt.InnerHtml.Length - 2, 2);
                //add cities to right column

                //add counties within state
                dt = obj.spGetRightSideCounties(stateID);
                foreach (DataRow datarow in dt.Rows)
                {
                    if (datarow["county"] is string)
                    {
                        string temp = CommonFunctions.GetSiteAddress() + "/" + stateprovince + "/Holiday-Rentals/" +
                                      datarow["county"].ToString() + "-Vacation_Rentals/default.aspx";
                        temp = temp.ToLower();
                        temp = temp.Replace(' ', '_');
                        divCountiesRt.InnerHtml += "<a  href=\"" + temp + "\">" + datarow["county"].ToString().Replace(" ", "&nbsp;").Replace("Province", "").Replace("of", "") + "</a>, ";
                        //divCountiesRt.InnerHtml += "<a href=\"" + temp + "\">" + datarow["county"].ToString().Replace(" ", "&nbsp;") + "&nbsp;Vacation&nbsp;Rentals</a>\n";
                        //  divCountiesRt.InnerHtml += "<a   class='rttextlow' href=\"" + temp + "\">" + datarow["county"].ToString().Replace(" ", "&nbsp;") + "&nbsp;Vacation&nbsp;Rentals</a>  ";
                    }
                }
                divCountiesRt.InnerHtml = divCountiesRt.InnerHtml.Remove(divCountiesRt.InnerHtml.Length - 2, 2);
                //add counties within state

                dt = obj.spStateProvByCountries(countryid);
                foreach (DataRow row in dt.Rows)
                {
                    if (row["stateprovince"] is string)
                    {
                        string temp = CommonFunctions.GetSiteAddress() + "/" + country + "/" + row["stateprovince"].ToString() + "/default.aspx";
                        temp = temp.ToLower();
                        temp = temp.Replace(' ', '_');

                        divStates.InnerHtml += "<a  href=\"" + temp + "\">" + row["stateprovince"].ToString().Replace(" ", "&nbsp;") + "</a>, ";
                    }
                }
                divStates.InnerHtml = divStates.InnerHtml.Remove(divStates.InnerHtml.Length - 2, 2);
            }
            catch (Exception ex) { lblInfo22.Text = ex.Message; }
        }
        //FillCitiesColumn();
        ((System.Web.UI.WebControls.Image)Master.FindControl("Logo")).AlternateText = "Vacation Rentals at Vacations-Abroad.com";
        Page.Header.Controls.Add(new LiteralControl("<link href='/css/StyleSheetBig4.css' rel='stylesheet' type='text/css' />"));
    }
    protected void Page_Load(object sender, System.EventArgs e)
    {
        DBConnection obj = new DBConnection();
        DataTable    dt  = new DataTable();

        if (Request.QueryString["cityID"] != null)
        {
            try
            {
                cityID = Convert.ToInt32(Request.QueryString["cityID"]);
            }
            catch (Exception)
            {
            }
        }

        //GET REGION, COUNTRY, STATE
        try
        {
            dt = VADBCommander.CityTourList(cityID.ToString());
            if (dt.Rows.Count > 0)
            {
                region        = dt.Rows[0]["region"].ToString();
                country       = dt.Rows[0]["country"].ToString();
                stateprovince = dt.Rows[0]["stateprovince"].ToString();
                city          = dt.Rows[0]["city"].ToString();
                stateID       = Convert.ToInt32(dt.Rows[0]["StateID"]);
                countryid     = Convert.ToInt32(dt.Rows[0]["countryid"]);
            }
        }
        catch (Exception ex) { lblInfo22.Text = ex.ToString(); }
        finally { obj.CloseConnection(); }

        CitiesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), String.Format(STR_SELECTCitiesFROMCitiesWHERECitiesStateProvinceID), SqlDbType.Int);

        string STR_SELECTPropertiesInfo = "select Cities.City, Tours.*, StateProvinces.StateProvince, Countries.Country, Countries.id as countryid,  " +
                                          "Regions.Region, StateProvinces.id as StateID from Cities inner join  " +
                                          "StateProvinces on Cities.stateprovinceid=StateProvinces.id  " +
                                          "inner join Countries on Countries.id=StateProvinces.Countryid  " +
                                          "inner join Regions on Regions.id=Countries.Regionid " +
                                          "inner join Tours on Tours.CityID=Cities.ID " +
                                          "where cities.id=@CityID";

        PropertiesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), String.Format(STR_SELECTPropertiesInfo), SqlDbType.Int);

        AmenitiesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), "SELECT Amenities.ID, Amenity," +
                                                          " PropertiesAmenities.PropertyID " +
                                                          "FROM Amenities INNER JOIN PropertiesAmenities ON Amenities.ID = PropertiesAmenities.AmenityID" +
                                                          " INNER JOIN Properties ON PropertiesAmenities.PropertyID = Properties.ID " +
                                                          " INNER JOIN Cities ON Properties.CityID = Cities.ID " +
                                                          " INNER JOIN Counties ON Cities.ID = Counties.CityID " +
                                                          "WHERE (Properties.IfFinished = 1) AND (Properties.IfApproved = 1) AND (Counties.county = @countyID)" +
                                                          " AND NOT EXISTS (SELECT * FROM Auctions WHERE PropertyID = Properties.ID) AND (Amenities.Amenity NOT IN" +
                                                          " ('Lake Front', 'Beach Front', 'River Front', 'Seaside', 'Ski In Ski Out', 'TV', 'VCR', 'CD Player'))",
                                                          SqlDbType.Int);

        LocationAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), "select Cities.City, Cities.ID as CityID, StateProvinces.StateProvince, Countries.Country, Countries.id as countryid, " +
                                                         "Regions.Region, StateProvinces.id as StateID from Cities inner join " +
                                                         "StateProvinces on Cities.stateprovinceid=StateProvinces.id " +
                                                         "inner join Countries on Countries.id=StateProvinces.Countryid " +
                                                         "inner join Regions on Regions.id=Countries.Regionid " +
                                                         "where cities.id=@CityID",
                                                         SqlDbType.Int);

        HtmlHead head = Page.Header;

        HtmlMeta keywords    = new HtmlMeta();
        HtmlMeta description = new HtmlMeta();

        DataBind();

        if (!IsPostBack)
        {
            //INDIVIDUAL CITY TEXT INSERT HERE*****
            //DBConnection obj = new DBConnection();
            //DataTable dt = new DataTable();
            string vText = "Vacations-abroad.com is a directory of " + city + " vacation rentals and privately owned " +
                           city + " holiday accommodation. Our holiday rentals include vacation homes, holiday villas, vacation condos, holiday " +
                           "apartments, holiday cottages, vacation cabins, B&Bs, Hotels, Resorts, Guesthouses in " +
                           city + " " + stateprovince;

            List <string> vList        = new List <string>();
            DataTable     dt1          = new DataTable();
            DataTable     dtCategories = new DataTable();
            DBConnection  objR         = new DBConnection();
            try
            {
                DataFunctions objF = new DataFunctions();
                dt1                       = VADBCommander.ListApprovedToursByCity(cityID.ToString());
                Session["dt"]             = dt1;
                State_datagrid.DataSource = dt1;
                State_datagrid.DataBind();


                //add cities to right column

                SqlDataReader reader;
                DataTable     dtR = new DataTable();

                string vCountyID = "";


                //if county assoc
                dtR = VADBCommander.CountyListByCityID(cityID.ToString());

                if (dtR.Rows.Count > 0)
                {
                    vCountyID = dtR.Rows[0]["countyid"].ToString();

                    rtCounties.InnerHtml = dtR.Rows[0]["county"].ToString() + " Cities";
                    rtLowerHd.InnerHtml  = stateprovince + " Counties";


                    dtR = VADBCommander.CityListByCountyID(vCountyID);
                    foreach (DataRow row in dtR.Rows)
                    {
                        string temp = CommonFunctions.GetSiteAddress() + "/" + country +
                                      "/" + stateprovince + "/" + row["city"].ToString() + "/default.aspx";
                        temp = temp.ToLower();
                        temp = temp.Replace(' ', '_');

                        divCitiesRt.InnerHtml += "<a href=\"" + temp + "\">" + row["city"].ToString().Replace(" ", "&nbsp;") + "</a>, ";
                    }
                    divCitiesRt.InnerHtml = divCitiesRt.InnerHtml.Remove(divCitiesRt.InnerHtml.Length - 2, 2);

                    dtR = objR.spGetRightSideCounties(stateID);

                    if (dtR.Rows.Count > 0)
                    {
                        DataTable dtTooltip = VADBCommander.CityAndCountiesByStateID(stateID.ToString());

                        foreach (DataRow row in dtR.Rows)
                        {
                            string temp = CommonFunctions.GetSiteAddress() + "/" +
                                          stateprovince + "/Holiday-Rentals/" + row["county"].ToString() + "-Vacation_Rentals/default.aspx";
                            temp = temp.ToLower();
                            temp = temp.Replace(' ', '_');
                            //county tooltip
                            dtTooltip.DefaultView.RowFilter = "CountyName='" + row["county"].ToString() + "'";
                            if (dtTooltip.DefaultView.ToTable().Rows.Count > 0)
                            {
                                rtLower.InnerHtml += "<a onmouseover=\"Tip('";
                                foreach (DataRow rowCnty in dtTooltip.DefaultView.ToTable().Rows)
                                {
                                    rtLower.InnerHtml += "<a href=\\'" + CommonFunctions.GetSiteAddress().ToLower() +
                                                         "/" + country.ToLower().Replace(" ", "_") + "/" +
                                                         stateprovince.ToLower().Replace(" ", "_") + "/" + rowCnty["city"].ToString().ToLower().Replace(" ", "_") + "/default.aspx\\' target=\\'_self\\'>" +
                                                         rowCnty["city"].ToString() + "</a>, ";
                                }
                                rtLower.InnerHtml  = rtLower.InnerHtml.Remove(rtLower.InnerHtml.Length - 2, 2);
                                rtLower.InnerHtml += "', WIDTH, 150, SHADOW, false, OPACITY, 90, BGCOLOR, '#ede9ed', BORDERCOLOR, '#ede9ed', FONTCOLOR, '#474747', CLICKSTICKY, true, CLICKCLOSE, true, FONTSIZE, '12px', FONTFACE, 'Arial', CLOSEBTN, false, STICKY, true, OFFSETX, 10, PADDING, 5, OFFSETY, 0)\"";

                                rtLower.InnerHtml += " <a href=\"" + temp + "\">" + row["county"].ToString().Replace(" ", "&nbsp;") + "</a>, ";
                                //county tooltip
                            }
                        }
                        rtLower.InnerHtml = rtLower.InnerHtml.Remove(rtLower.InnerHtml.Length - 2, 2);
                    }
                }
                else
                {
                    //if county assoc

                    rtCounties.InnerHtml = stateprovince + " Cities";
                    rtLowerHd.InnerHtml  = country + " States";


                    reader = objR.ExecuteRecordSetArtificial("SELECT Cities.* FROM Cities WHERE (Cities.StateProvinceID = " + stateID + ") 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");
                    while (reader.Read())
                    {
                        if (reader["City"] is string)
                        {
                            string temp = CommonFunctions.GetSiteAddress() + "/" + country +
                                          "/" + stateprovince + "/" + reader["city"].ToString() + "/default.aspx";
                            temp = temp.ToLower();
                            temp = temp.Replace(' ', '_');

                            divCitiesRt.InnerHtml += "<a href=\"" + temp + "\">" + reader["city"].ToString().Replace(" ", "&nbsp;") + "</a>, ";
                        }
                    }
                    reader.Close();
                    divCitiesRt.InnerHtml = divCitiesRt.InnerHtml.Remove(divCitiesRt.InnerHtml.Length - 2, 2);

                    DataTable dtCountries = objR.spStateProvByCountries(countryid);
                    foreach (DataRow row in dtCountries.Rows)
                    {
                        if (row["stateprovince"] is string)
                        {
                            string temp = CommonFunctions.GetSiteAddress() + "/" + country + "/" + row["stateprovince"].ToString() + "/default.aspx";
                            temp = temp.ToLower();
                            temp = temp.Replace(' ', '_');

                            rtLower.InnerHtml += "<a href=\"" + temp + "\">" + row["stateprovince"].ToString().Replace(" ", "&nbsp;") + "</a>, ";
                        }
                    }
                    if (rtLower.InnerHtml.Length > 2)
                    {
                        rtLower.InnerHtml = rtLower.InnerHtml.Remove(rtLower.InnerHtml.Length - 2, 2);
                    }
                }
            }
            catch (Exception ex) { lblInfo22.Text = ex.Message + ":22"; }
        }
        //FillCitiesColumn();
        Session["city"]    = city;
        Session["state"]   = stateprovince;
        Session["country"] = country;
        ((System.Web.UI.WebControls.Image)Master.FindControl("Logo")).AlternateText = "Vacations-Abroad.com";
        Page.Header.Controls.Add(new LiteralControl("<link href='/css/StyleSheetBig4.css' rel='stylesheet' type='text/css'></script>"));
    }