示例#1
0
  private boolean buscar(int seleccion) {
    String idEjecutivo = this.lblIdEjecutivo.getText();
    String identificador = this.txtIdentificador.getText();
    String nombre = this.txtNombre.getText();

    switch (seleccion) {
      case 0:
        ejecutivobeans.setNombre(nombre);
        if (ejecutivobeans.findByName() != false) {
          this.cargaDatos();
        } else {
          this.limpiar();
          this.lblErrorBusqueda.setText("El ejecutivo \"" + nombre + "\" no existe");
          this.lblErrorBusqueda.setText("No hemos encontrado lo que búscas!");
          return true;
        }
        break;
      case 1:
        ejecutivobeans.setIdEjecutivo(idEjecutivo);
        if (ejecutivobeans.findByID() != false) {
          this.cargaDatos();
        } else {
          this.limpiar();
          this.lblErrorBusqueda.setText("El ejecutivo \"" + nombre + "\" no existe");
          this.lblErrorBusqueda.setText("No hemos encontrado lo que búscas!");
          return true;
        }
        break;
      case 3:
        ejecutivobeans.setIdentificador(identificador);
        if (ejecutivobeans.findByIdentificador() != false) {
          this.cargaDatos();
        } else {
          this.limpiar();
          this.lblErrorBusqueda.setText("El ejecutivo \"" + nombre + "\" no existe");
          this.lblErrorBusqueda.setText("No hemos encontrado lo que búscas!");
          return true;
        }
        break;
      default:
        // ByName
    }
    return false;
  }