protected void gvFamiliar_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandArgument != null) { switch (e.CommandName.ToLower()) { case "delete": new Persona().DeleteFamiliares(int.Parse(e.CommandArgument.ToString())); this.FillGridFamiliar(); ClientScript.RegisterStartupScript(this.GetType(), "myScript", "alert('Registro borrado exitosamente.');", true); break; case "edit": Familiares oFamiliar = new Persona().GetFamiliar(int.Parse(e.CommandArgument.ToString())); this.lblFamiliarId.Text = oFamiliar.FamiliarId.ToString(); this.ddlParentesco.SelectedValue = oFamiliar.ParentescoId.ToString(); this.btnAddFamiliar.Text = "Actualizar"; this.btnCancelarFamiliar.Visible = true; break; default: break; } } }
protected void gvPersonaCuenta_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandArgument != null) { switch (e.CommandName.ToLower()) { case "delete": new Persona().DeleteCuenta(int.Parse(e.CommandArgument.ToString())); this.FillGridCuenta(); ClientScript.RegisterStartupScript(this.GetType(), "myScript", "alert('Registro borrado exitosamente.');", true); break; case "edit": this.txtFechaAltaCuenta.Text = this.txtFechaBajaCuenta.Text = ""; PersonasCuentas oPerCuenta = new Persona().GetPersonaCuenta(int.Parse(e.CommandArgument.ToString())); this.lblPersonaCuentaId.Text = oPerCuenta.PersonaCuentaId.ToString(); this.ddlBanco.SelectedValue = oPerCuenta.BancoId.ToString(); this.txtCuenta.Text = oPerCuenta.Cuenta.ToString(); this.txtCBU.Text = oPerCuenta.CBU.ToString(); this.ddlTipoCuenta.SelectedValue = oPerCuenta.Tipo.ToString(); this.txtFechaAltaCuenta.Text = oPerCuenta.FechaAlta.Date.ToShortDateString(); if (oPerCuenta.FechaBaja.HasValue) this.txtFechaBajaCuenta.Text = oPerCuenta.FechaBaja.Value.Date.ToShortDateString(); this.btnAddCuenta.Text = "Actualizar"; this.btnCancelarCuenta.Visible = true; break; default: break; } } }
protected void FillCombos() { List<MotivosBaja> listaMotivos = new Socio().GetListMotivosBaja(); ddlMotivoBaja.DataValueField = "MotivoBajaId"; ddlMotivoBaja.DataTextField = "Descripcion"; ddlMotivoBaja.DataSource = listaMotivos.ToList(); ddlMotivoBaja.DataBind(); ddlMotivoBaja.Items.Insert(0, new ListItem("- Seleccione -", "0")); List<Bancos> listaBancos = new Auxiliar().GetBancos(); ddlBanco.DataValueField = "BancoId"; ddlBanco.DataTextField = "Descripcion"; ddlBanco.DataSource = listaBancos.ToList(); ddlBanco.DataBind(); ddlBanco.Items.Insert(0, new ListItem("- Seleccione -", "0")); List<Pais> listaPaises = new Auxiliar().GetListPais(); ddlNacionalidad.DataValueField = "PaisId"; ddlNacionalidad.DataTextField = "Descripcion"; ddlNacionalidad.DataSource = listaPaises.ToList(); ddlNacionalidad.DataBind(); ddlNacionalidad.Items.Insert(0, new ListItem("- Seleccione -", "0")); ddlPais.DataValueField = "PaisId"; ddlPais.DataTextField = "Descripcion"; ddlPais.DataSource = listaPaises; ddlPais.DataBind(); ddlPais.Items.Insert(0, new ListItem("- Seleccione -", "0")); List<SociosCategorias> listaSocioCategoria = new Socio().GetListSocioCategoria(); ddlSocioCategoria.DataValueField = "SocioCategoriaId"; ddlSocioCategoria.DataTextField = "Descripcion"; ddlSocioCategoria.DataSource = listaSocioCategoria; ddlSocioCategoria.DataBind(); ddlSocioCategoria.Items.Insert(0, new ListItem("- Seleccione -", "0")); List<EstadosTablas> listaEstados = new Auxiliar().GetEstados("Personas"); var var = listaEstados.Select(g => new { Id = g.EstadoId, Desc = g.Estados.Descripcion }).ToList(); ddlEstado.DataValueField = "Id"; ddlEstado.DataTextField = "Desc"; ddlEstado.DataSource = var; ddlEstado.DataBind(); ddlEstado.Items.Insert(0, new ListItem("- Seleccione -", "0")); List<Organismos> listaOrganismos = new Organismo().GetOrganismos(); ddlOrganismo.DataValueField = "OrganismoId"; ddlOrganismo.DataTextField = "Descripcion"; ddlOrganismo.DataSource = listaOrganismos.ToList(); ddlOrganismo.DataBind(); ddlOrganismo.Items.Insert(0, new ListItem("- Seleccione -", "0")); this.ddlSubOrga.Items.Insert(0, new ListItem("- Seleccione -", "0")); this.ddlSubOrga.Enabled = false; List<Parentescos> listaParentescos = new Persona().GetParentescos(); this.ddlParentesco.DataValueField = "ParentescoId"; this.ddlParentesco.DataTextField = "Descripcion_Parentesco"; this.ddlParentesco.DataSource = listaParentescos.ToList(); this.ddlParentesco.DataBind(); this.ddlParentesco.Items.Insert(0, new ListItem("- Seleccione -", "0")); List<Roles> listaRol = new AEPDataAccess.Methods.Administracion().GetListRol(); this.ddlRol.DataValueField = "RolId"; this.ddlRol.DataTextField = "Descripcion"; this.ddlRol.DataSource = listaRol.ToList(); this.ddlRol.DataBind(); this.ddlRol.Items.Insert(0, new ListItem("- Seleccione -", "0")); }
protected void FillData() { this.tabFamiliares.Enabled = this.tabOrganismo.Enabled = this.tabSocio.Enabled = this.tabCuentas.Enabled = this.tabSocioCuotas.Enabled = this.tabUser.Enabled = true; Persona personaMetodo = new Persona(); Personas oPersona = personaMetodo.GetPersona(Convert.ToInt32(Request.QueryString["PersonaId"])); this.txtNombre.Text = oPersona.ApellidoNombre; this.txtDomicilio.Text = oPersona.Domicilio; this.txtTelefono.Text = oPersona.Telefono; this.txtEmail.Text = oPersona.Email; if (oPersona.FechaFallecimiento.HasValue) this.txtFechaFalle.Text = oPersona.FechaFallecimiento.Value.Date.ToShortDateString(); if (oPersona.FechaNacimiento.HasValue) this.txtFechaNac.Text = oPersona.FechaNacimiento.Value.Date.ToShortDateString(); this.ddlEstado.SelectedValue = oPersona.EstadoId.ToString(); this.ddlNacionalidad.SelectedValue = oPersona.NacionalidadId.ToString(); if (oPersona.Sexo == true) this.ddlSexo.SelectedValue = "1"; else this.ddlSexo.SelectedValue = "0"; this.txtNroDoc.Text = oPersona.NroDoc.ToString(); if (oPersona.Localidad != null) { this.ddlPais.SelectedValue = oPersona.Localidad.Provincia.PaisId.ToString(); this.FillProvincia(); this.ddlProvincia.SelectedValue = oPersona.Localidad.ProvinciaId.ToString(); this.FillLocalidad(); this.ddlLocalidadResi.SelectedValue = oPersona.LocaResidenciaId.ToString(); } if (oPersona.Importado == true) ClientScript.RegisterStartupScript(this.GetType(), "myScript", "alert('El registro actual fue traido de la importacion del sistema anterior.');", true); }
protected void btnAddFamiliar_Click(object sender, EventArgs e) { try { Familiares oFamiliar = null; if (!string.IsNullOrEmpty(this.lblFamiliarId.Text)) { oFamiliar = new Persona().GetFamiliar(int.Parse(this.lblFamiliarId.Text)); oFamiliar.ParentescoId = Convert.ToInt32(this.ddlParentesco.SelectedValue); oFamiliar.ParientePersonaId = Convert.ToInt32(this.ucPariente.Value); new Persona().UpdateFamiliar(oFamiliar); } else { oFamiliar = new Familiares(); oFamiliar.ParentescoId = Convert.ToInt32(this.ddlParentesco.SelectedValue); oFamiliar.ParientePersonaId = Convert.ToInt32(this.ucPariente.Value); oFamiliar.TitularPersonaId = int.Parse(Request.QueryString["PersonaId"]); new Persona().AddFamiliar(oFamiliar); } this.FillGridFamiliar(); } catch (Exception ex) { this.lblErrorFamiliar.Text = ex.Message; } }
protected void btnGuardar_Click(object sender, EventArgs e) { AEPDataAccess.Personas oPersona = null; if (Request.QueryString["PersonaId"] != null) { Persona personaMetodo = new Persona(); oPersona = personaMetodo.GetPersona(Convert.ToInt32(Request.QueryString["PersonaId"])); } else oPersona = new AEPDataAccess.Personas(); oPersona.ApellidoNombre = this.txtNombre.Text.ToUpper(); oPersona.Domicilio = this.txtDomicilio.Text.ToUpper(); oPersona.Telefono = this.txtTelefono.Text; oPersona.Email = this.txtEmail.Text; if (!string.IsNullOrEmpty(this.txtFechaFalle.Text)) oPersona.FechaFallecimiento = Convert.ToDateTime(this.txtFechaFalle.Text); else oPersona.FechaFallecimiento = null; if (!string.IsNullOrEmpty(this.txtFechaNac.Text)) oPersona.FechaNacimiento = Convert.ToDateTime(this.txtFechaNac.Text); else oPersona.FechaNacimiento = null; if (!string.IsNullOrEmpty(this.ddlEstado.SelectedValue)) oPersona.EstadoId = Convert.ToInt32(this.ddlEstado.SelectedValue); oPersona.NacionalidadId = Convert.ToInt32(this.ddlNacionalidad.SelectedValue); if (this.ddlSexo.SelectedValue == "1") oPersona.Sexo = true; else oPersona.Sexo = false; oPersona.NroDoc = Convert.ToInt32(this.txtNroDoc.Text); if (!string.IsNullOrEmpty(this.ddlLocalidadResi.SelectedValue)) oPersona.LocaResidenciaId = Convert.ToInt32(this.ddlLocalidadResi.SelectedValue); Estados oEstado = new Estados(); if (Request.QueryString["PersonaId"] != null) new Persona().UpdatePersona(oPersona, oEstado); else { int numero = new Persona().SavePersona(oPersona, oEstado); Response.Redirect("PersonasABM.aspx?PersonaId=" + numero); } }
private void FillGridFamiliar() { List<Familiares> listaFamiliar = new Persona().GetListFamiliar(int.Parse(Request.QueryString["PersonaId"])); //Paginamos la grilla. if (this.gvFamiliar.PageSize < listaFamiliar.Count) { this.gvFamiliar.AllowPaging = true; //--- Me fijo que pagina tengo que mostrar if (listaFamiliar.Count <= this.gvFamiliar.PageIndex * this.gvFamiliar.PageSize) this.gvFamiliar.PageIndex = 0; } else this.gvFamiliar.AllowPaging = false; //Carga los datos en la grilla. this.gvFamiliar.DataSource = listaFamiliar; //Enlaza los datos. this.gvFamiliar.DataBind(); if (listaFamiliar.Count == 0) { this.lblMessageFamiliar.Visible = true; } else { this.lblMessageFamiliar.Visible = false; } }
protected void btnAddCuenta_Click(object sender, EventArgs e) { try { if (ValidarCuentas()) { PersonasCuentas oPersonasCuentas = null; if (!string.IsNullOrEmpty(this.lblPersonaCuentaId.Text)) { oPersonasCuentas = new Persona().GetPersonaCuenta(int.Parse(this.lblPersonaCuentaId.Text)); oPersonasCuentas.FechaAlta = Convert.ToDateTime(this.txtFechaAltaCuenta.Text); if (!string.IsNullOrEmpty(this.txtFechaBajaSocio.Text)) oPersonasCuentas.FechaBaja = DateTime.Parse(this.txtFechaBajaCuenta.Text); else oPersonasCuentas.FechaBaja = null; oPersonasCuentas.Cuenta = Convert.ToInt32(txtCuenta.Text); oPersonasCuentas.CBU = Convert.ToInt32(txtCBU.Text); oPersonasCuentas.Tipo = Convert.ToInt32(ddlTipoCuenta.SelectedValue); oPersonasCuentas.BancoId = Convert.ToInt32(ddlBanco.SelectedValue); new Persona().UpdateCuenta(oPersonasCuentas); } else { oPersonasCuentas = new PersonasCuentas(); oPersonasCuentas.FechaAlta = DateTime.Parse(this.txtFechaAltaCuenta.Text); if (!string.IsNullOrEmpty(this.txtFechaBajaSocio.Text)) oPersonasCuentas.FechaBaja = DateTime.Parse(this.txtFechaBajaCuenta.Text); else oPersonasCuentas.FechaBaja = null; oPersonasCuentas.BancoId = int.Parse(this.ddlBanco.SelectedValue); oPersonasCuentas.Tipo = int.Parse(this.ddlTipoCuenta.SelectedValue); oPersonasCuentas.PersonaId = int.Parse(Request.QueryString["PersonaId"]); oPersonasCuentas.Cuenta = Convert.ToInt32(txtCuenta.Text); oPersonasCuentas.CBU = Convert.ToInt32(txtCBU.Text); new Persona().AddCuenta(oPersonasCuentas); } this.FillGridCuenta(); } } catch (Exception ex) { this.lblErrorCuenta.Text = ex.Message; } }
private void FillGridCuenta() { List<PersonasCuentas> listaCuenta = new Persona().GetListPersonaCuenta(int.Parse(Request.QueryString["PersonaId"])); //Paginamos la grilla. if (this.gvPersonaCuenta.PageSize < listaCuenta.Count) { this.gvPersonaCuenta.AllowPaging = true; //--- Me fijo que pagina tengo que mostrar if (listaCuenta.Count <= this.gvPersonaCuenta.PageIndex * this.gvPersonaCuenta.PageSize) this.gvPersonaCuenta.PageIndex = 0; } else this.gvPersonaCuenta.AllowPaging = false; //Carga los datos en la grilla. this.gvPersonaCuenta.DataSource = listaCuenta; //Enlaza los datos. this.gvPersonaCuenta.DataBind(); this.lblMessageCuenta.Visible = listaCuenta.Count == 0; }
private void FillGrid() { try { int? nro = null; if (!string.IsNullOrEmpty(this.txtNroDocumento.Text.Trim())) nro = Convert.ToInt32(this.txtNroDocumento.Text.Trim()); //IList<Persona> list = Techmind.Adiutor.Compras.Persona.SearchByPersonaDescripcion(this.txtTextoLibre.Text, string.Empty, string.Empty, this.txtClaseCodigo.Text, (string.IsNullOrEmpty(this.Request.QueryString["ClaseGenericaID"]) ? string.Empty : this.Request.QueryString["ClaseGenericaID"]),this.chkPropios.Checked); IList<Personas> list = new Persona().GetListaPersonas(txtNombre.Text.Trim(), nro); //--- Me fijo si se necesita paginacion if (gvPersona.PageSize < list.Count) { gvPersona.AllowPaging = true; //--- Me fijo que pagina tengo que mostrar if (list.Count <= gvPersona.PageIndex * gvPersona.PageSize) gvPersona.PageIndex = 0; } else gvPersona.AllowPaging = false; gvPersona.DataSource = list; gvPersona.DataBind(); } catch (Exception ex) { lblError.Text = ex.Message; } }
private void FillGridPersona() { int? _nroDoc = null; if (!string.IsNullOrEmpty(this.txtNroDoc.Text)) { _nroDoc = int.Parse(this.txtNroDoc.Text); } List<Personas> listaPersonas = new Persona().GetListaPersonas(this.txtApeNom.Text, _nroDoc); //Paginamos la grilla. if (this.gvPersona.PageSize < listaPersonas.Count) { this.gvPersona.AllowPaging = true; //--- Me fijo que pagina tengo que mostrar if (listaPersonas.Count <= this.gvPersona.PageIndex * this.gvPersona.PageSize) this.gvPersona.PageIndex = 0; } else this.gvPersona.AllowPaging = false; //Carga los datos en la grilla. this.gvPersona.DataSource = listaPersonas; //Enlaza los datos. this.gvPersona.DataBind(); if (listaPersonas.Count == 0) { this.lblMessage.Visible = true; } else { this.lblMessage.Visible = false; } }