void CboDepartamentoSubRegion_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) { if (CboDepartamentoSubRegion.SelectedIndex > 0) { ClUtilitarios.LlenaCombo(ClCatalogos.ListadoMunicipios(Convert.ToInt32(CboDepartamentoSubRegion.SelectedValue)), CboMunicipioSubRegion, "MUnicipioId", "Municipio"); ClUtilitarios.AgregarSeleccioneCombo(CboMunicipioSubRegion, "Municipio"); } }
void GrdInmuebles_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { if (e.CommandName == "CmdPreview") { DataSet DsArchivo = new DataSet(); DsArchivo = ClInmueble.Archivo_Inmueble(Convert.ToInt32(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["InmuebleId"])); byte[] bytes; string fileName, contentType; bytes = (byte[])DsArchivo.Tables["DATOS"].Rows[0]["Archivo_Propiedad"]; contentType = DsArchivo.Tables["DATOS"].Rows[0]["ContenyType"].ToString(); fileName = DsArchivo.Tables["DATOS"].Rows[0]["Nombre_Archivo"].ToString(); Response.Clear(); Response.Buffer = true; Response.Charset = ""; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = contentType; Response.AddHeader("content-disposition", "attachment; filename=" + fileName); Response.AddHeader("content-length", (bytes.Length - 1).ToString()); Response.BinaryWrite(bytes.ToArray()); Response.Flush(); Response.End(); } else if (e.CommandName == "CmdEdit") { DataSet ds = new DataSet(); TxtInmuebleId.Text = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["InmuebleId"].ToString(); ds = ClInmueble.Inmueble_Get(Convert.ToInt32(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["InmuebleId"])); if (ds.Tables["DATOS"].Rows[0]["PersonaJuridicaId"].ToString() == "") { ChkOtraJur.Checked = false; DivJuridico.Visible = false; } else { ChkOtraJur.Checked = true; DivJuridico.Visible = true; CboJuridico.SelectedValue = ds.Tables["DATOS"].Rows[0]["PersonaJuridicaId"].ToString(); CboJuridico.SelectedItem.Text = ds.Tables["DATOS"].Rows[0]["jur"].ToString(); } TxtDirccion.Text = ds.Tables["DATOS"].Rows[0]["Direccion"].ToString(); TxtAldea.Text = ds.Tables["DATOS"].Rows[0]["Aldea"].ToString(); TxtFinca.Text = ds.Tables["DATOS"].Rows[0]["Finca"].ToString(); CboDepartamento.SelectedValue = ds.Tables["DATOS"].Rows[0]["DepartamentoId"].ToString(); CboDepartamento.SelectedItem.Text = ds.Tables["DATOS"].Rows[0]["Departamento"].ToString(); ClUtilitarios.LlenaCombo(ClCatalogos.ListadoMunicipios(Convert.ToInt32(CboDepartamento.SelectedValue)), CboMunicipio, "MunicipioId", "Municipio"); CboMunicipio.SelectedValue = ds.Tables["DATOS"].Rows[0]["MunicipioId"].ToString(); CboMunicipio.SelectedItem.Text = ds.Tables["DATOS"].Rows[0]["Municipio"].ToString(); CboTipoDocumento.SelectedValue = ds.Tables["DATOS"].Rows[0]["TipoDoc_PropiedadId"].ToString(); CboTipoDocumento.SelectedItem.Text = ds.Tables["DATOS"].Rows[0]["TipoDocPropiedad"].ToString(); TxtFecEmi.SelectedDate = Convert.ToDateTime(ds.Tables["DATOS"].Rows[0]["Fec_Emision"].ToString()); if (CboTipoDocumento.SelectedValue == "1") { DivPropiedad.Visible = true; DivMun.Visible = false; DiVPos.Visible = false; TxtNoFinca.Text = ds.Tables["DATOS"].Rows[0]["NoFinca"].ToString(); TxtFolio.Text = ds.Tables["DATOS"].Rows[0]["Folio"].ToString(); TxtLibro.Text = ds.Tables["DATOS"].Rows[0]["Libro"].ToString(); TxtDe.Text = ds.Tables["DATOS"].Rows[0]["De"].ToString(); } else if (CboTipoDocumento.SelectedValue == "2") { DivPropiedad.Visible = false; DivMun.Visible = true; DiVPos.Visible = false; TxtNoCerti.Text = ds.Tables["DATOS"].Rows[0]["NoCertificacion"].ToString(); } else if (CboTipoDocumento.SelectedValue == "3") { DivPropiedad.Visible = false; DivMun.Visible = false; DiVPos.Visible = true; TxtNoEscritura.Text = ds.Tables["DATOS"].Rows[0]["NoEscritura"].ToString(); CboTitulo.SelectedValue = ds.Tables["DATOS"].Rows[0]["TituloNotarioId"].ToString(); CboTitulo.SelectedItem.Text = ds.Tables["DATOS"].Rows[0]["TituloNotario"].ToString(); } if (ds.Tables["DATOS"].Rows[0]["En_Area"].ToString() == "1") { OptAreasPro.SelectedValue = "1"; DivArea.Visible = true; CboArea.SelectedValue = ds.Tables["DATOS"].Rows[0]["AreaProtegidaId"].ToString(); CboArea.SelectedItem.Text = ds.Tables["DATOS"].Rows[0]["AreaPro"].ToString(); } else { OptAreasPro.SelectedValue = "0"; DivArea.Visible = false; } TxtArea.Text = ds.Tables["DATOS"].Rows[0]["Area"].ToString(); if (ds.Tables["DATOS"].Rows[0]["EsRepresentante"].ToString() == "1") { ChkRepreseanteyPropietario.Checked = true; ChkRepresentanteVariasPer.Checked = false; } if (ds.Tables["DATOS"].Rows[0]["EsRepresentanteVarios"].ToString() == "1") { ChkRepresentanteVariasPer.Checked = true; ChkRepreseanteyPropietario.Checked = false; } DivGrigPropietarios.Visible = true; GrdPropietarios.Rebind(); BtnGrabar.Visible = false; GrdPropietarios.Columns[5].Visible = false; } else if (e.CommandName == "CmdDel") { ClUsuario.Insertar_Actividad_Pagina(16, Convert.ToInt32(Session["UsuarioId"]), ClUsuario.CorrId_ActividadPagina(), 3); ClInmueble.Elimina_Inmueble(Convert.ToInt32(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["InmuebleId"])); GrdInmuebles.Rebind(); Limpiar(); BtnGoodInmueble.Visible = true; LblGoodInmueble.Text = "Inmueble eliminado"; } }
void CboDepartamento_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e) { ClUtilitarios.LlenaCombo(ClCatalogos.ListadoMunicipios(Convert.ToInt32(CboDepartamento.SelectedValue)), CboMunicipio, "MunicipioId", "Municipio"); ClUtilitarios.AgregarSeleccioneCombo(CboMunicipio, "Municipio"); }
protected void Page_Load(object sender, EventArgs e) { ClUsuario = new Cl_Usuario(); ClUtilitarios = new Cl_Utilitarios(); ClInmueble = new Cl_Inmueble(); ClPersonaJuridica = new Cl_Persona_Juridica(); ClPersona = new Cl_Persona(); ClCatalogos = new Cl_Catalogos(); ChkOtraJur.CheckedChanged += ChkOtraJur_CheckedChanged; CboTipoDocumento.TextChanged += CboTipoDocumento_TextChanged; OptAreasPro.SelectedIndexChanged += OptAreasPro_SelectedIndexChanged; GrdInmuebles.NeedDataSource += GrdInmuebles_NeedDataSource; BtnGrabar.Click += BtnGrabar_Click; CboDepartamento.TextChanged += CboDepartamento_TextChanged; BtnNuevo.ServerClick += BtnNuevo_ServerClick; GrdInmuebles.ItemCommand += GrdInmuebles_ItemCommand; GrdInmuebles.ItemDataBound += GrdInmuebles_ItemDataBound; ChkIngNomFinca.CheckedChanged += ChkIngNomFinca_CheckedChanged; ChkRepreseanteyPropietario.CheckedChanged += ChkRepreseanteyPropietario_CheckedChanged; ChkRepresentanteVariasPer.CheckedChanged += ChkRepresentanteVariasPer_CheckedChanged; BtnValidaPropietario.ServerClick += BtnValidaPropietario_ServerClick; GrdPropietarios.NeedDataSource += GrdPropietarios_NeedDataSource; BtnAddPropietario.ServerClick += BtnAddPropietario_ServerClick; GrdPropietarios.PageIndexChanged += GrdPropietarios_PageIndexChanged; GrdPropietarios.ItemCommand += GrdPropietarios_ItemCommand; DataTable DtPropietarios = DsPropietarios.Tables.Add("Propietarios"); DataColumn Existe = DtPropietarios.Columns.Add("Existe", typeof(Boolean)); DataColumn PersonaId = DtPropietarios.Columns.Add("PersonaId", typeof(Int64)); DataColumn Dpi = DtPropietarios.Columns.Add("Dpi", typeof(string)); DataColumn Nombres = DtPropietarios.Columns.Add("Nombres", typeof(string)); DataColumn Apellidos = DtPropietarios.Columns.Add("Apellidos", typeof(string)); if (Session["UsuarioId"] == null) { Response.Redirect("~/Wfrm_Login.aspx"); } else if (!IsPostBack) { ClUsuario.Insertar_Ingreso_Pagina(16, Convert.ToInt32(Session["UsuarioId"]), ClUsuario.CorrId_IngresoPagina()); ClUtilitarios.Permisos(Master, Convert.ToInt32(Session["UsuarioId"])); System.Web.UI.WebControls.Label LblPerfil; LblPerfil = (System.Web.UI.WebControls.Label)Master.FindControl("LblTipoUsuario"); LblPerfil.Text = ClUsuario.Get_Tipo_Usuario(Convert.ToInt32(Session["UsuarioId"])); System.Web.UI.WebControls.Label LblUsuario; LblUsuario = (System.Web.UI.WebControls.Label)Master.FindControl("lblUsuario"); LblUsuario.Text = ClPersona.Nombre_Usuario(Convert.ToInt32(Session["PersonaId"])); DataSet dsPermisos = ClUsuario.Get_Roles(Convert.ToInt32(Session["UsuarioId"]), 16); if (Convert.ToInt32(dsPermisos.Tables["Datos"].Rows[0]["Editar"]) == 0) { GrdInmuebles.Columns[6].Visible = false; BtnGrabar.Visible = false; } if (Convert.ToInt32(dsPermisos.Tables["Datos"].Rows[0]["Insertar"]) == 0) { BtnGrabar.Visible = false; BtnNuevo.Visible = false; } if (Convert.ToInt32(dsPermisos.Tables["Datos"].Rows[0]["Eliminar"]) == 0) { GrdInmuebles.Columns[7].Visible = false; } dsPermisos.Clear(); System.Web.UI.HtmlControls.HtmlImage ImgPerfilFake; System.Web.UI.WebControls.Image ImgPerfil; ImgPerfilFake = (System.Web.UI.HtmlControls.HtmlImage)Master.FindControl("ImgPerfilFake"); ImgPerfil = (System.Web.UI.WebControls.Image)Master.FindControl("ImgPerfil"); if (ClPersona.Existe_FotoPerfil(Convert.ToInt32(Session["PersonaId"])) == true) { ImgPerfilFake.Visible = false; ImgPerfil.Visible = true; } else { ImgPerfilFake.Visible = true; ImgPerfil.Visible = false; if (ClPersona.Genero_Usuario(Convert.ToInt32(Session["PersonaId"])) == 1) { ImgPerfilFake.Src = "../imagenes/male.png"; } else { ImgPerfilFake.Src = "../imagenes/female.png"; } } ClUtilitarios.LlenaCombo(ClCatalogos.ListadoDepartamentos(), CboDepartamento, "DepartamentoId", "Departamento"); ClUtilitarios.LlenaCombo(ClCatalogos.ListadoMunicipios(1), CboMunicipio, "MunicipioId", "Municipio"); ClUtilitarios.LlenaCombo(ClCatalogos.TipoDoc_Propiedad_GetAll(), CboTipoDocumento, "TipoDoc_PropiedadId", "TipoDocPropiedad"); ClUtilitarios.LlenaCombo(ClCatalogos.Titulo_GetAll(), CboTitulo, "TituloNotarioId", "TituloNotario"); ClUtilitarios.LlenaCombo(ClCatalogos.Area_Protegida_GetAll(), CboArea, "AreaProtegidaId", "Nombre"); ClUtilitarios.LlenaCombo(ClPersonaJuridica.Persona_Juridica_Get(Convert.ToInt32(Session["UsuarioId"])), CboJuridico, "PersonaJuridicaId", "NOMBRE"); CboTipoDocumento.Items.Insert(0, ""); TxtFecEmi.SelectedDate = DateTime.Today; if (ClPersonaJuridica.Existe_Juridco(Convert.ToInt32(Session["UsuarioId"])) == true) { ChkOtraJur.Visible = true; } TxtNombre.Text = ClPersona.Nombre_Usuario(Convert.ToInt32(Session["PersonaId"])); } }