public string GenerateCountryLinks(string regionID)
    {
        DataTable     dtCountryList = new DataTable();
        DataTable     dtStateList   = new DataTable();
        StringBuilder sb            = new StringBuilder();

        //----------------------------North America
        //north amer
        dtCountryList = VADBCommander.CountiesByRegionList(regionID);
        //dtCountryList = VADBCommander.CountriesByRegionList(regionID);
        if (dtCountryList.Rows.Count > 0)
        {
            //sb.AppendLine("<ul class=\"TripleListMain\">");
            foreach (DataRow row in dtCountryList.Rows)
            {
                //we list the country first
                sb.AppendLine("<a class=\"mainPgCountry\" href=\"" + CommonFunctions.PrepareURL(row["country"].ToString().ToLower().Replace(" ", "_") + "/default.aspx") + "\"><b>" + row["country"].ToString().ToUpper() + "</b></a>, ");
                bool stateDown = false;

                //we grab all of the states for that country

                dtStateList = VADBCommander.StateProvinceByCountryList(row["id"].ToString());

                if (dtStateList.Rows.Count > 0)
                {
                    if (dtStateList.Rows.Count > 0)
                    {
                        foreach (DataRow rowTemp in dtStateList.Rows)
                        {
                            DataTable dtCityList = VADBCommander.CityStateCountryRegionList(rowTemp["id"].ToString());
                            //add cities to lower
                            if (dtCityList.Rows.Count > 0)
                            {
                                sb.AppendLine("<a class=\"mainState\" href=\"" + CommonFunctions.PrepareURL(row["country"].ToString().ToLower().Replace(" ", "_").Replace(" ", "_").ToLower() + "/" + rowTemp["stateprovince"].ToString().Replace(" ", "_").ToLower() + "/default.aspx") + "\">" + rowTemp["stateprovince"].ToString().Replace(" ", "&nbsp;").Replace("-", "&#8209;") + "</a>");
                                sb.AppendLine(":  ");
                                foreach (DataRow row1 in dtCityList.Rows)
                                {
                                    sb.AppendLine("<a class=\"mainCity\" href=\"" + CommonFunctions.PrepareURL(row["country"].ToString().ToLower().Replace(" ", "_") + "/" + rowTemp["stateProvince"].ToString().Replace(" ", "_").ToLower() + "/" + row1["city"].ToString().ToLower().Replace(" ", "_") + "/default.aspx") + "\" class=\"mainCity\">" + row1["city"].ToString().Replace(" ", "&nbsp;").Replace("-", "&#8209;") + "</a>, ");
                                }
                            }
                            else
                            {
                                sb.AppendLine("<a class=\"mainState\" href=\"" + CommonFunctions.PrepareURL(row["country"].ToString().ToLower().Replace(" ", "_").Replace(" ", "_").ToLower() + "/" + rowTemp["stateprovince"].ToString().Replace(" ", "_").ToLower() + "/default.aspx") + "\">" + rowTemp["stateprovince"].ToString().Replace(" ", "&nbsp;").Replace("-", "&#8209;") + "</a>");
                            }
                        }
                    }
                    else
                    {
                        sb.AppendLine(", ");
                    }
                } /**/
            }
        }
        string str = sb.ToString();

        str = str.Remove(str.Length - 2);
        return(str);
    }
    protected void gv_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        string strID = gv.Rows[e.RowIndex].Cells[0].Text;
        //string strEditText = ((TextBox) gv.Rows[e.RowIndex].Cells[2].Controls[0]).Text;
        string strEditText = ((TextBox)gv.Rows[e.RowIndex].FindControl("txt")).Text;

        VADBCommander.RegionTextEdit(strID, strEditText);
        gv.EditIndex = -1;
        PopGV();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        lblHeaderMsg.Text = "Click on dates to reserve/unreserve for property " + Request.QueryString["PropertyID"].ToString();

        if (!IsPostBack)
        {
            Session.Remove("DatesTaken");
            Session.Remove("DatesRemove");
            Session.Remove("curDate");

            DBConnection    obj        = new DBConnection();
            List <DateTime> DatesTaken = new List <DateTime>();

            DataTable dt = new DataTable();
            dt = VADBCommander.PropertyAvailDatesByProperty(Request.QueryString["PropertyID"].ToString());

            foreach (DataRow row in dt.Rows)
            {
                DatesTaken.Add(Convert.ToDateTime(row["PropertyDates"].ToString()));
            }
            Session["DatesTaken"] = DatesTaken;
            if (DatesTaken.Count > 0)
            {
                chkDisplay.Checked = true;
            }

            dt = VADBCommander.CityStatePropertyInd(Request.QueryString["PropertyID"].ToString());

            lblCityPage.Text = "Your calendar will be displayed next to your listing on the " + dt.Rows[0]["City"].ToString() + " page.";

            string stateID  = dt.Rows[0]["stateID"].ToString();
            string cityName = dt.Rows[0]["City"].ToString();

            dt = VADBCommander.StateCountryList(stateID);

            //lnkCityPage.PostBackUrl = dt.Rows[0]["country"].ToString() + "/" + dt.Rows[0]["state"].ToString() + "/" + cityName + "/default.aspx";
            lnkCity.NavigateUrl = dt.Rows[0]["country"].ToString() + "/" + dt.Rows[0]["state"].ToString() + "/" + cityName + "/default.aspx";
            lnkCity.Text        = "View calendar on " + cityName + " page.";
            lblHeaderMsg.Text   = "Calendar is displayed on Actual " + cityName + " webpage.";
        }
        else
        {
        }
        if (Session["curDate"] != null)
        {
            Calendar1.TodaysDate = Convert.ToDateTime(Session["curDate"]);
        }

        if (Session["DatesDiscard"] == null)
        {
            List <DateTime> DatesDiscard = new List <DateTime>();
            Session["DatesDiscard"] = DatesDiscard;
        }
    }
    protected void grdNews_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        Label lblEmailID  = (Label)e.Row.FindControl("lblEmailID");
        Label lblDeployed = (Label)e.Row.FindControl("lblDeployed");
        Label lblComplete = (Label)e.Row.FindControl("lblComplete");

        string vID = "";

        if (lblDeployed != null)
        {
            if (lblDeployed.Text == "Yes")
            {
                DBConnection obj = new DBConnection();
                DataTable    dt  = new DataTable();
                if (lblEmailID != null)
                {
                    vID = lblEmailID.Text;
                }
                string complete = "";
                //find index of ID out of total for query of possible emails
                try
                {
                    dt = VADBCommander.NewsLetterEmailOptOutIsNullList();

                    if (dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            if (dt.Rows[i]["id"].ToString() == vID)
                            {
                                lblEmailID.Text = dt.Rows[i]["numeral"].ToString();
                            }
                        }
                        complete = lblEmailID.Text;

                        if (lblComplete != null)
                        {
                            if (lblComplete.Text == "True")
                            {
                                complete = dt.Rows.Count.ToString();
                            }
                        }

                        lblEmailID.Text = complete + "/" + dt.Rows.Count.ToString();
                    }
                }
                catch (Exception ex) { lblError.Text = ex.Message; }
                finally { obj.CloseConnection(); }
            }
        }
    }
