public void limpiarComponentes() { txtNombreCliente.Text = ""; txtDNI.Text = ""; txtCorreo.Text = ""; txtTelef.Text = ""; rbFemenino.Checked = false; rbMasculino.Checked = false; txtAseguradora.Text = ""; txtNumAseguradora.Text = ""; cboSedes.SelectedIndex = -1; txtNombreEmergencia.Text = ""; txtTelefonoEmergencia.Text = ""; dgvContactos.RowCount = 0; dgvBebes.RowCount = 0; udNumPartos.Value = 0; udNumEmbarazos.Value = 0; txtObservaciones.Text = ""; txtDNIPareja.Text = ""; txtNombrePareja.Text = ""; rbFemeninoPareja.Checked = false; rbMasculino.Checked = false; dgvGestaciones.RowCount = 0; cliente = new Service.cliente(); apoderado = new Service.apoderado(); gestante = new Service.gestante(); gestacion = new Service.gestacion(); contacto = new Service.contactoEmergencia(); bebe = new Service.bebe(); contactos = new BindingList <Service.contactoEmergencia>(); bebes = new BindingList <Service.bebe>(); gestacion = new Service.gestacion(); condiciones = new BindingList <Service.condicionMedica>(); }
private void btnBuscar_Click(object sender, EventArgs e) { frmBuscarCliente formCliente = new frmBuscarCliente(true); if (formCliente.ShowDialog() == DialogResult.OK) { cliente = formCliente.ClienteSeleccionado; lblCodigo.Text = cliente.codigo; txtNombreCliente.Text = cliente.nombre; txtDNI.Text = cliente.dni; txtCorreo.Text = cliente.email; txtTelef.Text = cliente.telefono; if (cliente.sexo == 'F') { rbFemenino.Checked = true; } else { rbMasculino.Checked = true; } txtAseguradora.Text = cliente.aseguradora; txtNumAseguradora.Text = cliente.numSeguro; dgvContactos.RowCount = 0; //rprobando cambios a rama if (cliente.contactos != null) { foreach (Service.contactoEmergencia contacto in cliente.contactos) { Object[] filaContacto = new Object[2]; filaContacto[0] = contacto.nombre; filaContacto[1] = contacto.telefono; dgvContactos.Rows.Add(filaContacto); } } if (cliente is Service.apoderado) { apoderado = (Service.apoderado)cliente; tabTipo.SelectedTab = tabApoderado; dgvBebes.RowCount = 0; //bebes = new BindingList<Service.bebe>(); if (apoderado.bebes != null) { foreach (Service.bebe bebe in apoderado.bebes) { Object[] filaBebe = new Object[4]; filaBebe[0] = bebe.dni; filaBebe[1] = bebe.nombre; filaBebe[2] = bebe.relacion; filaBebe[3] = bebe.fechaNaci.ToShortDateString(); dgvBebes.Rows.Add(filaBebe); } } } else { tabTipo.SelectedTab = tabGestante; gestante = (Service.gestante)cliente; udNumPartos.Value = gestante.numPartos; udNumEmbarazos.Value = gestante.cantEmbar; dtpFechaNacimiento.Value = gestante.fechaNaci; dgvCondiciones.AutoGenerateColumns = false; dgvCondiciones.DataSource = gestante.condMedicas; for (int i = 0; i < dgvCondiciones.RowCount; i++) { dgvCondiciones.Rows[i].Cells[1].Value = true; } txtObservaciones.Text = gestante.observMedicas; if (gestante.pareja != null) { Service.pareja pareja = gestante.pareja; txtDNIPareja.Text = pareja.dni; txtNombrePareja.Text = pareja.nombre; if (pareja.sexo == 'F') { rbFemenino.Checked = true; } else { rbMasculino.Checked = true; } } dgvGestaciones.AutoGenerateColumns = false; gestaciones = new BindingList <Service.gestacion>(); if (gestante.gestaciones != null) { foreach (Service.gestacion gest in gestante.gestaciones) { Object[] filaGestacion = new Object[2]; filaGestacion[0] = gest.clinica; filaGestacion[1] = gest.fecha_probable_parto; gestaciones.Add(gest); dgvGestaciones.Rows.Add(filaGestacion); } } } estadoComponentes(Estado.Buscar); } }