public void habilitar() { txtNombre.Visible = true; txtApellido.Visible = true; txtDni.Visible = true; txtMail.Visible = true; cbxActivo.Visible = true; rbtnHombre.Enabled = true; rbtnHombre.Checked = true; rbtnMujer.Enabled = true; btnGuardar.Visible = true; dtpFechaNac.Visible = true; cboTipoTelefono.Visible = true; cboRol.Visible = true; txtNumero.Visible = true; txtContacto.Visible = true; btnAnterior.Visible = true; btnSiguiente.Visible = true; btnPrimero.Visible = true; btnUltimo.Visible = true; usuarioToolStripMenuItem.Visible = true; ErrorNombre.Clear(); ErrorApellido.Clear(); ErrorDNI.Clear(); ErrorFecha.Clear(); ErrorMail.Clear(); ErrorTipo.Clear(); ErrorTE.Clear(); TipoTelefonoBusiness TipoTelefonoBusiness = new TipoTelefonoBusiness(); try { cboTipoTelefono.DataSource = TipoTelefonoBusiness.listar(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } RolBusinness rolBusinness = new RolBusinness(); try { cboRol.DataSource = rolBusinness.listar(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public void rdoBusqueda() { EmpleadoBusiness empleadoBusiness = new EmpleadoBusiness(); habilitar(); lblNroId.Text = empleado.IdPersona.ToString(); txtNombre.Text = empleado.Nombre; txtApellido.Text = empleado.Apellido; txtDni.Text = empleado.Dni; dtpFechaNac.Value = empleado.FechaNac; txtNumero.Text = empleado.Telefono.Numero; cbxActivo.Checked = empleado.Estado; cboTipoTelefono.SelectedIndex = empleado.Telefono.TipoTelefono.IdTipoTelefono - 1; cboTipoTelefono.Text = empleado.Telefono.TipoTelefono.NombreTipoTelefono; txtMail.Text = empleado.Mail; txtContacto.Text = empleado.Telefono.Contacto; btnSalir.Location = new System.Drawing.Point(164, 398); RolBusinness rolBusinness = new RolBusinness(); cboRol.SelectedIndex = rolBusinness.obtenerRol(empleado.IdPersona) - 2; if (String.Compare(empleado.Sexo, "M") >= 0) { rbtnHombre.Checked = true; } else { rbtnMujer.Checked = true; } lblNroId.Visible = true; lblId.Visible = true; btnSiguiente.Visible = true; btnAnterior.Visible = true; txtNombre.Focus(); btnCancelar.Visible = false; btnGuardar.Text = "Modificar"; if (empleado.IdPersona < empleadoBusiness.obtenerIDMax()) { btnSiguiente.Enabled = true; btnUltimo.Enabled = true; } else { btnSiguiente.Enabled = false; btnUltimo.Enabled = false; } if (empleadoBusiness.obtenerIDMin() < empleado.IdPersona) { btnAnterior.Enabled = true; btnPrimero.Enabled = true; } else { btnAnterior.Enabled = false; btnPrimero.Enabled = false; } eliminarToolStripMenuItem.Visible = true; }