Пример #5
0
    protected void btnSubmit2_Click(object sender, EventArgs e)
    {
        string strCoutryText2 = txtCountryText2.Text.Replace(Environment.NewLine, "<br />");
        //  Response.Write(strCoutryText2);
        DataTable dt = VADBCommander.CountryTextInd(countryid.ToString(), Convert.ToString(ViewState["firstCategory"]));

        try
        {
            if (dt.Rows.Count > 0)
            {
                VADBCommander.CountryText2Edit(countryid.ToString(), strCoutryText2, Convert.ToString(ViewState["firstCategory"]));
            }
            else
            {
                VADBCommander.CountryText2Add(countryid.ToString(), strCoutryText2, Convert.ToString(ViewState["firstCategory"]));
            }
            lblInfo2.Text = "Data saved.";
            DataTable dt4 = VADBCommander.CountryTextInd(countryid.ToString(), Convert.ToString(ViewState["firstCategory"]));
            if (dt4.Rows.Count > 0)
            {
                if (dt4.Rows[0]["CountryText"] != null)
                {
                    lblCountryInfo.Text = dt4.Rows[0]["CountryText"].ToString();
                    txtCountryText.Text = dt4.Rows[0]["CountryText"].ToString().Replace("<br />-ipx-", Environment.NewLine);
                }
                if (dt4.Rows[0]["CountryText2"] != null)
                {
                    lblInfo2.Text = dt4.Rows[0]["CountryText2"].ToString();
                    if (string.IsNullOrEmpty(lblInfo2.Text) || lblInfo2.Text == "")
                    {
                        OrangeTitle.Visible = false;
                    }
                    txtCountryText2.Text = dt4.Rows[0]["CountryText2"].ToString().Replace("<br />", Environment.NewLine);
                }
                else
                {
                    OrangeTitle.Visible = false;
                }
            }
            else
            {
                OrangeTitle.Visible = false;
            }
        }
        catch (Exception ex)
        {
            lblInfo2.Text = ex.Message;
        }
        lblInfo2.ForeColor = System.Drawing.Color.Red;
    }
    protected void Calendar1_SelectionChanged(object sender, EventArgs e)
    {
        List <DateTime> DatesTaken = (List <DateTime>)Session["DatesTaken"];

        Session["curDate"] = Calendar1.SelectedDate;

        if (chkDisplay.Checked == true)
        {
            DBConnection obj = new DBConnection();

            //if list contains reservation..remove by removing from list and db
            if (DatesTaken.Contains(Calendar1.SelectedDate))
            {
                DatesTaken.Remove(Calendar1.SelectedDate);

                VADBCommander.PropertyAvailDatesDelete(Request.QueryString["PropertyID"].ToString(), Calendar1.SelectedDate.ToString("yyyyMMdd"));

                Calendar1.SelectedDayStyle.BackColor = System.Drawing.Color.AliceBlue;
                Calendar1.SelectedDayStyle.ForeColor = System.Drawing.Color.Black;
            }
            else     //if not in reserve list..add to it and to db
            {
                DatesTaken.Add(Calendar1.SelectedDate);
                VADBCommander.PropertyAvailDateAdd(Calendar1.SelectedDate.ToString("yyyyMMdd"), Request.QueryString["PropertyID"].ToString());
            }
        }
        else
        {     //outside checkbox
            if (DatesTaken.Contains(Calendar1.SelectedDate))
            { //to temp delete
                DatesTaken.Remove(Calendar1.SelectedDate);
                List <DateTime> DatesRemove = new List <DateTime>();
                if (Session["DatesRemove"] != null)
                {
                    DatesRemove = (List <DateTime>)Session["DatesRemove"];
                }

                DatesRemove.Add(Calendar1.SelectedDate);
                Session["DatesRemove"] = DatesRemove;
            }
            else
            {      //to temp add
                DatesTaken.Add(Calendar1.SelectedDate);
                //lblTest.Text += "date added";
            }
        }
        Session["DatesTaken"] = DatesTaken;
        Calendar1.SelectedDates.Clear();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        DBConnection obj = new DBConnection();
        DataSet      ds  = new DataSet();
        DataTable    dt  = new DataTable();

        try
        {
            dt = VADBCommander.NewsLetterOrderByIDList();
            grdNews.DataSource = dt;
            grdNews.DataBind();
        }
        catch (Exception ex) { lblError.Text = ex.Message; }
        obj.CloseConnection();
    }
    private void UpdateDB()
    {
        DBConnection obj = new DBConnection();

        try
        {
            ImageSource();
            VADBCommander.NewsLetterSetDeployed(Session["id"].ToString());
        }
        catch (System.Exception ex)
        {
            lblError.Text = ex.Message;
        }
        obj.CloseConnection();
    }
Пример #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["email"] != null)
     {
         //lblInfo.Text = Request.QueryString["email"].ToString();
         DBConnection obj = new DBConnection();
         try
         {
             VADBCommander.NewsletterEmailDeleteByEmail(Request.QueryString["email"].ToString());
             VADBCommander.OwnerWarningDeleteByEmail(Request.QueryString["email"].ToString());
             Response.Redirect(CommonFunctions.PrepareURL("OwnerEmailAdmin.aspx"));
         }
         catch (Exception ex) { lblInfo.Text = ex.Message; }
         finally { obj.CloseConnection(); }
     }
 }
    protected void btnSubmit2_Click(object sender, EventArgs e)
    {
        HttpResponse.RemoveOutputCacheItem("/StateProvinceList.aspx");
        string    strCityText2 = txtCityText2.Text.Replace(Environment.NewLine, "<br />");
        DataTable dt           = VADBCommander.CityTextByStateInd(stateprovinceid.ToString());

        try
        {
            if (dt.Rows.Count > 0)
            {
                VADBCommander.CityText2ByStateEdit(stateprovinceid.ToString(), strCityText2);
            }
            else
            {
                VADBCommander.CityText2ByStateAdd(stateprovinceid.ToString(), strCityText2);
            }
            lblInfo2.Text = "Data saved.";
            DataTable dt4 = VADBCommander.CityTextByStateInd(stateprovinceid.ToString());
            if (dt4.Rows.Count > 0)
            {
                if (dt4.Rows[0]["cityText"] != null)
                {
                    lblcityInfo.Text = dt4.Rows[0]["cityText"].ToString();
                    txtCityText.Text = dt4.Rows[0]["cityText"].ToString().Replace("<br />-ipx-", Environment.NewLine);
                }
                if (dt4.Rows[0]["cityText2"] != null)
                {
                    lblInfo2.Text = dt4.Rows[0]["cityText2"].ToString();

                    if (string.IsNullOrEmpty(dt4.Rows[0]["cityText2"].ToString()) || dt4.Rows[0]["cityText2"].ToString() == "")
                    {
                        OrangeTitle.Visible = false;
                    }
                    txtCityText2.Text = dt4.Rows[0]["cityText2"].ToString().Replace("<br />", Environment.NewLine);
                }
                else
                {
                    OrangeTitle.Visible = false;
                }
            }
        }
        catch (Exception ex)
        {
            lblInfo2.Text = ex.Message;
        }
        lblInfo2.ForeColor = System.Drawing.Color.Red;
    }
Пример #11
0
    private void MakeLinksText()
    {
        int          Vid = Convert.ToInt32(Request.QueryString["propertyID"]);
        DBConnection obj = new DBConnection();

        try
        {
            DataTable dt = VADBCommander.CityStateCountryByProperty(Vid.ToString());
            if (dt.Rows.Count > 0)
            {
                city    = dt.Rows[0]["City"].ToString();
                state   = dt.Rows[0]["State"].ToString();
                country = dt.Rows[0]["Country"].ToString();

                string temp = CommonFunctions.GetSiteAddress() + "/" + dt.Rows[0]["Country"].ToString() + "/" + dt.Rows[0]["State"].ToString() + "/" + dt.Rows[0]["City"].ToString() + "/default.aspx";
                temp = temp.ToLower();
                temp = temp.Replace(" ", "_");

                hlkCity.Text        = city;
                hlkCity.NavigateUrl = temp;

                temp                 = CommonFunctions.GetSiteAddress() + "/" + dt.Rows[0]["Country"].ToString() + "/" + dt.Rows[0]["State"].ToString() + "/default.aspx";
                temp                 = temp.ToLower();
                temp                 = temp.Replace(" ", "_");
                hlkState.Text        = state;
                hlkState.NavigateUrl = temp;

                temp                   = CommonFunctions.GetSiteAddress() + "/" + dt.Rows[0]["Country"].ToString() + "/default.aspx";
                temp                   = temp.ToLower();
                temp                   = temp.Replace(" ", "_");
                hlkCountry.Text        = country;
                hlkCountry.NavigateUrl = temp;


                temp                    = CommonFunctions.GetSiteAddress() + "/" + dt.Rows[0]["Country"].ToString() + "/" + dt.Rows[0]["State"].ToString() + "/" + dt.Rows[0]["City"].ToString() + "/" + Vid.ToString() + "/default.aspx";
                temp                    = temp.ToLower();
                temp                    = temp.Replace(" ", "_");
                hlkProperty.Text        = "Property #" + Vid.ToString();
                hlkProperty.NavigateUrl = temp;

                Session["calCity"] = dt.Rows[0]["City"].ToString();
            }
        }
        catch (Exception ex) { lblInfo.Text = ex.Message; }
        finally { obj.CloseConnection(); }
        Page.Header.Controls.Add(new LiteralControl("<link href='/css/StyleSheetBig4.css' rel='stylesheet' type='text/css'></script>"));
    }
    protected void grdNews_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        if (!IsPostBack)
        {
            DBConnection obj = new DBConnection();

            try
            {
                VADBCommander.NewsletterDelete(grdNews.DataKeys[e.RowIndex].Value.ToString());
                DataTable dt5 = VADBCommander.NewsletterList();;
                grdNews.DataSource = dt5;
                grdNews.DataBind();
            }
            catch (Exception ex) { Response.Write(ex.Message); }
            obj.CloseConnection();
        }
    }
    static void FillNewsletterEmails()
    {
        DataTable    dt  = new DataTable();
        DBConnection obj = new DBConnection();

        try
        {
            dt = VADBCommander.ContactEmailList();
            //fill new table with unioned table
            foreach (DataRow row in dt.Rows)
            {
                VADBCommander.NewsLetterEmailShortAdd(row["contactemail"].ToString(), row["contactName"].ToString());
            }
        }
        catch (Exception ex) { throw ex; }
        finally { con.Close(); }
    }
    private void FillTourRpt()
    {
        DBConnection obj   = new DBConnection();
        string       query = "";
        DataTable    dt    = new DataTable();

        try
        {
            dt = VADBCommander.ListUnApprovedTours();
            if (dt.Rows.Count > 0)
            {
                rptTour.DataSource = dt;
                rptTour.DataBind();
            }
        }
        catch (Exception ex) { lblInfo.Text = ex.Message; }
        finally { obj.CloseConnection(); }
    }
