protected void FillData() { this.tabFamiliares.Enabled = this.tabOrganismo.Enabled = this.tabSocio.Enabled = this.tabCuentas.Enabled = this.tabSocioCuotas.Enabled = this.tabUser.Enabled = true; DataAccess.Personas personaMetodo = new DataAccess.Personas(); DataAccess.Personas oPersona = personaMetodo.Get(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 btnGuardar_Click(object sender, EventArgs e) { DataAccess.Personas oPersona = null; if (Request.QueryString["PersonaId"] != null) { DataAccess.Personas personaMetodo = new DataAccess.Personas(); oPersona = personaMetodo.Get(Convert.ToInt32(Request.QueryString["PersonaId"])); } else oPersona = new DataAccess.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; 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); if (Request.QueryString["PersonaId"] != null) new DataAccess.Personas().Update(oPersona); else { int numero = new DataAccess.Personas().Insert(oPersona); Response.Redirect("PersonasABM.aspx?PersonaId=" + numero); } }