protected void btnEliminar_Click(object sender, EventArgs e) { if (gvInmuebles.SelectedIndex != -1) { string num; InmueblesBLL bllInmuebles = new InmueblesBLL(); bllInmuebles.Delete(gvInmuebles.SelectedValue.ToString()); for (int i = 1; i <= 10; i++) { try { if (i < 10) { num = 0 + i.ToString(); } else { num = i.ToString(); } File.Delete(Server.MapPath("~\\Image_Upload\\" + gvInmuebles.SelectedValue.ToString() + "-" + num + ".jpg")); File.Delete(Server.MapPath("~\\Image_Upload\\" + gvInmuebles.SelectedValue.ToString() + "-" + num + "_thumb.jpg")); } catch { } } IniciaGridView(); } }
protected void Page_Load(object sender, EventArgs e) { InmueblesBLL bllinmuebles = new InmueblesBLL(); ProvinciasBLL bllprovincia = new ProvinciasBLL(); LocalidadesBLL blllocalidades = new LocalidadesBLL(); dt = bllinmuebles.SelectAllInmuebles(); foreach (DataRow dtRow in dt.Rows) { if (dtRow["Latitud"].ToString() == "" || dtRow["Longitud"].ToString() == "") { var id = dtRow["IdInmueble"].ToString(); var direccion = dtRow["Calle"].ToString(); var numero = dtRow["Numero"].ToString(); string idLocalidad = dtRow["idLocalidad"].ToString(); string idprovincia = dtRow["idprovincia"].ToString(); coordinate = getCoordinate(direccion, numero, blllocalidades.GetNombreLocalidad(Convert.ToInt32(idLocalidad)), bllprovincia.GetNombreProvincia(Convert.ToInt32(idprovincia))); bllinmuebles.SetLatitudLongitud(id, coordinate.Latitude, coordinate.Longitude); sumcant++; if (sumcant >= cant) return; } } }
//Boton Aceptar - Guarda la propiedad y direcciona a la pagina de carga de imagenes protected void btnAceptar_Click1(object sender, EventArgs e) { if (CheckCHBLPalabrasCLaves(1)) { try { InmueblesBLL bllInmuebles = new InmueblesBLL(); bllInmuebles.Insert(cargarPropiedad()); string ID = bllInmuebles.SeleccionaIdDelUltimoInmueble(Membership.GetUser().ProviderUserKey.ToString()); Response.Redirect("AltaImagen.aspx?IdInmueble=" + ID, false); } catch (Exception exe) { //lblError.Text = exe.Message.ToString(); lblError.Text = "Error al cargar la Propiedad, por favor intente nuevamente"; } } else { lblPalbrasClaves.Visible = true; } }
private void createJson() { InmueblesBLL bllinmuebles = new InmueblesBLL(); dt = bllinmuebles.SelectAllInmuebles(); int count = 0; int position = 0; foreach (DataRow dtRow in dt.Rows) { if (dtRow["Latitud"].ToString() != "" && dtRow["Longitud"].ToString() != "") { count++; } } count = 100; string json = "{\"count\":" + count + ",\"photos\":["; foreach (DataRow dtRow in dt.Rows) { if (dtRow["Latitud"].ToString() != "" && dtRow["Longitud"].ToString() != "") { position++; if (position < 99) { json += "{" + "\"mark_id\":\"" + dtRow["IdInmueble"].ToString().Trim() + "\"," + "\"Inmueble_dir\":\"" + dtRow["Calle"].ToString().Trim() + " " + dtRow["Numero"].ToString().Trim() + "\"," + "\"latitude\":" + convert(dtRow["Latitud"].ToString()) + "," + "\"longitude\":" + convert(dtRow["Longitud"].ToString()) + "},"; } else { if (position == 100) { json += "{" + "\"mark_id\":\"" + dtRow["IdInmueble"].ToString().Trim() + "\"," + "\"Inmueble_dir\":\"" + dtRow["Calle"].ToString().Trim() + " " + dtRow["Numero"].ToString().Trim() + "\"," + "\"latitude\":" + convert(dtRow["Latitud"].ToString()) + "," + "\"longitude\":" + convert(dtRow["Longitud"].ToString()) + "}"; } } } } json += "]}"; Response.Clear(); Response.ContentType = "application/json; charset=utf-8"; Response.Write(json); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { if (Membership.GetUser().ProviderUserKey.ToString().ToUpper() == "9F96F761-93E2-4153-A861-2007BF84B7A3") { InmueblesBLL bllInmueble = new InmueblesBLL(); DataTable dtInmueblesToUnlock = bllInmueble.SelectAllInmueblesOutdated(); foreach (DataRow dRow in dtInmueblesToUnlock.Rows) { sendmail(dRow["idInmueble"].ToString(), dRow["Email"].ToString(), dRow["EmailAlternativo"].ToString(), dRow["Calle"].ToString(), dRow["Numero"].ToString()); //sendmail(dRow["idInmueble"].ToString(), "*****@*****.**", "*****@*****.**"); } } }
protected void btnEliminar_Click2(object sender, EventArgs e) { if (gvInmuebles.SelectedIndex != -1) { string num; InmueblesBLL bllInmuebles = new InmueblesBLL(); ProyectoInmoBLL.InmobiliariasBLL inmobll = new ProyectoInmoBLL.InmobiliariasBLL(); if (rblDelete.SelectedValue == "2") { string g = cboInmobiliarias.SelectedIndex.ToString(); bllInmuebles.Shared(gvInmuebles.SelectedValue.ToString(), cboInmobiliarias.SelectedValue.ToString(), cboInmobiliarias2.SelectedValue.ToString(), inmobll.SelectNombreInmobiliaria(Membership.GetUser().ProviderUserKey.ToString())); } bllInmuebles.Delete(gvInmuebles.SelectedValue.ToString()); for (int i = 1; i <= 10; i++) { try { if (i < 10) { num = 0 + i.ToString(); } else { num = i.ToString(); } File.Delete(Server.MapPath("~\\Image_Upload\\" + gvInmuebles.SelectedValue.ToString() + "-" + num + ".jpg")); File.Delete(Server.MapPath("~\\Image_Upload\\" + gvInmuebles.SelectedValue.ToString() + "-" + num + "_thumb.jpg")); } catch { } } IniciaGridView(); Page.Response.Redirect(Page.Request.Url.ToString(), true); } }
private void createJson() { InmueblesBLL bllinmuebles = new InmueblesBLL(); dt = bllinmuebles.SelectSharedJson(); string json; string data = ""; int position = 0; int count = 0; foreach (DataRow dtRow in dt.Rows) { count++; } foreach (DataRow dtRow in dt.Rows) { position++; data += "{" + "\"Fecha\"" + ":" + "\"" + dtRow["Fecha"].ToString().Trim() + "\"" + "," + "\"Inmobiliaria1\"" + ":" + "\"" + dtRow["Inmobiliaria1"].ToString().Trim() + "\"" + "," + "\"Inmobiliaria2\"" + ":" + "\"" + dtRow["Inmobiliaria2"].ToString().Trim() + "\"" + "," + "\"TiposDeInmuebles\"" + ":" + "\"" + dtRow["Tipo de Inmueble"].ToString().Trim() + "\"" + "," + "\"Direccion\"" + ":" + "\"" + dtRow["Direccion"].ToString().Trim() + "\"" + "," + "\"Localidad\"" + ":" + "\"" + dtRow["Localidad"].ToString().Trim() + "\"" + "," + "\"Operacion\"" + ":" + "\"" + dtRow["Operacion"].ToString().Trim() + "\"" + "," + "\"Zona\"" + ":" + "\"" + dtRow["Zona"].ToString().Trim() + "\"" + "}"; if (position < count) { data +=","; } } json = "{\"count\":" + count + ",\"inmueblesShared\":[" + data; json += "]}"; Response.Clear(); Response.ContentType = "application/json; charset=utf-8"; Response.Write(json); Response.End(); }
protected void unlockuserInmuebles(string IdUsuario) { try { InmueblesBLL bllInmueble = new InmueblesBLL(); DataTable dtInmueblesToUnlock = bllInmueble.SeleccionaInmuebleDescatualizadoUnlock(IdUsuario); foreach (DataRow dRow in dtInmueblesToUnlock.Rows) { bllInmueble.UpdateInmuebleUnlock(dRow["idInmueble"].ToString()); } } catch (Exception exe) { //lblError.Text = exe.Message; Response.Redirect("MisPropiedades.aspx"); } }
protected void cargarInmuebles() { try { DataGrid1.Visible = false; InmueblesBLL bllInmuebles = new InmueblesBLL(); dt = bllInmuebles.SeleccionaInmueblesNuevos(Membership.GetUser().ProviderUserKey.ToString()); if (dt.Rows.Count != 0) { DataGrid1.DataSource = null; DataGrid1.DataSource = dt; DataGrid1.CurrentPageIndex = 0; DataGrid1.DataBind(); Session["grd_ItemList"] = dt; DataGrid1.Visible = true; } } catch { } }
public void GetPropiedadesCompartidas() { InmueblesBLL usuariosbll = new InmueblesBLL(); Response.Clear(); Response.AddHeader("content-disposition", "attachment;filename=" + "InmueblesRetiradosINCI" + ".xls"); Response.ContentType = "application/vnd.ms-excel"; StringWriter stringWriter = new StringWriter(); HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWriter); DataGrid dataExportExcel = new DataGrid(); dataExportExcel.ItemDataBound += new DataGridItemEventHandler(dataExportExcel_ItemDataBound); dataExportExcel.DataSource = usuariosbll.SelectSharedExcel(); dataExportExcel.DataBind(); dataExportExcel.RenderControl(htmlWrite); StringBuilder sbResponseString = new StringBuilder(); sbResponseString.Append("<html xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns=\"http://www.w3.org/TR/REC-html40\"> <head><meta http-equiv=\"Content-Language\" content=\"es\"><meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\"><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>" + "InmueblesRetiradosINCI" + "</x:Name><x:WorksheetOptions><x:Panes></x:Panes></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head> <body>"); sbResponseString.Append(stringWriter + "</body></html>"); sbResponseString.Append(stringWriter + "</body></html>"); Response.Write(sbResponseString.ToString()); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { InmueblesBLL bllinmuebles = new InmueblesBLL(); dt = bllinmuebles.SelectAllInmuebles(); foreach (DataRow dtRow in dt.Rows) { if (dtRow["Latitud"].ToString() != "" && dtRow["Longitud"].ToString() != "") { json += "{" + dtRow["IdInmueble"].ToString() + "," + dtRow["Calle"].ToString() + "," + dtRow["Numero"].ToString() + "," + dtRow["Latitud"].ToString() + "," + dtRow["Longitud"].ToString() + "},"; } } json += "]"; Response.Clear(); Response.ContentType = "application/json; charset=utf-8"; Response.Write(json); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.bllInmuebles = new InmueblesBLL(); IdInmueble = Request.QueryString["IdInmueble"]; IdTransaction = Request.QueryString["IdTransaction"]; txtFechaFinObra.Attributes.Add("readonly", "true"); EditarPropiedad(); } }
protected void Button1_Click(object sender, EventArgs e) { //System.Threading.Thread.Sleep(5000); //CalcularSesion(); try { DataGrid1.Visible = false; InmueblesBLL bllInmuebles = new InmueblesBLL(); dt = bllInmuebles.SeleccionaOfertas(Membership.GetUser().ProviderUserKey.ToString()); if (dt.Rows.Count != 0) { DataGrid1.DataSource = null; DataGrid1.DataSource = dt; DataGrid1.CurrentPageIndex = 0; DataGrid1.DataBind(); Session["grd_ItemList"] = dt; DataGrid1.Visible = true; } else if (dt.Rows.Count == 0) { } } catch { } }
private void createJson() { InmueblesBLL bllinmuebles = new InmueblesBLL(); dt = bllinmuebles.SelectAllInmueblesMapaPublico(); int count = 0; int position = 0; foreach (DataRow dtRow in dt.Rows) { DateTime FechaActualiza = Convert.ToDateTime(dtRow["fechaactualiza"].ToString()); TimeSpan diferencia = DateTime.Now - FechaActualiza; if (diferencia.Days <= 90) { if (dtRow["Latitud"].ToString() != "" && dtRow["Longitud"].ToString() != "") { count++; } } } //count = 100; string json = "{\"count\":" + count + ",\"photos\":["; foreach (DataRow dtRow in dt.Rows) { DateTime FechaActualiza = Convert.ToDateTime(dtRow["fechaactualiza"].ToString()); TimeSpan diferencia = DateTime.Now - FechaActualiza; if (diferencia.Days <= 90) { if (dtRow["Latitud"].ToString() != "" && dtRow["Longitud"].ToString() != "") { position++; if (dtRow["Numero"].ToString() == "900") { } if (position < count) { json += "{" + "\"mark_id\":\"" + dtRow["IdInmueble"].ToString() + "\"," + "\"Inmueble_dir\":\"" + validateNull(dtRow["Calle"].ToString()) + " " + validateNull(dtRow["Numero"].ToString()) + "\"," + "\"latitude\":" + convert(dtRow["Latitud"].ToString()) + "," + "\"longitude\":" + convert(dtRow["Longitud"].ToString()) + "," + "\"tipo\":\"" + dtRow["Tipo"].ToString() + "\"," + "\"Piso\":\"" + validateNull(dtRow["Piso"].ToString()) + "\"," + "\"Departamento\":\"" + validateNull(dtRow["Departamento"].ToString()) + "\"," + "\"Operacion\":\"" + dtRow["Operacion"].ToString().Trim() + "\"," + "\"nombreInmobiliaria\":\"" + dtRow["NombreInmobiliaria"].ToString() + "\"},"; } else { //if (position == count) { json += "{" + "\"mark_id\":\"" + dtRow["IdInmueble"].ToString() + "\"," + "\"Inmueble_dir\":\"" + dtRow["Calle"].ToString() + " " + dtRow["Numero"].ToString() + "\"," + "\"latitude\":" + convert(dtRow["Latitud"].ToString()) + "," + "\"longitude\":" + convert(dtRow["Longitud"].ToString()) + "," + "\"tipo\":\"" + dtRow["Tipo"].ToString() + "\"," + "\"Piso\":\"" + validateNull(dtRow["Piso"].ToString()) + "\"," + "\"Departamento\":\"" + validateNull(dtRow["Departamento"].ToString()) + "\"," + "\"Operacion\":\"" + dtRow["Operacion"].ToString().Trim() + "\"," + "\"nombreInmobiliaria\":\"" + dtRow["NombreInmobiliaria"].ToString() + "\"}"; // } } } } } json += "]}"; Response.Clear(); Response.ContentType = "application/json; charset=utf-8"; Response.Write(json); Response.End(); }
protected void btnAcceder_Click(object sender, EventArgs e) { if (Membership.ValidateUser(txtUser.Value, txtPass.Value)) { MembershipUser mu = Membership.GetUser(txtUser.Value); //Session.Timeout = 2400; //Session.Add("UserId", (Guid)mu.ProviderUserKey); //Session.Add("UserName", mu.UserName); //string[] losroles = Roles.GetRolesForUser(mu.UserName); //Session.Add("UserRoles", losroles); //Session.Add("UserEmail", mu.Email); UsuarioBLL bllUsuario = new UsuarioBLL(); InmueblesBLL bllInmueble = new InmueblesBLL(); DataTable dtInmueblesLock = bllInmueble.SeleccionaInmuebleDescatualizadoUnlock(mu.ProviderUserKey.ToString()); //DateTime datePrimerFechaInmueble = bllInmueble.SeleccionaInmuebleDescatualizado(mu.ProviderUserKey.ToString()); //TimeSpan diferenciaInmueble = DateTime.Now - datePrimerFechaInmueble; DataTable dtFechaIngresoUsuario = bllUsuario.SelectLastIngreso(mu.ProviderUserKey.ToString()); //TimeSpan diferenciaIngresoUsuario = DateTime.Now - datePrimerFechaIngresoUsuario; //if (diferenciaInmueble.Days >= 3000) if (dtInmueblesLock.Rows.Count != 0)//if (diferenciaInmueble.Days >= 120) { lblError.InnerText = "Su contraseña ha sido bloqueada por tener propiedades desactualizadas. Por favor, para desbloquearla comuniquese con Lucía Recalde u Oscar Argente. Muchas gracias."; lblError.Attributes.Add("onclick", "somejavascript"); //= "Su contraseña ha sido bloqueada por tener propiedades desactualizadas. Por favor, para desbloquearla comuniquese con Lucía Recalde u Oscar Argente. Muchas gracias."; sendmail(lblError.InnerText, mu.ProviderUserKey.ToString()); } else if (dtFechaIngresoUsuario.Rows.Count == 0) { lblError.InnerText = "Su contraseña ha sido bloqueada debido a que hace más de 45 días que no ingresa al Sistema. Por favor, para desbloquearla comuniquese con Lucía Recalde u Oscar Argente. Muchas gracias."; sendmail(lblError.InnerText, mu.ProviderUserKey.ToString()); } else { bllUsuario.InsertIngresosUsuarios(mu.ProviderUserKey.ToString()); FormsAuthentication.RedirectFromLoginPage(mu.UserName, false); } } else { MembershipUser user = Membership.FindUsersByName(txtUser.Value)[txtUser.Value]; if (user != null) { if (user.IsLockedOut == true || user.IsApproved == false) { lblError.InnerText = "Su usuario ha sido bloqueado por el sistema, si desea asistencia póngase en contacto con el equipo de soporte."; } else { lblError.InnerText = "El nombre de usuario o contraseña es incorrecto"; } } else { lblError.InnerText = "El nombre de usuario o contraseña es incorrecto"; } } }
protected void btnEliminarOferta_Click(object sender, EventArgs e) { InmueblesBLL bllInmuebles = new InmueblesBLL(); bllInmuebles.EliminarOferta(Membership.GetUser().ProviderUserKey.ToString()); }
protected void IniciaGridView() { if (rdOperacion.SelectedValue == "") { rdOperacion.SelectedValue = "0"; } if (ddlTipoDeInmueble.SelectedValue == null || ddlTipoDeInmueble.SelectedValue == "") { InmueblesBLL bllInmuebles = new InmueblesBLL(); DataTable dt = bllInmuebles.SeleccionaInmuebles(Membership.GetUser().ProviderUserKey.ToString(), 0, Convert.ToInt32(rdOperacion.SelectedValue), ddlOrdenar.SelectedValue.ToString(), chkActivas.Checked); gvInmuebles.DataSource = dt; Session["grd_ItemList2"] = dt; if (dt.Rows.Count == 0) { btnEditar.Visible = false; btnDuplicar.Visible = false; btnEliminarShared.Visible = false; //btnEliminarShared.Visible = false; btnFicha.Visible = false; btnOferta.Visible = false; btnEliminarOferta.Visible = false; } else { btnEditar.Visible = true; btnDuplicar.Visible = true; btnEliminarShared.Visible = true; //btnEliminarShared.Visible = true; btnFicha.Visible = true; btnOferta.Visible = true; btnEliminarOferta.Visible = true; } gvInmuebles.DataBind(); gvInmuebles.SelectedIndex = -1; } else { InmueblesBLL bllInmuebles = new InmueblesBLL(); DataTable dt = bllInmuebles.SeleccionaInmuebles(Membership.GetUser().ProviderUserKey.ToString(), Convert.ToInt32(ddlTipoDeInmueble.SelectedValue), Convert.ToInt32(rdOperacion.SelectedValue), ddlOrdenar.SelectedValue.ToString(), chkActivas.Checked); gvInmuebles.DataSource = dt; Session["grd_ItemList2"] = dt; if (dt.Rows.Count == 0) { btnEditar.Visible = false; btnDuplicar.Visible = false; btnEliminarShared.Visible = false; //btnEliminarShared.Visible = false; btnFicha.Visible = false; btnOferta.Visible = false; btnEliminarOferta.Visible = false; } else { btnEditar.Visible = true; btnDuplicar.Visible = true; btnEliminarShared.Visible = true; //btnEliminarShared.Visible = true; btnFicha.Visible = true; btnOferta.Visible = true; btnEliminarOferta.Visible = true; } gvInmuebles.DataBind(); gvInmuebles.SelectedIndex = -1; } }
protected void DetailsView1_ItemCommand(object sender, DetailsViewCommandEventArgs e) { //CalcularSesion(); if (e.CommandName == "Editar") { dt = (DataTable)Session["grd_ItemList2"]; if (dt.Rows[0]["IdUsuario"].ToString() == Membership.GetUser().ProviderUserKey.ToString()) { IdInmueble = dt.Rows[0]["IdInmueble"].ToString(); Response.Redirect("ModificarPropiedad.aspx"); } } else if (e.CommandName == "Eliminar") { dt = (DataTable)Session["grd_ItemList2"]; if (dt.Rows[0]["IdUsuario"].ToString() == Membership.GetUser().ProviderUserKey.ToString()) { //Response.Write("<script>window.alert('Hola');</script>"); //Response.Redirect("ModificarPropiedad.aspx?id=" // + dt.Rows[0]["IdInmueble"].ToString()); //CalcularSesion(); IdInmueble = dt.Rows[0]["IdInmueble"].ToString(); InmueblesBLL bllInmuebles = new InmueblesBLL(); bllInmuebles.Delete(IdInmueble); for (int i = 1; i <= 10; i++) { try { File.Delete(Server.MapPath("~\\Image_Upload\\" + IdInmueble + "-" + i + ".jpg")); File.Delete(Server.MapPath("~\\Image_Upload\\" + IdInmueble + "-" + i + "_thumb.jpg")); } catch { } } Response.Redirect("MisPropiedades.aspx"); } } }
protected void btnAceptar_Click1(object sender, EventArgs e) { //CalcularSesion(); //if (CheckCHBLPalabrasCLaves(1)) //{ if (Request.QueryString["IdTransaction"] == "0") { try { InmueblesBLL bllInmuebles = new InmueblesBLL(); bllInmuebles.Update(cargarPropiedad()); Response.Redirect("AltaImagen.aspx?IdInmueble=" + Request.QueryString["IdInmueble"], false); } catch (Exception exe) { //lblError.Text = exe.Message.ToString(); lblError.Text = "Error al cargar la Propiedad, por favor intente nuevamente"; } } else if (Request.QueryString["IdTransaction"] == "1") { try { InmueblesBLL bllInmuebles = new InmueblesBLL(); bllInmuebles.Insert(cargarPropiedad()); string ID = bllInmuebles.SeleccionaIdDelUltimoInmueble(Membership.GetUser().ProviderUserKey.ToString()); if (Directory.Exists(Server.MapPath("~") + @"\Image_Upload\")) { for (int i = 1; i < 10; i++) { string test = Server.MapPath("~") + @"\Image_Upload\" + IdInmueble + "-0" + i + ".jpg"; if (File.Exists(Server.MapPath("~") + @"\Image_Upload\" + IdInmueble + "-0" + i +".jpg")) { File.Copy(Server.MapPath("~") + @"\Image_Upload\" + IdInmueble + "-0" + i + ".jpg", Server.MapPath("~") + @"\Image_Upload\" + ID + "-0" + i + ".jpg"); File.Copy(Server.MapPath("~") + @"\Image_Upload\" + IdInmueble + "-0" + i + "_thumb.jpg", Server.MapPath("~") + @"\Image_Upload\" + ID + "-0" + i + "_thumb.jpg"); } if (File.Exists(Server.MapPath("~") + @"\Image_Upload\" + IdInmueble + "-" + i + ".jpg")) { File.Copy(Server.MapPath("~") + @"\Image_Upload\" + IdInmueble + "-" + i + ".jpg", Server.MapPath("~") + @"\Image_Upload\" + ID + "-" + i + ".jpg"); File.Copy(Server.MapPath("~") + @"\Image_Upload\" + IdInmueble + "-" + i + "_thumb.jpg", Server.MapPath("~") + @"\Image_Upload\" + ID + "-" + i + "_thumb.jpg"); } } } Response.Redirect("FichaPropiedad.aspx?IdInmueble=" + ID, false); //Response.Redirect("AltaImagen.aspx?IdInmueble=" + ID, false); } catch (Exception exe) { //lblError.Text = exe.Message.ToString(); lblError.Text = "Error al cargar la Propiedad, por favor intente nuevamente"; } } //} //else //{ // lblPalbrasClaves.Visible = true; //} }
private void getInmueblePorID(InmueblesBLL bllInmuebles) { dt = bllInmuebles.SeleccionaInmueblesPorID(Convert.ToInt32(IdInmueble)); //dt.Columns.Add(new DataColumn("Seccion", typeof(string))); //dt.Columns.Add(new DataColumn("Manzana", typeof(string))); //dt.Columns.Add(new DataColumn("Grafico", typeof(string))); dt.Columns.Add(new DataColumn("fechafinobra", typeof(string))); //dt.Columns.Add(new DataColumn("Subdivision", typeof(string))); if (dt.Rows[0]["fechafindeobra"].ToString() != "") { dt.Rows[0]["fechafinobra"] = dt.Rows[0]["fechafindeobra"].ToString().Substring(0, 10); } //string[] PISO = null; //if (dt.Rows[0]["Piso"].ToString() != "") //{ // PISO = dt.Rows[0]["Piso"].ToString().Split('-'); // if (PISO.Length >= 1) // { // if (PISO[0] != "0") // { // dt.Rows[0]["Seccion"] = PISO[0]; // } // } // if (PISO.Length >= 2) // { // if (PISO[1] != "0") // { // dt.Rows[0]["Manzana"] = PISO[1]; // } // } // if (PISO.Length >= 3) // { // if (PISO[2] != "0") // { // dt.Rows[0]["Grafico"] = PISO[2]; // } // } // if (PISO.Length >= 4) // { // if (PISO[3] != "0") // { // dt.Rows[0]["Subdivision"] = PISO[3]; // } // } //} }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { rfvTxtNombre.IsValid = false; rfvTxtApellido.IsValid = false; rfvMail.IsValid = false; rfvTelefono.IsValid = false; try { InmueblesBLL bllInmuebles = new InmueblesBLL(); IdInmueble = Request.QueryString["IdInmueble"]; //Session["IdInmueble"] = IdInmueble; getInmueblePorID(bllInmuebles); if (dt.Rows[0]["Publica"].ToString() == "No" || dt.Rows[0]["Estado"].ToString() == "2") { if (dt.Rows[0]["IdUsuario"].ToString() != Membership.GetUser().ProviderUserKey.ToString()) { Response.Redirect("MapaPublico3.html"); } } DateTime FechaActualiza = Convert.ToDateTime(dt.Rows[0]["FechaActualiza"].ToString()); TimeSpan diferencia = DateTime.Now - FechaActualiza; if (diferencia.Days >= 90) { DetailsView1.BackColor = System.Drawing.Color.FromKnownColor(KnownColor.Red); DetailsView1.ForeColor = System.Drawing.Color.FromKnownColor(KnownColor.Red); } if (dt.Rows.Count != 0) { Session["grd_ItemList2"] = dt; LlenarDetailsView(); DetailsView1.DataSource = dt; DetailsView1.DataBind(); bindData(); //if (dt.Rows[0]["IdUsuario"].ToString() == Membership.GetUser().ProviderUserKey.ToString()) //{ //} if (dt.Rows[0]["NombreProvincia"].ToString() == "Todas las Provincias") { GoogleMarker marker = new GoogleMarker(dt.Rows[0]["Calle"].ToString() + " " + dt.Rows[0]["Numero"].ToString() + "," + dt.Rows[0]["NombreLocalidad"].ToString()); GoogleMap1.Markers.Add(marker); Coordinate coordinate = Geocode.GetCoordinates(dt.Rows[0]["Calle"].ToString() + " " + dt.Rows[0]["Numero"].ToString() + "," + dt.Rows[0]["NombreLocalidad"].ToString()); decimal latitude = coordinate.Latitude; decimal longitude = coordinate.Longitude; GoogleMap1.Latitude = convert(latitude);//-32.9400639; GoogleMap1.Longitude = convert(longitude);//-60.6600255; marker.Text = dt.Rows[0]["Calle"].ToString() + " " + dt.Rows[0]["Numero"].ToString() + "," + dt.Rows[0]["NombreLocalidad"].ToString() + "," + dt.Rows[0]["NombreProvincia"].ToString(); string g = marker.ToJsonString(); } else { GoogleMarker marker = new GoogleMarker(dt.Rows[0]["Calle"].ToString() + " " + dt.Rows[0]["Numero"].ToString() + "," + dt.Rows[0]["NombreLocalidad"].ToString() + "," + dt.Rows[0]["NombreProvincia"].ToString()); GoogleMap1.Markers.Add(marker); Coordinate coordinate = Geocode.GetCoordinates(dt.Rows[0]["Calle"].ToString() + " " + dt.Rows[0]["Numero"].ToString() + "," + dt.Rows[0]["NombreLocalidad"].ToString() + "," + dt.Rows[0]["NombreProvincia"].ToString()); decimal latitude = coordinate.Latitude; decimal longitude = coordinate.Longitude; GoogleMap1.Latitude = convert(latitude);//-32.9400639; GoogleMap1.Longitude = convert(longitude);//-60.6600255; marker.Text = dt.Rows[0]["Calle"].ToString() + " " + dt.Rows[0]["Numero"].ToString() + "," + dt.Rows[0]["NombreLocalidad"].ToString() + "," + dt.Rows[0]["NombreProvincia"].ToString(); string g = marker.ToJsonString(); } } else if (dt.Rows.Count == 0) { } HiddenFielddireccion.Value = dt.Rows[0]["Calle"].ToString() + " " + dt.Rows[0]["Numero"].ToString(); HiddenFieldzona.Value = dt.Rows[0]["Zona"].ToString(); HiddenFieldtipoinmueble.Value = dt.Rows[0]["TipoDeInmueble"].ToString(); //HiddenFieldestadoinmueble.Value = dt.Rows[0]["Estado"].ToString(); HiddenFieldprovincia.Value = dt.Rows[0]["NombreProvincia"].ToString(); HiddenFieldlocalidad.Value = dt.Rows[0]["NombreLocalidad"].ToString(); HiddenFieldpiso.Value = dt.Rows[0]["Piso"].ToString(); //HiddenFieldSeccion.Value = dt.Rows[0]["Seccion"].ToString(); //HiddenFieldManzana.Value = dt.Rows[0]["Manzana"].ToString(); //HiddenFieldGrafico.Value = dt.Rows[0]["Grafico"].ToString(); //HiddenFieldSubdivision.Value = dt.Rows[0]["Subdivision"].ToString(); HiddenFielddepartamento.Value = dt.Rows[0]["Departamento"].ToString(); HiddenFieldentrecalle.Value = dt.Rows[0]["Calle1"].ToString(); HiddenFieldycalle.Value = dt.Rows[0]["Calle2"].ToString(); HiddenFieldmetroscuadcubiertos.Value = dt.Rows[0]["MetroCuadrados"].ToString(); HiddenFieldmetroscuadsemicubiertos.Value = dt.Rows[0]["MetrosCuadradosSemiCub"].ToString(); HiddenFieldcochera.Value = dt.Rows[0]["Fondo"].ToString(); HiddenFieldposicion.Value = dt.Rows[0]["Posicion"].ToString(); HiddenFieldcochera.Value = dt.Rows[0]["Cocheras"].ToString(); HiddenFieldFechaFinDeObra.Value = dt.Rows[0]["fechafinobra"].ToString(); HiddenFieldAntiguedad.Value = dt.Rows[0]["Antiguedad"].ToString(); HiddenFieldAntiguedadA.Value = dt.Rows[0]["AntiguedadA"].ToString(); HiddenFieldOperacion.Value = dt.Rows[0]["Operacion"].ToString(); //HiddenFieldPrecioVenta.Value = dt.Rows[0]["PrecioVenta"].ToString(); //HiddenFieldPrecioVenta2.Value = dt.Rows[0]["PrecioVenta2"].ToString(); //HiddenFieldPrecioAlquiler.Value = dt.Rows[0]["PrecioAlquiler"].ToString(); //HiddenFieldComision.Value = dt.Rows[0]["Comision"].ToString(); //HiddenFieldFechaAlta.Value = dt.Rows[0]["FechaAlta"].ToString(); //HiddenFieldFechaActualiza.Value = dt.Rows[0]["FechaActualiza"].ToString(); HiddenFieldMailUsuario.Value = dt.Rows[0]["MailUsuario"].ToString(); HiddenFieldMailAlternativoUsuario.Value = dt.Rows[0]["EmailAlternativo"].ToString(); HiddenFieldObservaciones.Value = dt.Rows[0]["Observaciones"].ToString(); //HiddenFieldObservaciones.Value = dt.Rows[0]["ObservacionesPrivadas"].ToString(); HiddenFieldimagen.Value = this.Page.ResolveClientUrl(IdInmueble + "-" + "01" + "_thumb.jpg"); HiddenFieldgooglemapsimage.Value = "http://maps.googleapis.com/maps/api/staticmap?markers=" + GoogleMap1.Latitude.ToString().Replace(",", ".") + "," + GoogleMap1.Longitude.ToString().Replace(",", ".") + "&zoom=15&size=260x194&sensor=false"; } catch (Exception error) { if (!error.Message.Contains("403")) { Response.Redirect("MapaPublico3.html"); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { IdInmueble = Request.QueryString["IdInmueble"]; this.bllInmuebles = new InmueblesBLL(); try { objInmueble = bllInmuebles.SeleccionaInmueblePorID(Membership.GetUser().ProviderUserKey.ToString(), IdInmueble); } catch { Response.Redirect("MisPropiedades.aspx"); } } }
protected void Button1_Click(object sender, EventArgs e) { //System.Threading.Thread.Sleep(5000); //CalcularSesion(); try { DataGrid1.Visible = false; InmueblesBLL bllInmuebles = new InmueblesBLL(); ArrayList arlInmobiliarias = new ArrayList(); Inmueble objInmueble = new Inmueble(); objInmueble.IDUsuario = Membership.GetUser().ProviderUserKey.ToString(); objInmueble.IDTipoDeInmueble = int.Parse(ddlTipoDeInmueble.SelectedValue.ToString()); objInmueble.IDOperacion = int.Parse(ddlOperacion.SelectedValue.ToString()); objInmueble.IDLocalidad = int.Parse(ddlLocalidades.SelectedValue.ToString()); if (!chkGranRosario.Checked) { objInmueble.GranRosario = false; objInmueble.IDProvincia = int.Parse(ddlProvincias.SelectedValue.ToString()); objInmueble.IDPais = int.Parse(ddlPaises.SelectedValue.ToString()); objInmueble.Calle = txtCalle.Text; objInmueble.IDZona = int.Parse(ddlZonas.SelectedValue.ToString()); objInmueble.IDZona2 = int.Parse(ddlZonas2.SelectedValue.ToString()); } else { objInmueble.GranRosario = true; } int x = CHBLPalabrasCLaves.Items.Count; for (int i = 0; i < x; i++) { if (CHBLPalabrasCLaves.Items[i].Selected) { objInmueble.IdNumPalabrasClaves += CHBLPalabrasCLaves.Items[i].Value + ","; } } objInmueble.TodasLasPlabarasClaves = chkTodasLasPalabrasClaves.Checked; if (objInmueble.IdNumPalabrasClaves != null) { objInmueble.IdNumPalabrasClaves = objInmueble.IdNumPalabrasClaves.Substring(0, objInmueble.IdNumPalabrasClaves.Length - 1); } objInmueble.Numero = txtNumero.Text; objInmueble.Piso = txtPiso.Text; objInmueble.Departamento = txtDepartamento.Text; if (chkSoloMiInmobiliaria.Checked == false && chkTodasLasInmobiliarias.Checked == false) { foreach (ListItem itm in chkInmobiliarias.Items) { if (itm.Selected) { arlInmobiliarias.Add(itm.Value); } } } objInmueble.MonedaPrecioDesdeHasta = ddlMoneda.SelectedValue.ToString(); if (txtPrecioDesde.Text != "") { objInmueble.PrecioDesde = double.Parse(txtPrecioDesde.Text); } if (txtPrecioHasta.Text != "") { objInmueble.PrecioHasta = double.Parse(txtPrecioHasta.Text); } if (ddlAntiguedad.SelectedValue != "No Selected") { objInmueble.Antiguedad = ddlAntiguedad.SelectedValue; } if (ddlCochera.SelectedValue != "No Selected") { objInmueble.Cocheras = ddlCochera.SelectedValue; } if (chkSoloMiInmobiliaria.Checked == true) { dt = bllInmuebles.SeleccionaInmueblesBusquedaSoloMiInmo(objInmueble, arlInmobiliarias, ddlOrdenBusqueda.SelectedValue.ToString()); } else { dt = bllInmuebles.SeleccionaInmueblesBusqueda(objInmueble, arlInmobiliarias, ddlOrdenBusqueda.SelectedValue.ToString()); } if (dt.Rows.Count != 0) { DataGrid1.DataSource = null; DataGrid1.DataSource = dt; DataGrid1.CurrentPageIndex = 0; DataGrid1.DataBind(); Session["grd_ItemList"] = dt; DataGrid1.Visible = true; CollapsiblePanelExtenderBusqueda.Collapsed = true; CollapsiblePanelExtenderBusqueda.ClientState = "true"; } else if (dt.Rows.Count == 0) { } } catch { } }
protected void Page_Load(object sender, EventArgs e) { try { InmueblesBLL bllInmuebles = new InmueblesBLL(); //12-12-12 //IdInmueble = Session["IdInmueble"].ToString(); IdInmueble = Request.QueryString["IdInmueble"]; dt = bllInmuebles.SeleccionaInmueblesPorID(Convert.ToInt32(IdInmueble)); if (dt.Rows.Count != 0) { Session["grd_ItemList2"] = dt; LlenarDetailsView(); DetailsView1.DataSource = dt; DetailsView1.DataBind(); DetailsView2.DataSource = dt; DetailsView2.DataBind(); GoogleMarker marker = new GoogleMarker(dt.Rows[0]["Calle"].ToString() + " " + dt.Rows[0]["Numero"].ToString() + "," + dt.Rows[0]["NombreLocalidad"].ToString() + "," + dt.Rows[0]["NombreProvincia"].ToString()); GoogleMap1.Markers.Add(marker); Coordinate coordinate = Geocode.GetCoordinates(dt.Rows[0]["Calle"].ToString() + " " + dt.Rows[0]["Numero"].ToString() + "," + dt.Rows[0]["NombreLocalidad"].ToString() + "," + dt.Rows[0]["NombreProvincia"].ToString()); decimal latitude = coordinate.Latitude; decimal longitude = coordinate.Longitude; if (latitude != 0 && longitude != 0) { GoogleMap1.Latitude = convert(latitude);//-32.9400639; GoogleMap1.Longitude = convert(longitude);//-60.6600255; } marker.Text = dt.Rows[0]["Calle"].ToString() + " " + dt.Rows[0]["Numero"].ToString() + "," + dt.Rows[0]["NombreLocalidad"].ToString() + "," + dt.Rows[0]["NombreProvincia"].ToString(); string g = marker.ToJsonString(); string strRutaFoto = Server.MapPath("~\\Image_Upload\\" + IdInmueble + "-" + "01" + "_thumb.jpg"); Boolean strFoto = (System.IO.File.Exists(strRutaFoto)); if (strFoto) { Image1.Visible = true; Image1.ImageUrl = this.Page.ResolveClientUrl("~\\Image_Upload\\" + IdInmueble + "-" + "01" + "_thumb.jpg"); } else { Image1.Visible = false; } //Googleimagen.ImageUrl = this.Page.ResolveUrl("http://maps.google.com/staticmap?zoom=15&size=320x342&markers=" + longitude + "," + latitude + "&key=ABQIAAAApU_iFCnQtFqCJz_RVHKf6hSIMON3V3yf7e-rtPXBV5YPjpYuCRQqSKQQMFkEFT-8V8ujIAr2-XcoIQ"); Googleimagen.ImageUrl = "http://maps.google.com/staticmap?zoom=15&size=259x250&markers=" + GoogleMap1.Latitude.ToString().Replace(",", ".") + "," + GoogleMap1.Longitude.ToString().Replace(",", ".") + "&key=ABQIAAAApU_iFCnQtFqCJz_RVHKf6hSIMON3V3yf7e-rtPXBV5YPjpYuCRQqSKQQMFkEFT-8V8ujIAr2-XcoIQ"; } else if (dt.Rows.Count == 0) { } HiddenFielddireccion.Value = dt.Rows[0]["Calle"].ToString() + " " + dt.Rows[0]["Numero"].ToString(); HiddenFieldzona.Value = dt.Rows[0]["Zona"].ToString(); HiddenFieldtipoinmueble.Value = dt.Rows[0]["TipoDeInmueble"].ToString(); HiddenFieldestadoinmueble.Value = dt.Rows[0]["Estado"].ToString(); HiddenFieldprovincia.Value = dt.Rows[0]["NombreProvincia"].ToString(); HiddenFieldlocalidad.Value = dt.Rows[0]["NombreLocalidad"].ToString(); HiddenFieldpiso.Value = dt.Rows[0]["Piso"].ToString(); HiddenFielddepartamento.Value = dt.Rows[0]["Departamento"].ToString(); HiddenFieldentrecalle.Value = dt.Rows[0]["Calle1"].ToString(); HiddenFieldycalle.Value = dt.Rows[0]["Calle2"].ToString(); HiddenFieldmetroscuadcubiertos.Value = dt.Rows[0]["MetroCuadrados"].ToString(); HiddenFieldmetroscuadsemicubiertos.Value = dt.Rows[0]["MetrosCuadradosSemiCub"].ToString(); HiddenFieldposicion.Value = dt.Rows[0]["Frente"].ToString(); HiddenFieldcochera.Value = dt.Rows[0]["Fondo"].ToString(); HiddenFieldposicion.Value = dt.Rows[0]["Posicion"].ToString(); HiddenFieldcochera.Value = dt.Rows[0]["Cocheras"].ToString(); HiddenFieldAntiguedad.Value = dt.Rows[0]["Antiguedad"].ToString(); HiddenFieldAntiguedadA.Value = dt.Rows[0]["AntiguedadA"].ToString(); HiddenFieldOperacion.Value = dt.Rows[0]["Operacion"].ToString(); HiddenFieldPrecioVenta.Value = dt.Rows[0]["PrecioVenta"].ToString() ; HiddenFieldPrecioVentaLabel.Value = precioVentaMoneda.ToString(); HiddenFieldPrecioVenta2.Value = dt.Rows[0]["PrecioVenta2"].ToString(); HiddenFieldPrecioVenta2Label.Value = precioVenta2Moneda.ToString(); HiddenFieldNombreInmobiliaria.Value = dt.Rows[0]["NombreInmobiliaria"].ToString(); HiddenFieldComision.Value = dt.Rows[0]["Comision"].ToString(); HiddenFieldFechaAlta.Value = dt.Rows[0]["FechaAlta"].ToString(); HiddenFieldFechaActualiza.Value = dt.Rows[0]["FechaActualiza"].ToString(); HiddenFieldMailUsuario.Value = dt.Rows[0]["MailUsuario"].ToString(); HiddenFieldObservaciones.Value = dt.Rows[0]["Observaciones"].ToString(); HiddenFieldimagen.Value = this.Page.ResolveClientUrl(IdInmueble + "-" + "01" + "_thumb.jpg"); HiddenFieldgooglemapsimage.Value = "http://maps.googleapis.com/maps/api/staticmap?markers=" + GoogleMap1.Latitude.ToString().Replace(",", ".") + "," + GoogleMap1.Longitude.ToString().Replace(",", ".") + "&zoom=15&size=260x194&sensor=false"; } catch { } }
protected void btnOferta_Click(object sender, EventArgs e) { if (gvInmuebles.SelectedIndex != -1) { InmueblesBLL bllInmuebles = new InmueblesBLL(); bllInmuebles.SetOferta(Membership.GetUser().ProviderUserKey.ToString(), gvInmuebles.SelectedValue.ToString()); } }