Пример #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //As long as there is a match for each email in the users table, leave
        //...but if a row has no match in users(edited by owner), remove from warning table, remove before displaying
        //if old doesn't exist in users table but does exist in emails table, update emails table w/good email & remove
        //from warning table
        DBConnection obj   = new DBConnection();
        string       query = "";

        try
        {
            DataTable dt = VADBCommander.EmailBounceList();
            if (dt.Rows.Count > 0)
            {
                for (int i = dt.Rows.Count - 1; i >= 0; i--)
                {
                    if (dt.Rows[i]["ownerID"] != DBNull.Value)
                    {
                        DataTable dt2 = VADBCommander.UserInd(dt.Rows[i]["ownerID"].ToString());
                        if (dt2.Rows.Count > 0)
                        {
                            if (dt2.Rows[0]["email"].ToString() != dt.Rows[i]["email"].ToString())
                            {
                                DataTable dt3 = VADBCommander.NewsLetterEmailsByEmailList(dt.Rows[i]["email"].ToString());
                                if (dt3.Rows.Count > 0)
                                {
                                    string ID2 = dt3.Rows[0]["id"].ToString();
                                    VADBCommander.NewsLetterEmailChange(dt2.Rows[0]["email"].ToString(), dt.Rows[i]["email"].ToString());
                                    VADBCommander.OwnerWarningDelete(dt.Rows[i]["id"].ToString());
                                    dt.Rows.RemoveAt(i);
                                }
                            }
                        }
                    }
                }

                grdComments.DataSource = dt;
                grdComments.DataBind();
            }
        }
        catch (Exception ex) { lblInfo.Text = ex.Message; }
        finally { obj.CloseConnection(); }
        Page.Header.Controls.Add(new LiteralControl("<link href='/css/StyleSheetBig4.css' rel='stylesheet' type='text/css'></script>"));
    }
Пример #16
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        HttpResponse.RemoveOutputCacheItem("/StateProvinceList.aspx");
        string    strCountryText = txtCountryText.Text.Replace(Environment.NewLine, "<br />");
        DataTable dt             = VADBCommander.CountryTextInd(countryid.ToString(), Convert.ToString(ViewState["firstCategory"]));

        try
        {
            if (dt.Rows.Count > 0)
            {
                VADBCommander.CountryTextEdit(countryid.ToString(), strCountryText, Convert.ToString(ViewState["firstCategory"]));
            }
            else
            {
                VADBCommander.CountryTextAdd(countryid.ToString(), strCountryText, Convert.ToString(ViewState["firstCategory"]));
            }
            lblInfo.Text = "Data saved.";
            DataTable dt4 = VADBCommander.CountryTextInd(countryid.ToString(), Convert.ToString(ViewState["firstCategory"]));
            if (dt4.Rows.Count > 0)
            {
                if (dt4.Rows[0]["countryText"] != null)
                {
                    lblCountryInfo.Text = dt4.Rows[0]["countryText"].ToString();
                    txtCountryText.Text = dt4.Rows[0]["countryText"].ToString().Replace("<br />-ipx-", Environment.NewLine);
                }
                if (dt4.Rows[0]["countryText2"] != null)
                {
                    lblInfo2.Text = dt4.Rows[0]["countryText2"].ToString();

                    if (string.IsNullOrEmpty(lblInfo2.Text))
                    {
                        OrangeTitle.Visible = false;
                    }
                    txtCountryText2.Text = dt4.Rows[0]["countryText2"].ToString().Replace("<br />", Environment.NewLine);
                }
            }
        }
        catch (Exception ex)
        {
            lblInfo.Text = ex.Message;
        }
    }
Пример #17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DataTable    dtRegion = new DataTable(); //load all regions sorted
            DBConnection obj1     = new DBConnection();
            dtRegion = VADBCommander.RegionList();

            foreach (DataRow row in dtRegion.Rows)
            {
                TreeNode trnRegion = new TreeNode();
                trnRegion.Text  = row["region"].ToString(); //add each region node
                trnRegion.Value = "region" + row["id"].ToString();

                trnRegion.Collapse();
                TreeView1.Nodes.Add(trnRegion);
            }
            obj1.CloseConnection();
        }
    }
Пример #18
0
    private void PopulateCal()
    {
        DBConnection    obj        = new DBConnection();
        List <DateTime> DatesTaken = new List <DateTime>();

        DataTable dt = new DataTable();

        dt = VADBCommander.PropertyAvailDatesByProperty(Request.QueryString["PropertyID"].ToString());

        foreach (DataRow row in dt.Rows)
        {
            DatesTaken.Add(Convert.ToDateTime(row["PropertyDates"].ToString()));
        }
        Session["DatesTaken"] = DatesTaken;

        Calendar2.SelectedDate = DateTime.Now.AddMonths(1);
        Calendar2.VisibleDate  = Calendar2.SelectedDate;

        Calendar3.SelectedDate = DateTime.Now.AddMonths(2);
        Calendar3.VisibleDate  = Calendar3.SelectedDate;
        Calendar4.SelectedDate = DateTime.Now.AddMonths(3);
        Calendar4.VisibleDate  = Calendar4.SelectedDate;

        Calendar5.SelectedDate = DateTime.Now.AddMonths(4);
        Calendar5.VisibleDate  = Calendar5.SelectedDate;
        Calendar6.SelectedDate = DateTime.Now.AddMonths(5);
        Calendar6.VisibleDate  = Calendar6.SelectedDate;
        Calendar7.SelectedDate = DateTime.Now.AddMonths(6);
        Calendar7.VisibleDate  = Calendar7.SelectedDate;
        Calendar8.SelectedDate = DateTime.Now.AddMonths(7);
        Calendar8.VisibleDate  = Calendar8.SelectedDate;

        Calendar9.SelectedDate  = DateTime.Now.AddMonths(8);
        Calendar9.VisibleDate   = Calendar9.SelectedDate;
        Calendar10.SelectedDate = DateTime.Now.AddMonths(9);
        Calendar10.VisibleDate  = Calendar10.SelectedDate;
        Calendar11.SelectedDate = DateTime.Now.AddMonths(10);
        Calendar11.VisibleDate  = Calendar11.SelectedDate;
        Calendar12.SelectedDate = DateTime.Now.AddMonths(11);
        Calendar12.VisibleDate  = Calendar12.SelectedDate;
    }
