public E_PERSONAL buscarPersonal(int documento) { //E_PERSONA persona = new E_PERSONA(); E_PERSONAL personal = new E_PERSONAL(); using (var conexion = GetConnection()) { conexion.Open(); using (var comand = new SqlCommand()) { comand.Connection = conexion; comand.CommandText = "SP_BUSCAR_PERSONA"; comand.Parameters.AddWithValue("@PE_IDENTIFICACION", documento); comand.CommandType = CommandType.StoredProcedure; SqlDataReader reader = comand.ExecuteReader(); while (reader.Read()) { personal.pER_IDPERSONAL = reader.GetInt32(8); } return(personal); } } }
public E_PERSONAL buscarPersonal(int documento) { //E_PERSONA persona = new E_PERSONA(); E_PERSONAL personal = new E_PERSONAL(); using (var conexion = GetConnection()) { conexion.Open(); using (var comand = new SqlCommand()) { comand.Connection = conexion; comand.CommandText = "SP_BUSCAR_PERSONA"; comand.Parameters.AddWithValue("@PE_IDENTIFICACION", documento); comand.CommandType = CommandType.StoredProcedure; SqlDataReader reader = comand.ExecuteReader(); while (reader.Read()) { /*persona.PE_IDPERSONA= reader.GetInt32(0); * persona.PE_NOMBRE = reader.GetString(1); * persona.PE_APELLIDOPAT = reader.GetString(2); * persona.PE_APELLIDOMAT = reader.GetString(3); * persona.PE_IDENTIFICACION = reader.GetString(4); * persona.PE_FECHANAC = reader.GetDateTime(5) + ""; * persona.PE_TELEFONO = reader.GetString(6); * persona.PE_DIRECCION = reader.GetString(7);*/ personal.pER_IDPERSONAL = reader.GetInt32(8); } return(personal); } } }
protected void btnBuscarApoderado_Click(object sender, EventArgs e) { if (txtApoderadoDoc.Text != "") { N_Persona n_persona = new N_Persona(); E_PERSONAL e_personal = new E_PERSONAL(); e_personal = n_persona.buscarPersonal(Convert.ToInt32(txtApoderadoDoc.Text)); if (e_personal.pER_IDPERSONAL != 0) { txtApoderado.Text = e_personal.pER_IDPERSONAL + ""; txtApoderadoDoc.Text = ""; } else { Response.Write("<script>alert('APODERADO NO ESXISTE, REGISTRE UNO')</script>"); } } else { Response.Write("<script>alert('CAMPO VACIO')</script>"); } }