private void Fill(Staff s) {
   txtFieldID.setText("" + s.getNumber());
   txtFieldName.setText(s.getName());
   cmbBoxPersonalTypes.setSelectedItem(s.getType());
   txtFieldPrimaryAirport.setText(s.getPrimaryAirport());
 }
  private void btnSaveActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnSaveActionPerformed
    String name = txtFieldName.getText();
    int staffId = -1;
    Staff.PersonalType st = (Staff.PersonalType) cmbBoxPersonalTypes.getSelectedItem();
    String primaryAirport = txtFieldPrimaryAirport.getText();

    String errorMessage = "";
    name.trim();
    if (name.isEmpty()) {
      errorMessage += "Please enter a name first \n";
    }

    if (txtFieldID.getText().isEmpty()) {
      errorMessage += "Please enter a correct staff id first  \n";
    } else {
      try {
        staffId = Integer.parseInt(txtFieldID.getText());
      } catch (NumberFormatException exception) {
        errorMessage += "plane number isn't a number \n";
      }
    }

    if (txtFieldPrimaryAirport.getText().isEmpty()) {
      errorMessage += "Please enter a Primary Airport first  \n";
    } else {
      try {
        primaryAirport = txtFieldPrimaryAirport.getText();
      } catch (NumberFormatException exception) {
        errorMessage += "Primary Airport isn't a number \n";
      }
    }

    if (!errorMessage.isEmpty()) {
      lblErrorMessage.setText(errorMessage);
    } else {
      if (staff == null) {
        staff = new Staff();
        staff.setName(name);
        staff.setNumber(staffId);
        staff.setType(st);
        staff.setPrimaryAirport(primaryAirport);

        if (Controller.Controller.Instance().AddStaff(staff)) {
          JOptionPane.showMessageDialog(this, "Staff " + staff.getName() + " Saved");
          this.dispose();
        }
      } else {
        Staff newStaff = new Staff();
        newStaff.setName(name);
        newStaff.setNumber(staffId);
        newStaff.setType(st);
        newStaff.setPrimaryAirport(primaryAirport);

        if (Controller.Controller.Instance().ChangeStaff(newStaff, staff)) {
          JOptionPane.showMessageDialog(this, "Staff " + staff.getName() + " Saved");
          this.dispose();
        }
      }
      this.dispose();
    }
  } // GEN-LAST:event_btnSaveActionPerformed