Пример #19
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    { //Remove
        DBConnection obj = new DBConnection();
        DataTable    dt  = new DataTable();

        try
        {
            dt = VADBCommander.NewsletterEmailByEmail(txtEmail.Text);

            if (dt.Rows.Count > 0)
            {
                VADBCommander.NewsLetterEmailOptOut(txtEmail.Text);
                lblInfo.Text = "Email removed.";
            }
            else
            {
                lblInfo.Text = "Email not found";
            }
        }
        catch (Exception ex) { lblInfo.Text = ex.Message; }
        finally { obj.CloseConnection(); }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //As long as there is a match for each email in the users table, leave
        //...but if a row has no match in users(edited by owner), remove from warning table, remove before displaying
        //if old doesn't exist in users table but does exist in emails table, update emails table w/good email & remove
        //from warning table
        DBConnection obj   = new DBConnection();
        string       query = "";

        try
        {
            DataTable dt = VADBCommander.OwnerWarningList();
            if (dt.Rows.Count > 0)
            {
                for (int i = dt.Rows.Count - 1; i >= 0; i--)
                {
                    DataTable dt2 = VADBCommander.UserInd(dt.Rows[i]["ownerID"].ToString());
                    if (dt2.Rows.Count > 0)
                    {
                        //if (dt2.Rows[0]["email"].ToString() != dt.Rows[i]["email"].ToString())
                        //{
                        //    query = "select * from newsletterEmails where email='" + dt.Rows[i]["email"].ToString() + "'";
                        //    DataTable dt3 = obj.G --deleted --etDataSet(query);
                        //    if (dt3.Rows.Count > 0)
                        //    {
                        //        string ID2 = dt3.Rows[0]["id"].ToString();

                        //    }
                        //}
                    }
                }

                grdComments.DataSource = dt;
                grdComments.DataBind();
            }
        }
        catch (Exception ex) { lblInfo.Text = ex.Message; }
        finally { obj.CloseConnection(); }
    }
Пример #21
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string    strCityText = txtCityText.Text.Replace(Environment.NewLine, "<br />");
        DataTable dt          = VADBCommander.CityTextByCountyInd(countyID.ToString());

        try
        {
            if (dt.Rows.Count > 0)
            {
                VADBCommander.CityTextByCountyEdit(countyID.ToString(), strCityText);
            }
            else
            {
                VADBCommander.CityTextByCountyAdd(countyID.ToString(), strCityText);
            }
            lblInfo.Text = "Data saved.";
        }
        catch (Exception ex)
        {
            lblInfo.Text = ex.Message;
        }
    }
Пример #22
0
    protected void btnSubmit2_Click(object sender, EventArgs e)
    {
        string    strCoutryText2 = txtCountryText2.Text.Replace(Environment.NewLine, "<br />");
        DataTable dt             = VADBCommander.GetMainCountryText(countryid.ToString());

        try
        {
            if (dt.Rows.Count > 0)
            {
                VADBCommander.CountryText2Edit(countryid.ToString(), strCoutryText2, null);
            }
            else
            {
                VADBCommander.CountryText2Add(countryid.ToString(), strCoutryText2, null);
            }
            lblerrormsg.Text = "Data Saved successfully";
            lblInfo.Text     = string.Empty;
            DataTable dt4 = VADBCommander.GetMainCountryText(countryid.ToString());
            if (dt4.Rows.Count > 0)
            {
                if (dt4.Rows[0]["CountryText"] != null)
                {
                    lblCountryInfo.Text = dt4.Rows[0]["CountryText"].ToString();
                    txtCountryText.Text = dt4.Rows[0]["CountryText"].ToString().Replace("<br />-ipx-", Environment.NewLine);
                }
                if (dt4.Rows[0]["CountryText2"] != null)
                {
                    lblInfo2.Text        = dt4.Rows[0]["CountryText2"].ToString();
                    txtCountryText2.Text = dt4.Rows[0]["CountryText2"].ToString().Replace("<br />", Environment.NewLine);
                }
            }
            BindCountryFirst();
        }
        catch (Exception ex)
        {
            lblerrormsg.Text = ex.Message;
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        DBConnection obj    = new DBConnection();
        string       query  = string.Empty;
        string       v_text = string.Empty;
        string       query2 = "";

        ImageSource();

        if (Request.QueryString["id"] == null)
        {
            Editor.Value = Editor.Value.Replace("alt=\"\" src", "alt=\"\" border='0' src");
            VADBCommander.NewsletterAdd(Editor.Value, txtTitle.Text, "No", DateTime.Now.ToString(), txtFrom.Text, txtFromName.Text);
            v_text = "saved.";
            query2 = "select @@IDENTITY from newsletters";
        }
        else
        {
            Editor.Value = Editor.Value.Replace("alt=\"\" src", "alt=\"\" border='0' src");
            VADBCommander.NewsLetterEdit(Editor.Value, txtTitle.Text, txtFrom.Text, txtFromName.Text, Request.QueryString["id"].ToString());
            v_text = "updated.";
        }
        try
        {
            lblError.Text = "Data " + v_text;
            if (query2 != "")
            {
                int i = 0;
                i             = Convert.ToInt16(obj.ExecuteScalarArtificial(query2));
                Session["id"] = i;
                query2        = "";
            }
        }
        catch (Exception ex) { lblError.Text = ex.Message + "  " + query + " : " + Session["id"]; }
        obj.CloseConnection();
    }
    protected void chkDisplay_CheckedChanged(object sender, EventArgs e)
    {
        //upon check true, save list values to db if not exists
        if (chkDisplay.Checked == true)
        {
            DBConnection    obj        = new DBConnection();
            List <DateTime> DatesTaken = (List <DateTime>)Session["DatesTaken"];

            for (int i = 0; i < DatesTaken.Count; i++)
            {
                DataTable dt = new DataTable();
                dt = VADBCommander.PropertyAvailByDate(Request.QueryString["PropertyID"].ToString(), DatesTaken[i].ToString("MM/dd/yyyy"));
                if (dt.Rows.Count < 1)
                {
                    VADBCommander.PropertyAvailDateAdd(DatesTaken[i].ToString("MM/dd/yyyy"), Request.QueryString["PropertyID"].ToString());
                    //lblTest.Text += "insert value " + DatesTaken[i].ToString("MM/dd/yyyy") + "; ";
                    //lblTest.Text += "iteration#" + i + ";";
                }
            }
            //lblTest.Text += "New Dates Saved";
            //****************this part deletes from db if user deletes from calendar before checking box
            if (Session["DatesRemove"] != null)
            {
                List <DateTime> DatesRemove = (List <DateTime>)Session["DatesRemove"];

                for (int x = 0; x < DatesRemove.Count; x++)
                {
                    try
                    {
                        VADBCommander.PropertyAvailDatesDelete(Request.QueryString["PropertyID"].ToString(), DatesRemove[x].ToString("MM/dd/yyyy"));
                    }
                    catch (Exception ex) { lblTest.Text = ex.Message; }
                }
            }
        }
    }
    protected void OwnerEmailUpdate()
    {
        //select * from users where datemodified < today and datemodified > last deploy date
        //..cycle thru this table and either update newsletteremails if id exist or add if not
        DBConnection obj   = new DBConnection();
        DataTable    dt    = new DataTable();
        string       query = "";

        try
        {
            string vDate = "";
            dt = VADBCommander.NewsletterDeployedList();;
            if (dt.Rows.Count > 0)
            {
                vDate = dt.Rows[0]["datedep"].ToString();
            }
            dt = VADBCommander.UsersInDateRangeList(DateTime.Today.ToString(), vDate);
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    DataTable dt2 = dt2 = VADBCommander.NewsLetterEmailsByOwnerID(row["id"].ToString());
                    if (dt2.Rows.Count > 0)
                    {
                        VADBCommander.UpdateNewsletterEmailByOwnerID(row["email"].ToString(), row["id"].ToString());
                    }
                    else
                    {
                        VADBCommander.NewsletterEmailsAddWithOwnerID(row["firstname"].ToString() + " " + row["lastname"].ToString(), row["email"].ToString(), row["id"].ToString());
                    }
                }
            }
        }
        catch (Exception ex) { lblError.Text = ex.Message; }
        finally { obj.CloseConnection(); }
    }
    protected void SubmitButton_Click(object sender, System.EventArgs e)
    {
        if (!IsValid)
        {
            return;
        }

        MainDataSet.Tables["Users"].Rows[0]["Email"]            = EmailAddress.Text;
        MainDataSet.Tables["Users"].Rows[0]["FirstName"]        = FirstName.Text;
        MainDataSet.Tables["Users"].Rows[0]["LastName"]         = LastName.Text;
        MainDataSet.Tables["Users"].Rows[0]["CompanyName"]      = CompanyName.Text;
        MainDataSet.Tables["Users"].Rows[0]["Address"]          = Address.Text;
        MainDataSet.Tables["Users"].Rows[0]["City"]             = City.Text;
        MainDataSet.Tables["Users"].Rows[0]["State"]            = State.Text;
        MainDataSet.Tables["Users"].Rows[0]["Zip"]              = Zip.Text;
        MainDataSet.Tables["Users"].Rows[0]["Country"]          = ddlCountries.SelectedItem.Text;
        MainDataSet.Tables["Users"].Rows[0]["PrimaryTelephone"] = PrimaryTelephone.Text;
        MainDataSet.Tables["Users"].Rows[0]["EveningTelephone"] = EveningTelephone.Text;
        MainDataSet.Tables["Users"].Rows[0]["DaytimeTelephone"] = DaytimeTelephone.Text;
        MainDataSet.Tables["Users"].Rows[0]["MobileTelephone"]  = MobileTelephone.Text;
        MainDataSet.Tables["Users"].Rows[0]["dateModified"]     = DateTime.Today.ToString();

        if (Website.Text.Length > 0)
        {
            if (!Website.Text.StartsWith("http://"))
            {
                Website.Text = "http://" + Website.Text;
            }
            MainDataSet.Tables["Users"].Rows[0]["Website"] = Website.Text;
        }
        else
        {
            MainDataSet.Tables["Users"].Rows[0]["Website"] = "";
        }

        MainDataSet.Tables["Users"].Rows[0]["Registered"]        = Registered.Text;
        MainDataSet.Tables["Users"].Rows[0]["IfPayTravelAgents"] = PayTravelAgents.Checked;

        int referredby = -1;

        try
        {
            referredby = Convert.ToInt32(Agents.SelectedValue);
        }
        catch (Exception)
        {
        }
        if (referredby != -1)
        {
            MainDataSet.Tables["Users"].Rows[0]["ReferredByID"] = referredby;
        }
        else
        {
            MainDataSet.Tables["Users"].Rows[0]["ReferredByID"] = DBNull.Value;
        }

        if (ReservationSame.Checked)
        {
            MainDataSet.Tables["Users"].Rows[0]["IfReservationSame"]    = true;
            MainDataSet.Tables["Users"].Rows[0]["ReservationEmail"]     = MainDataSet.Tables["Users"].Rows[0]["Email"];
            MainDataSet.Tables["Users"].Rows[0]["ReservationFirstName"] = MainDataSet.Tables["Users"].Rows[0]["FirstName"];
            MainDataSet.Tables["Users"].Rows[0]["ReservationLastName"]  = MainDataSet.Tables["Users"].Rows[0]["LastName"];
        }
        else
        {
            MainDataSet.Tables["Users"].Rows[0]["IfReservationSame"]    = false;
            MainDataSet.Tables["Users"].Rows[0]["ReservationEmail"]     = ReservationEmail.Text;
            MainDataSet.Tables["Users"].Rows[0]["ReservationFirstName"] = ReservationFirstName.Text;
            MainDataSet.Tables["Users"].Rows[0]["ReservationLastName"]  = ReservationLastName.Text;
        }

        if (AuthenticationManager.IfAdmin && IfAdmin.Visible)
        {
            MainDataSet.Tables["Users"].Rows[0]["IfAdmin"] = IfAdmin.Items[IfAdmin.SelectedIndex].Text == "Yes";
        }


        DBConnection obj = new DBConnection();
        DataTable    dt  = new DataTable();

        try
        {
//lock (CommonFunctions.Connection)
            MainAdapter.Update(MainDataSet, "Users");

            dt = VADBCommander.NewsletterListByEmail(EmailAddress.Text);
            if (dt.Rows.Count == 0)
            {
                string strFullName = FirstName.Text + " " + LastName.Text;
                VADBCommander.NewsLetterEmailShortAdd(EmailAddress.Text, strFullName);
            }
        }
        catch (Exception ex) { lblInfo.Text = ex.Message; }
        finally { obj.CloseConnection(); }

        Response.Redirect(CommonFunctions.PrepareURL("listings.aspx"));
    }
