Package it.hotel.model.booking

Examples of it.hotel.model.booking.Booking


   * @return
   */
  public ModelAndView delete(HttpServletRequest req, HttpServletResponse resp){
    try {
      int id = Integer.parseInt(req.getParameter("id"));
      Booking booking=(Booking) bookingManager.get(id);
      if(booking.getType().compareTo("UNCONFIRMED")==0)
      {
        bookingManager.remove(id);
       
          return this.listUnconfirmed(req, resp);

View Full Code Here


      id = Integer.parseInt(req.getParameter("id"));
    } catch (Exception e){
      return new ModelAndView("hotel.404");
    }
   
    Booking booking = (Booking) bookingManager.get(id);
    if (booking == null)
    {
      return this.list(req, resp);
    }
     
View Full Code Here

   * @return
   */
  public ModelAndView editCheckin(HttpServletRequest req, HttpServletResponse resp) {
    String id= req.getParameter("id");
    if(id != null){
      Booking booking = (Booking)bookingManager.get(Integer.parseInt(id));
      Customer customer = booking.getCustomer();
      BookingDTO bookingDTO = new BookingDTO(booking);
     
      req.setAttribute("booking", bookingDTO);
      ArrayList<Structure>  hotels = new  ArrayList<Structure>();
      hotels.add(booking.getStructure());
      req.setAttribute("hotels", hotels);
     
      return new ModelAndView("hotel.booking.BookingCheckinNew", "customer", customer);
    }
    return list(req, resp);
View Full Code Here

      UnconfirmedBooking unConfirmed= (UnconfirmedBooking) bookingManager.get(id);
    GregorianCalendar beginDate= unConfirmed.getBeginDate();
    GregorianCalendar finishDate=unConfirmed.getFinishDate();
    Room room=unConfirmed.getRoom();
         
            Booking booking=new Booking(unConfirmed);
            if(bookingManager.isRoomVacant(beginDate, finishDate, room)){
           
            bookingManager.add(booking);
           
            try {
              mail.sendMailEnable(booking);
        } catch (MailException e) {
          System.out.println(e.getMessage());
          bookingManager.remove(booking.getId());
          throw new Exception ();
        }
        bookingManager.remove(id);
       
            }
View Full Code Here

 
 
  @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
  public boolean checkIn(int bookingId) {
    Booking booking = (Booking) get(bookingId);
    this.checkIn(booking);
    return true;
  }
View Full Code Here

   * @return the booking which has been enabled
   */
  @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
  public Booking enableBooking(UnconfirmedBooking unconfirmedBooking) {

    Booking booking;
    booking = new Booking(unconfirmedBooking);
    getDAO().save(booking);
    unconfirmedBookingDAO.remove(unconfirmedBooking);

    return booking;
  }
View Full Code Here

   * @return true if the specified rooms are available in the specified date range
   */
 
  @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
  public boolean checkAndEdit(Booking booking){
    Booking tempBooking = (Booking) this.get(booking.getId());
    this.remove(tempBooking);
   
    if(!this.isVacant(booking.getRoom(),booking.getBeginDate() , booking.getFinishDate())){
      this.add(tempBooking);
      return false;
View Full Code Here

     */
  protected Map referenceData(HttpServletRequest req,
      Object command, Errors errors, int page) throws Exception {
    Map map = new HashMap();
    String id = req.getParameter("id");
    Booking booking = (Booking) bookingManager.get(Integer.parseInt(id));
    roomTemp = booking.getRoom();
    ArrayList<Structure> hotels = new ArrayList<Structure>();
    hotels.add(booking.getStructure());
   
    if(page==0){
     
   
    ArrayList<Room> rooms = new ArrayList<Room>();
   
    ArrayList<Typology> typologies = new ArrayList<Typology>();
    rooms = (ArrayList) roomManager.getRoomsFromStructure(booking.getStructure().getId());
   
    typologies = (ArrayList) typologyManager.getTypologiesFromStructure(booking.getStructure().getId());
    map.put("rooms", rooms);
    map.put("hotels", hotels);
    map.put("typologies", typologies);
    }
    if(page==1){
View Full Code Here

  protected ModelAndView processFinish(HttpServletRequest arg0,
      HttpServletResponse arg1, Object command, BindException arg3)
  throws Exception {
    this.setProperties(command);
    BookingDTO booking = (BookingDTO) command;
    Booking tempBooking = (Booking) bookingManager.get(booking.getId());
    bookingManager.remove(tempBooking);
    GregorianCalendar begindateCalendar = booking.getBeginDate();
    GregorianCalendar finishdateCalendar = booking.getFinishDate();
    if(!bookingManager.isVacant(booking.getRoom(), begindateCalendar, finishdateCalendar)){
      tempBooking.setId(0);
      bookingManager.add(tempBooking);
      return new ModelAndView(getFailurePage(), "roomNumber", booking.getRoom().getNumber());
    }else{
      booking.setId(0);
            Booking newBooking = createBookingFromBookingDTO(booking);
     
      bookingManager.add(newBooking);
    }   
    return new ModelAndView(getSuccessView());
   
View Full Code Here

   
  }
 
  private Booking createBookingFromBookingDTO(BookingDTO bookingDTO){
   
    Booking booking = new Booking();
   
    booking.setType(Booking.TYPE_BOOKING);
    booking.setAccomodation(bookingDTO.getAccomodation());
    booking.setBeginDate(bookingDTO.getBeginDate());
    booking.setFinishDate(bookingDTO.getFinishDate());
    booking.setCustomer(bookingDTO.getCustomer());
    booking.setCustomerId(bookingDTO.getCustomerId());
    booking.setStructure(bookingDTO.getStructure());
    booking.setRoom(bookingDTO.getRoom());
    booking.setRoomId(bookingDTO.getRoomId());
    booking.setId(0);
    booking.setCode(bookingDTO.getCode());
       
    return booking;
  }
View Full Code Here

TOP

Related Classes of it.hotel.model.booking.Booking

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.