Exemple #1
0
  public static void confirmation(
      String courseName,
      @Required(message = "Please specify your name") String name,
      @Required(message = "Please specify your email address") String email,
      String telephonenumber,
      @Required(message = "Please specify company") String company,
      @Required(message = "Please specify billing address") String address,
      String orgnumber) {

    if (Validation.hasErrors()) {
      System.out.println(Validation.errors().toString());
      params.flash(); // add http parameters to the flash scope
      validation.keep(); // keep the errors for the next request
      index();
    }

    Course course = Course.find("byName", courseName).first();

    if (course.isNotFull()) {
      Participant participant =
          new Participant(name, email, telephonenumber, company, address, orgnumber);
      Logger.logInfo(
          participant + " signed up for " + course.name + " starting " + course.startDate);
      course.addParticipant(participant);
      new MailSender().sendConfirmationMail(participant, course);
      flash.success("Thank you for registering for the Kanban Training Class.");

    } else {
      flash.error("Sorry. This course is fully booked");
      registerInterest(course);
    }
    render(course);
  }
  @Override
  public void loaded() {
    Course course = (Course) parameter;
    courseNameField.textProperty().bindBidirectional(course.getNameProperty());
    universityField.textProperty().bindBidirectional(course.getUniversity().getNameProperty());

    preRequisitesTable.setItems(course.getPreRequisites());
    preRequisiteNameColumn.setCellValueFactory((q) -> q.getValue().getNameProperty());
    preRequisiteFieldColumn.setCellValueFactory((q) -> q.getValue().getFieldProperty());
  }
 @Test
 public void testGetAllCourses() throws Exception {
   List<Course> courses = data.getAllCourses();
   for (Course c : courses) {
     System.out.println(c.toString());
     List<Section> sections = c.getSections();
     for (Section s : sections) {
       System.out.println("\t\t" + s.toString());
     }
   }
 }
Exemple #4
0
 private static Course getCourse(String courseName) {
   Course course = Course.find("byName", courseName).first();
   return course;
 }
Exemple #5
0
 public static void index() {
   // Course course = getCourse("Kanban Training Class");
   // render(course);
   List<Course> courses = Course.findAll();
   render(courses);
 }