Пример #27
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        RegionCountriesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), "select distinct Country,Region from Countries inner join Regions on Countries.RegionID=Regions.ID " +
                                                                " inner join StateProvinces on StateProvinces.CountryID=Countries.ID " +
                                                                "where (RegionID=@RegionID)  AND EXISTS (" +
                                                                " SELECT * FROM Properties INNER JOIN Cities ON Properties.CityID = Cities.ID" +
                                                                " WHERE (Properties.IfFinished = 1) AND (Properties.IfApproved = 1)" +
                                                                " AND (Cities.StateProvinceID = StateProvinces.ID) " +
                                                                " AND NOT EXISTS (SELECT * FROM Auctions WHERE PropertyID = Properties.ID)) " +
                                                                "ORDER BY Country", SqlDbType.Int);
        StateProvincesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), "SELECT StateProvinces.* " +
                                                               "FROM StateProvinces " +
                                                               "WHERE (StateProvinces.CountryID = @CountryID) AND EXISTS (" +
                                                               " SELECT * FROM Properties INNER JOIN Cities ON Properties.CityID = Cities.ID" +
                                                               " WHERE (Properties.IfFinished = 1) AND (Properties.IfApproved = 1)" +
                                                               " AND (Cities.StateProvinceID = StateProvinces.ID) " +
                                                               " AND NOT EXISTS (SELECT * FROM Auctions WHERE PropertyID = Properties.ID)) " +
                                                               "ORDER BY StateProvince", SqlDbType.Int);
        // StateCodeInfo.Text = SqlDbType.Int.
        CitiesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), String.Format(STR_SELECTCitiesFROMCitiesWHERECitiesStateProvinceID), SqlDbType.Int);

        const string STR_SELECTPropertiesInfo = "SELECT Properties.Name2 as PropertyName2, 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 (StateProvinces.CountryID = @CountryID) 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";

        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 StateProvinces ON StateProvinces.ID = Cities.StateProvinceID " +
                                                          "WHERE (Properties.IfFinished = 1) AND (Properties.IfApproved = 1) AND (StateProvinces.CountryID = @CountryID)" +
                                                          " 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, Countries.titleoverride, stateprovinces.descriptionoverride " +
                                                         "FROM StateProvinces INNER JOIN Countries ON StateProvinces.CountryID = Countries.ID" +
                                                         " INNER JOIN Regions ON Countries.RegionID = Regions.ID WHERE (Countries.ID = @CountryId)",
                                                         SqlDbType.Int);

        PropertyTypesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), "SELECT     PropertyTypes.Name,COUNT(*) as Count, PropertyTypes.ID " +
                                                              " FROM         Cities INNER JOIN " +
                                                              " Properties ON Cities.ID = Properties.CityID  " +
                                                              " INNER JOIN " +
                                                              " PropertyTypes ON Properties.TypeID = PropertyTypes.ID INNER JOIN " +
                                                              " StateProvinces ON Cities.StateProvinceID = StateProvinces.ID INNER JOIN " +
                                                              " Countries ON StateProvinces.CountryID = Countries.ID  WHERE (Countries.ID = @CountryId) " +
                                                              "group by PropertyTypes.Name,PropertyTypes.ID",
                                                              SqlDbType.Int);


        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"));
        }
        CitiesAdapter.SelectCommand.Parameters["@CountryId"].Value        = countryid;
        LocationAdapter.SelectCommand.Parameters["@CountryId"].Value      = countryid;
        PropertiesAdapter.SelectCommand.Parameters["@CountryId"].Value    = countryid;
        AmenitiesAdapter.SelectCommand.Parameters["@CountryId"].Value     = countryid;
        PropertyTypesAdapter.SelectCommand.Parameters["@CountryId"].Value = countryid;

        Session["CountryID"] = countryid;
        if (LocationAdapter.Fill(MainDataSet, "Location") > 0)
        {
            regionid      = (int)MainDataSet.Tables["Location"].Rows[0]["RegionID"];
            countryid     = (int)MainDataSet.Tables["Location"].Rows[0]["CountryID"];
            region        = (string)MainDataSet.Tables["Location"].Rows[0]["Region"];
            country       = (string)MainDataSet.Tables["Location"].Rows[0]["Country"];
            stateprovince = (string)MainDataSet.Tables["Location"].Rows[0]["StateProvince"];
        }
        else
        {
            Response.Redirect(CommonFunctions.PrepareURL("InternalError.aspx"));
        }

        StateProvincesAdapter.SelectCommand.Parameters["@CountryID"].Value = countryid;
        RegionCountriesAdapter.SelectCommand.Parameters["@RegionId"].Value = regionid;
        CitiesAdapter.Fill(MainDataSet, "Cities");
        PropertiesAdapter.Fill(MainDataSet, "Properties");
        AmenitiesAdapter.Fill(MainDataSet, "Amenities");
        StateProvincesAdapter.Fill(MainDataSet, "StateProvinces");
        PropertyTypesAdapter.Fill(MainDataSet, "PropertyTypes");
        RegionCountriesAdapter.Fill(MainDataSet, "CountriesRegion");
        DBConnection objTemp = new DBConnection();
        DataTable    dtTemp  = new DataTable();

        try
        {
            dtTemp = VADBCommander.CountyNamesWithProperties(Request.Params["StateProvinceID"].ToString());
            DataTable dtCopy = dtTemp.Copy();
            dtCopy.TableName = "dtcopy";
            dtCopy.Namespace = "dtcopy";
            MainDataSet.Tables.Add(dtCopy);
            MainDataSet.Relations.Add("CitiesProperties", MainDataSet.Tables["Cities"].Columns["ID"],
                                      MainDataSet.Tables["Properties"].Columns["CityID"]);
            MainDataSet.Relations.Add("PropertiesAmenities", MainDataSet.Tables["Properties"].Columns["ID"],
                                      MainDataSet.Tables["Amenities"].Columns["PropertyID"]);

            MainDataSet.Relations.Add("CountyCities", MainDataSet.Tables["dtcopy"].Columns["ID"],
                                      MainDataSet.Tables["Cities"].Columns["countyID"]);
            LocationAdapterCountry.SelectCommand.Parameters["@CountryID"].Value = countryid;
        }
        catch (Exception ex) { lblInfo22.Text += ex.Message; }
        finally { objTemp.CloseConnection(); }

        foreach (DataRow datarow in MainDataSet.Tables["Cities"].Rows)
        {
            if (datarow["City"] is string)
            {
                cities += " " + (string)datarow["City"];
            }
        }
        HtmlHead head = Page.Header;

        DataBind();

        /////// 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) + " Vacation Rentals";
                    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";
                    ltrHeading.Text            = char.ToUpper(country[0]) + country.Substring(1) + " Vacations";
                    string iframe = "<iframe height='260' width='95%' frameborder='0' src='/" + country + "/Maps.aspx'></iframe>";
                    ltrCountryThing.Text       = char.ToUpper(country[0]) + country.Substring(1);
                    googleCountrymap.InnerHtml = iframe;
                    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) + " Vacation Rentals";
                        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";
                        ltrHeading.Text            = char.ToUpper(country[0]) + country.Substring(1) + " Vacations";

                        string iframe = "<iframe height='260' frameborder='0' width='95%' src='/" + country + "/Maps.aspx'></iframe>";
                        googleCountrymap.InnerHtml = iframe;
                        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) + " Vacation Rentals";
                        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) + " Vacation Rentals";
                        page.Title  = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals, Boutique Hotels | Vacations Abroad";
                    }
                    string tempcountry = 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 ";// + char.ToUpper(country[0]) + country.Substring(1) + " Vacations with unique " + char.ToUpper(country[0]) + country.Substring(1) + " vacation rentals.";
                     * head.Controls.Add(description);
                     */
                }

                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;") + ",</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  = "";
        string str_keyword = "";
        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"]) + " vacation rentals and boutique hotels in " + country + " ' title='" + Convert.ToString(dr["StateProvince"]) + " vacation rentals and boutique hotels in " + country + "' /></div></a></li>";
            str_states  += Convert.ToString(dr["StateProvince"]) + ", ";
            str_keyword += Convert.ToString(dr["StateProvince"]) + " " + country + ", ";
        }
        rtLow3.Text     = rtLow3.Text.Remove(rtLow3.Text.Length - 2, 2);
        rtHd3.InnerHtml = regionCountry + " Countries";

        //add counties to right column
        //add counties within state
        string query = "";

        /////// common for postback and ! postback ////////



        string tempstate = "/" + country.ToLower().Replace(" ", "_") + "/default.aspx";

        Session["tempstate"]   = stateprovince;
        Session["tempcountry"] = country;


        Statesul.InnerHtml = states1;
        //Page.Header.Controls.Add(new LiteralControl("<link href='http://vacations-abroad.com/css/StyleSheetBig4.css' rel='stylesheet' type='text/css'></script>"));

        int num_properties = MainDataSet.Tables["Properties"].Rows.Count;


        Page page1 = (Page)HttpContext.Current.Handler;

        HtmlMeta newdescription = new HtmlMeta();

        string str_meta = "(%number%) %country% vacation rentals and boutique hotels in %states% etc.";

        newdescription.Name    = "description";
        newdescription.Content = str_meta.Replace("%country%", country).Replace("%states%", str_states).Replace("%number%", Convert.ToString(num_properties));

        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;
        keywords.Content = str_keyword + "etc.";
        head.Controls.Add(keywords);
    }
