private void button3_Click(object sender, EventArgs e) { try { string id = textID.Text.Trim(); if (textID.Text.Equals("")) { MessageBox.Show("Digite identificación"); } else { if (resp.Error is false) { // MessageBox.Show(resp.Mensaje, "Prueba", MessageBoxButtons.OK, MessageBoxIcon.Information); string identificacion = textID.Text.Trim(); resp = empleadoService.ConsultarIdentificacion(identificacion); Mapear(resp.empleado); } else { MessageBox.Show(resp.Mensaje, "Prueba", MessageBoxButtons.OK, MessageBoxIcon.Error); } textID.Text = ""; } } catch (Exception ex) { MessageBox.Show("Identificacion no encontrada", "Datos no validos", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button1_Click(object sender, EventArgs e) { List <Empleado> lista; RespuestaConsultarIdentificacion resp = new RespuestaConsultarIdentificacion(); string id = textName.Text.Trim(); resp = empleadoService.ConsultarIdentificacion(id); if (textName.Text.Equals("")) { ConsultaPersonaRespuesta respuesta = new ConsultaPersonaRespuesta(); respuesta = empleadoService.Consultar(); if (respuesta.Error is false) { TblEmpleados.DataSource = null; empleados = null; TblEmpleados.DataSource = null; empleados = respuesta.Empleados.ToList(); TblEmpleados.DataSource = respuesta.Empleados; MessageBox.Show(respuesta.Mensaje, "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(respuesta.Mensaje, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { if (resp.Error is false) { MessageBox.Show(resp.Mensaje, "Prueba", MessageBoxButtons.OK, MessageBoxIcon.Error); string identificacion = textID.Text.Trim(); resp = empleadoService.ConsultarIdentificacion(identificacion); lista = new List <Empleado>(); lista.Add(resp.empleado); TblEmpleados.DataSource = lista; } else { MessageBox.Show(resp.Mensaje, "Prueba", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void MapearParcial() { indice = TblEmpleados.Rows.Add(); RespuestaConsultarIdentificacion resp = new RespuestaConsultarIdentificacion(); resp = empleadoService.ConsultarIdentificacion(textID.Text.Trim()); empleado = resp.empleado; TblEmpleados.Rows[indice].Cells[0].Value = resp.empleado.Cedula; TblEmpleados.Rows[indice].Cells[1].Value = resp.empleado.PrimerNombre; TblEmpleados.Rows[indice].Cells[2].Value = resp.empleado.PrimerApellido; }