Beispiel #1
0
  private void jBtnSubmitActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jBtnSubmitActionPerformed
    Enrollment enrollment = new Enrollment();

    enrollment.readEnrollmentBySubscriptionIdAndUserId(this.subscription.getId(), this.userId);

    if (enrollment.isEnrolled() == false) {
      enrollment.subscribe(this.subscription.getId(), this.userId);

      User user = new User();
      user.readUser(this.userId);

      this.model.insertRow(0, new Object[] {user.getId(), user.getFullName()});

      Application.getInstance()
          .showPopup(new SuccessPopup("Deelnemer " + user.getFullName() + " is ingeschreven."));
    } else {
      Application.getInstance().showPopup(new ErrorPopup("De deelnemer is al ingeschreven."));
    }
  } // GEN-LAST:event_jBtnSubmitActionPerformed
Beispiel #2
0
  /**
   * This method searches the user you type in the textfield. The user is searched to add him to the
   * course.
   */
  public void searchUser() {
    // Empty results
    jLabelUser.setText("");
    jBtnSubmit.setVisible(false);

    // Search a user and return a result
    User user = new User();

    try {
      int id = Integer.parseInt(jTextId.getText());
      user.readUser(id);
      if (user.getId() > 0) {
        this.userId = user.getId();
        // Set the label
        jLabelUser.setText(user.getFullName());
        jBtnSubmit.setVisible(true);
      }
    } catch (Exception ex) {
      ExceptionHandler.handle(ex, ExceptionHandler.TYPE_SYSTEM_ERROR);
    }
  }