Пример #28
0
    public DataTable PropertiesByCounty(List <string> vCases, int id, string vType)
    {
        DataTable dt    = new DataTable();
        string    query = "";
        //query for pets only
        DBConnection obj = new DBConnection();

        try
        {
            if (vType == "Country")
            {
                if (vType == "State")
                {
                    dt = VADBCommander.PropertiesByCountyList(id.ToString());
                }
                else if (vType == "City")
                {
                    VADBCommander.PropertiesByCityList(id.ToString());
                }
            }
            else
            {
                dt = VADBCommander.PropertiesByCountryList(id.ToString());
            }


            DataTable dt2 = dt;
            if (vCases.Contains("PetFriendly"))
            {
                for (int i = dt.Rows.Count - 1; i > -1; i--)
                {
                    if (dt.Rows[i]["PetFriendly"].ToString() == "")
                    {
                        dt.Rows.RemoveAt(i);
                    }
                }
            }
            if (vCases.Contains("Pool"))
            {
                for (int i = dt.Rows.Count - 1; i > -1; i--)
                {
                    if ((dt.Rows[i]["SharedPool"].ToString() == "") && (dt.Rows[i]["PrivPool"].ToString() == ""))
                    {
                        dt.Rows.RemoveAt(i);
                    }
                }
            }
            if (vCases.Contains("InternetAccess"))
            {
                for (int i = dt.Rows.Count - 1; i > -1; i--)
                {
                    if (dt.Rows[i]["InternetAccess"].ToString() == "")
                    {
                        dt.Rows.RemoveAt(i);
                    }
                }
            }
            if (vCases.Contains("HotTub"))
            {
                for (int i = dt.Rows.Count - 1; i > -1; i--)
                {
                    if (dt.Rows[i]["HotTub"].ToString() == "")
                    {
                        dt.Rows.RemoveAt(i);
                    }
                }
            }
        }

        catch (Exception ex)
        {
            throw ex;
        }
        return(dt);
    }
    //protected System.Data.SqlClient.SqlConnection Connection;

    protected void Page_Load(object sender, System.EventArgs e)
    {
        System.Data.SqlClient.SqlCommandBuilder builder = new System.Data.SqlClient.SqlCommandBuilder(EmailsAdapter);

        //if (propertyid == -1)
        //    Response.Redirect (CommonFunctions.PrepareURL ("default.aspx"), true);

        //string connectionstring = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

        //CommonFunctions.Connection.ConnectionString = connectionstring;

        PropertiesAdapter.SelectCommand.Parameters["@PropertyID"].Value = propertyid;
        PhotosAdapter.SelectCommand.Parameters["@PropertyID"].Value     = propertyid;

        //lock (CommonFunctions.Connection)
        if (PropertiesAdapter.Fill(PropertiesFullSet) < 1)
        {
            Response.Redirect(backlinkurl);
        }
        //lock (CommonFunctions.Connection)
        PhotosAdapter.Fill(PhotosSet);

        if (!(bool)PropertiesFullSet.Tables["Properties"].Rows[0]["IfApproved"] &&
            (!AuthenticationManager.IfAuthenticated ||
             ((AuthenticationManager.UserID != (int)PropertiesFullSet.Tables["Properties"].Rows[0]["UserID"]) &&
              !AuthenticationManager.IfAdmin)))
        {
            Response.Redirect(backlinkurl, true);
        }

        BackLink.NavigateUrl = CommonFunctions.PrepareURL("ViewProperty.aspx?PropertyID=" + propertyid.ToString(),
                                                          backlinktext);

        if (!IsPostBack)
        {
            DataBind();
        }

        //new link menu
        DBConnection obj = new DBConnection();

        try
        {
            string vNum = propertyid.ToString();

            //get city, state, country using property number

            DataTable dt = VADBCommander.CityStatePropertyInd(vNum);
            if (dt.Rows.Count > 0)
            {
                string vCity = dt.Rows[0]["city"].ToString();
                vNum = dt.Rows[0]["state"].ToString();

                dt = VADBCommander.StateProvinceNamedInd(vNum);
                string vState = dt.Rows[0]["state"].ToString();
                vNum = dt.Rows[0]["country"].ToString();

                dt = VADBCommander.CountryInd(vNum);
                string vCountry = dt.Rows[0]["country"].ToString();

                //lnkCountry.Text = vCountry;
                //lnkCountry.NavigateUrl = CommonFunctions.PrepareURL(vCountry + "/default.aspx");

                //lnkState.Text = vState;
                //lnkState.NavigateUrl = CommonFunctions.PrepareURL(vCountry + "/" + vState + "/default.aspx");

                //lnkCity.Text = vCity;
                //lnkCity.NavigateUrl = CommonFunctions.PrepareURL(vCountry + "/" + vState + "/" + vCity + "/default.aspx");

                lnkProperty.Text        = "Property #" + propertyid.ToString();
                lnkProperty.NavigateUrl = CommonFunctions.PrepareURL(vCountry + "/" + vState + "/" + vCity + "/" + propertyid + "/default.aspx");

                Session["emailReturnURL"] = CommonFunctions.PrepareURL(vCountry + "/" + vState + "/" + vCity + "/default.aspx");
            }
        }
        catch (Exception ex) { Response.Write("Error with response"); }
        finally { obj.CloseConnection(); }
    }
