示例#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);
  }
示例#2
0
 private static Course getCourse(String courseName) {
   Course course = Course.find("byName", courseName).first();
   return course;
 }