protected void InvoicesGrid_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowIndex != -1) { DBConnection obj = new DBConnection(); try { HyperLink lnkProperty = (HyperLink)e.Row.FindControl("hlkProperty"); if (lnkProperty != null) { string vNum = lnkProperty.Text; //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(); lnkProperty.NavigateUrl = CommonFunctions.PrepareURL(vCountry + "/" + vState + "/" + vCity + "/" + lnkProperty.Text + "/default.aspx"); } } } catch (Exception ex) { Response.Write("Error with response"); } finally { obj.CloseConnection(); } } }
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 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(); } }