Esempio n. 1
0
 @View
 public void confirmBooking(
     String id,
     String checkinDate,
     String checkoutDate,
     String beds,
     String smoking,
     String creditCard,
     String creditCardName,
     String creditCardExpiryMonth,
     String creditCardExpiryYear) {
   Map<String, Object> context = new HashMap<String, Object>();
   Hotel hotel = Hotel.findById(id);
   context.put("total", 0);
   context.put("hotel", hotel);
   context.put("checkinDate", checkinDate);
   context.put("checkoutDate", checkoutDate);
   context.put("beds", beds);
   context.put("smoking", smoking);
   context.put("creditCard", creditCard);
   context.put("creditCardName", creditCardName);
   context.put("creditCardExpiryMonth", creditCardExpiryMonth);
   context.put("creditCardExpiryYear", creditCardExpiryYear);
   confirmBooking.render(context);
 }
Esempio n. 2
0
  @Action
  public Response processConfirmBooking(
      String confirm,
      String id,
      String checkinDate,
      String checkoutDate,
      String beds,
      String smoking,
      String creditCard,
      String creditCardName,
      String creditCardExpiryMonth,
      String creditCardExpiryYear) {
    Hotel hotel = Hotel.findById(id);
    User user = User.find(login.getUserName(), null);
    Booking booking = new Booking(hotel, user);
    booking.checkinDate = checkinDate;
    booking.checkoutDate = checkoutDate;
    booking.beds = Integer.parseInt(beds);
    booking.smoking = Boolean.valueOf(smoking);
    booking.creditCard = creditCard;
    booking.creditCardName = creditCardName;
    booking.creditCardExpiryMonth = Integer.parseInt(creditCardExpiryMonth);
    booking.creditCardExpiryYear = Integer.parseInt(creditCardExpiryYear);

    //      validation.valid(booking);

    /*
           // Errors or revise
           if(validation.hasErrors() || params.get("revise") != null) {
               render("@book", hotel, booking);
           }

           // Confirm
    */
    if (confirm != null) {
      booking.create();
      flash.setSuccess(
          "Thank you, "
              + login.getUserName()
              + ", your confimation number for "
              + hotel.name
              + " is "
              + booking.id);
      return Hotels_.index();
    } else {
      // Display booking
      return Hotels_.confirmBooking(
          id,
          checkinDate,
          checkoutDate,
          beds,
          smoking,
          creditCard,
          creditCardName,
          creditCardExpiryMonth,
          creditCardExpiryYear);
    }
  }
Esempio n. 3
0
 @View
 public void show(String id) {
   Hotel hotel = Hotel.findById(id);
   show.with().hotel(hotel).render();
 }
Esempio n. 4
0
 @View
 public void book(String id) {
   Hotel hotel = Hotel.findById(id);
   book.with().hotel(hotel).render();
 }