Пример #30
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        RegionCountriesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), "select distinct Country,Region from Countries inner join Regions on Countries.RegionID=Regions.ID " +
                                                                " inner join StateProvinces on StateProvinces.CountryID=Countries.ID " +
                                                                "where (RegionID=@RegionID)  AND EXISTS (" +
                                                                " SELECT * FROM Properties INNER JOIN Cities ON Properties.CityID = Cities.ID" +
                                                                " WHERE (Properties.IfFinished = 1) AND (Properties.IfApproved = 1)" +
                                                                " AND (Cities.StateProvinceID = StateProvinces.ID) " +
                                                                " AND NOT EXISTS (SELECT * FROM Auctions WHERE PropertyID = Properties.ID)) " +
                                                                "ORDER BY Country", SqlDbType.Int);
        StateProvincesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), "SELECT StateProvinces.* " +
                                                               "FROM StateProvinces " +
                                                               "WHERE (StateProvinces.CountryID = @CountryID) AND EXISTS (" +
                                                               " SELECT * FROM Properties INNER JOIN Cities ON Properties.CityID = Cities.ID" +
                                                               " WHERE (Properties.IfFinished = 1) AND (Properties.IfApproved = 1)" +
                                                               " AND (Cities.StateProvinceID = StateProvinces.ID) " +
                                                               " AND NOT EXISTS (SELECT * FROM Auctions WHERE PropertyID = Properties.ID)) " +
                                                               "ORDER BY StateProvince", SqlDbType.Int);
        // StateCodeInfo.Text = SqlDbType.Int.
        CitiesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), String.Format(STR_SELECTCitiesFROMCitiesWHERECitiesStateProvinceID), SqlDbType.Int);

        const string STR_SELECTPropertiesInfo = "SELECT Properties.Name2 as PropertyName2, 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 (StateProvinces.CountryID = @CountryID) 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";

        PropertiesAdapter  = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), String.Format(STR_SELECTPropertiesInfo), SqlDbType.Int);
        Properties2Adapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), "Select * from Properties", 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 StateProvinces ON StateProvinces.ID = Cities.StateProvinceID " +
                                                          "WHERE (Properties.IfFinished = 1) AND (Properties.IfApproved = 1) AND (StateProvinces.CountryID = @CountryID)" +
                                                          " 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, Countries.titleoverride, stateprovinces.descriptionoverride " +
                                                         "FROM StateProvinces INNER JOIN Countries ON StateProvinces.CountryID = Countries.ID" +
                                                         " INNER JOIN Regions ON Countries.RegionID = Regions.ID WHERE (Countries.ID = @CountryId)",
                                                         SqlDbType.Int);

        PropertyTypesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), "SELECT     PropertyTypes.Name,COUNT(*) as Count, PropertyTypes.ID " +
                                                              " FROM         Cities INNER JOIN " +
                                                              " Properties ON Cities.ID = Properties.CityID  " +
                                                              " INNER JOIN " +
                                                              " PropertyTypes ON Properties.TypeID = PropertyTypes.ID INNER JOIN " +
                                                              " StateProvinces ON Cities.StateProvinceID = StateProvinces.ID INNER JOIN " +
                                                              " Countries ON StateProvinces.CountryID = Countries.ID  WHERE (Countries.ID = @CountryId) " +
                                                              "group by PropertyTypes.Name,PropertyTypes.ID",
                                                              SqlDbType.Int);

        if ((Request.Params["CountryID"] != null))
        {
            try
            {
                countryid = Convert.ToInt32(Request.Params["CountryID"]);
            }
            catch (Exception)
            {
            }
        }

        if (countryid == -1)
        {
            Response.Redirect(CommonFunctions.PrepareURL("InternalError1.aspx"));
        }
        CitiesAdapter.SelectCommand.Parameters["@CountryId"].Value        = countryid;
        LocationAdapter.SelectCommand.Parameters["@CountryId"].Value      = countryid;
        PropertiesAdapter.SelectCommand.Parameters["@CountryId"].Value    = countryid;
        AmenitiesAdapter.SelectCommand.Parameters["@CountryId"].Value     = countryid;
        PropertyTypesAdapter.SelectCommand.Parameters["@CountryId"].Value = countryid;

        Session["CountryID"] = countryid;
        if (LocationAdapter.Fill(MainDataSet, "Location") > 0)
        {
            regionid      = (int)MainDataSet.Tables["Location"].Rows[0]["RegionID"];
            countryid     = (int)MainDataSet.Tables["Location"].Rows[0]["CountryID"];
            region        = (string)MainDataSet.Tables["Location"].Rows[0]["Region"];
            country       = (string)MainDataSet.Tables["Location"].Rows[0]["Country"];
            stateprovince = (string)MainDataSet.Tables["Location"].Rows[0]["StateProvince"];
        }
        else
        {
            Response.Redirect(CommonFunctions.PrepareURL("InternalError.aspx"));
        }

        StateProvincesAdapter.SelectCommand.Parameters["@CountryID"].Value = countryid;
        RegionCountriesAdapter.SelectCommand.Parameters["@RegionId"].Value = regionid;
        CitiesAdapter.Fill(MainDataSet, "Cities");
        PropertiesAdapter.Fill(MainDataSet, "Properties");
        Properties2Adapter.Fill(SecondaryDataSet, "Properties");
        AmenitiesAdapter.Fill(MainDataSet, "Amenities");
        StateProvincesAdapter.Fill(MainDataSet, "StateProvinces");
        PropertyTypesAdapter.Fill(MainDataSet, "PropertyTypes");
        RegionCountriesAdapter.Fill(MainDataSet, "CountriesRegion");
        DBConnection objTemp = new DBConnection();

        try
        {
            MainDataSet.Relations.Add("CitiesProperties", MainDataSet.Tables["Cities"].Columns["ID"],
                                      MainDataSet.Tables["Properties"].Columns["CityID"]);
            MainDataSet.Relations.Add("PropertiesAmenities", MainDataSet.Tables["Properties"].Columns["ID"],
                                      MainDataSet.Tables["Amenities"].Columns["PropertyID"]);
        }
        catch (Exception ex) {  }
        finally { objTemp.CloseConnection(); }

        foreach (DataRow datarow in MainDataSet.Tables["Cities"].Rows)
        {
            if (datarow["City"] is string)
            {
                cities += " " + (string)datarow["City"];
            }
        }
        HtmlHead head = Page.Header;

        DataBind();

        /////// common for postback and ! postback
        List <string> vList        = new List <string>();
        DataTable     dt           = new DataTable();
        DataTable     dtCategories = new DataTable();
        DBConnection  obj          = new DBConnection();

        try
        {
            dt = VADBCommander.CityTextInd(cityid.ToString());
        }
        catch (Exception ex) { lblInfo22.Text = ex.Message; }
        finally { obj.CloseConnection(); }

        //NO NEED TO CHECK IF EMPTY FOR BOTTOM, OK TO SHOW NOTHING


        if (!IsPostBack)
        {
            DataTable     dt1  = new DataTable();
            DataFunctions obj1 = new DataFunctions();

            try
            {
                dt1 = obj1.PropertiesByCase(vList, countryid, "Country");
                DataView dv = dt1.DefaultView;
                // dv.Sort = "minNightRate desc";
                dt1 = dv.ToTable();

                FillPropertiesBox(dt1, string.Empty);

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


                DataView dvMax = dtCategories.DefaultView;
                // dvMax.Sort = "count desc";
                DataTable dtMax          = dvMax.ToTable();
                int       vCategoryCount = 0;
                string    firstCategory  = "";
                string    PropertyName   = "";
                string    subCategory    = "";

                foreach (DataRow row in dtMax.Rows)
                {
                    int index = dtMax.Rows.IndexOf(row);
                    if (index == 0)
                    {
                        firstCategory = row["category"].ToString();
                        subCategory   = dt1.Rows[0]["SubCategory"].ToString();
                    }
                    PropertyName = PropertyName + row["category"].ToString() + "s" + ", ";
                    string vTemp = row["category"].ToString() + " (" + row["count"].ToString() + ")";
                    vTemp = vTemp.Replace(" ", "&nbsp;");
                    //rdoTypes.Items.Add(vTemp + " ");
                    vCategoryCount = vCategoryCount + Convert.ToInt32(row["count"].ToString());
                }

                if (!IsPostBack)
                {
                    Session["t"] = dtCategories;
                }

                Page page = (Page)HttpContext.Current.Handler;

                if (dt1.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 dispString2 = "";
                    string dispString  = "";

                    if (firstCategory.Contains("_"))
                    {
                        string[] strSplit = firstCategory.Split('_');
                        dispString2 = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1]) + "s";
                    }
                    else
                    {
                        dispString2 = UppercaseFirst(firstCategory) + "s";
                    }

                    Session["dtRecalc"] = dt1;
                    Session["dt"]       = dt1;

                    //City_datagrid.DataSource = dt1;
                    //City_datagrid.DataBind();


                    ltrH11.Text = "Vacation Properties in " + country;


                    hyplnkCountryBackLink.NavigateUrl = "/" + country.ToLower().Replace(" ", "_") + "/default.aspx";
                    ltrCountryBackText.Text           = country + "<<";

                    page.Title = "Vacation Properties in " + country;
                }
                else
                {
                    if (Request.QueryString["category"] != null)
                    {
                        firstCategory = Convert.ToString(Request.QueryString["category"]);

                        string dispString = "";
                        if (firstCategory.Contains("_"))
                        {
                            string[] strSplit = firstCategory.Split('_');
                            dispString = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1]) + "s";
                            foreach (DataRow dr in dt1.Rows)
                            {
                                if (dr["Category"].ToString().ToLower().Contains(strSplit[0]))
                                {
                                    subCategory = dr["SubCategory"].ToString();
                                    break;
                                }
                            }
                        }
                        else
                        {
                            dispString = UppercaseFirst(firstCategory) + "s";
                            foreach (DataRow dr in dt1.Rows)
                            {
                                if (dr["Category"].ToString().ToLower().Equals(firstCategory))
                                {
                                    subCategory = dr["SubCategory"].ToString();
                                    break;
                                }
                            }
                        }



                        ltrH11.Text = char.ToUpper(city[0]) + city.Substring(1) + " " + dispString;

                        hyplnkCountryBackLink.NavigateUrl = "/" + country.ToLower().Replace(" ", "_") + "/default.aspx";
                        ltrCountryBackText.Text           = country + "<<";

                        page.Title = country + " " + dispString + " " + "and" + " " + char.ToUpper(city[0]) + city.Substring(1) + " " + "Property Rentals | Vacations Abroad";
                    }
                    else
                    {
                        string dispString  = "";
                        string dispString2 = "";

                        if (firstCategory.Contains("_"))
                        {
                            string[] strSplit = firstCategory.Split('_');
                            dispString2 = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1]) + "s";
                        }
                        else
                        {
                            dispString2 = UppercaseFirst(firstCategory) + "s";
                        }

                        ltrH11.Text = "Vacation Properties in " + country;

                        hyplnkCountryBackLink.NavigateUrl = "/" + country.ToLower().Replace(" ", "_") + "/default.aspx";
                        ltrCountryBackText.Text           = country + "<<";

                        page.Title = "Vacation Properties in " + country;
                    }
                    DataTable dtCategory = dt1.Clone();



                    foreach (DataRow dr in dt1.Rows)
                    {
                        string vTemp = dr["category"].ToString().Replace("&", "and").ToLower(); //+ " (" + dr["count"].ToString() + ")";
                                                                                                // vTemp = vTemp.Replace(" ", "&nbsp;");

                        if (vTemp.ToLower().Replace(" ", "").Trim() == firstCategory.ToLower().Replace("_", " ").Replace(" ", ""))
                        {
                            //subCategory = dr["SubCategory"].ToString();
                            dtCategory.ImportRow(dr);
                        }
                    }
                    Session["dtRecalc"] = dtCategory.DefaultView.Table;
                    Session["dt"]       = dtCategory.DefaultView.Table;

                    DataView dv1 = dtCategory.DefaultView;
                    //   dv1.Sort = "MinNightRate asc";



                    //Session["dt"] = dv1.ToTable();
                    //City_datagrid.DataSource = dv1;
                    //City_datagrid.DataBind();
                }
            }
            catch (Exception ex) { lblInfo22.Text = ex.Message; }
        }

        //add cities to right column
        DBConnection obj3 = new DBConnection();

        try
        {
            #region Cities within State
            SqlDataReader reader3 = 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");
            while (reader3.Read())
            {
                if (reader3["City"] is string)
                {
                    string temp = "/" + country + "/" + stateprovince + "/" + reader3["city"].ToString() + "/default.aspx";
                    temp = temp.ToLower();
                    temp = temp.Replace(' ', '_');
                }
            }
            reader3.Close();

            #endregion

            #region States within Country
            DataTable dtCountries = new DataTable();
            dtCountries = obj3.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(' ', '_');

                    // divCitiesRt.InnerHtml += "<a  href=\"" + temp + "\">" + row["stateprovince"].ToString().Replace(" ", "&nbsp;") + "</a>, ";
                }
            }
            //divCitiesRt.InnerHtml = divCitiesRt.InnerHtml.Remove(divCitiesRt.InnerHtml.Length - 2, 2);
            #endregion
        }
        catch (Exception ex) { lblInfo22.Text = ex.Message + "22"; }
        finally { obj3.CloseConnection(); }

        Session["state"]   = stateprovince;
        Session["country"] = country;


//        Page.Header.Controls.Add(new LiteralControl("<link href='http://vacations-abroad.com/css/StyleSheetBig4.css' rel='stylesheet' type='text/css' />"));
        //Page.Header.Controls.Add(new LiteralControl("<script src='http://vacations-abroad.com/wz_tooltip.js' type='text/javascript'></script>"));
    }