Package it.hotel.controller.pricelist.DTO

Examples of it.hotel.controller.pricelist.DTO.PriceListDTO


   * @throws
   * @return
   */
  @Override
  protected Object formBackingObject (HttpServletRequest request) throws Exception {
    PriceListDTO priceListDTOForm = (PriceListDTO)super.formBackingObject(request);
    return priceListDTOForm; 
  }
View Full Code Here


  /**
   * @param
   */
  @Override
  protected void doSubmitAction (Object command){
    PriceListDTO priceListDTO = (PriceListDTO)command;
    int id = priceListDTO.getTypologyId();
    Typology typology = (Typology)typologyManager.get(id);
    Structure structure = typology.getStructure();
    priceListDTO.setTypology(typology);
    double price_double = Double.parseDouble(priceListDTO.getPrice());
    BigDecimal priceValue = BigDecimal.valueOf(price_double);
   
    if (priceListDTO.getId() == 0){
      Price price = new Price ();
      price.setPrice(priceValue);
      price.setCalendarDate(CalendarUtils.GetGregorianCalendar(priceListDTO.getDate()));
      price.setTypology_id(typology.getId());
      price.setStructure(structure);
      price.setHotelId(typology.getStructure().getId());
      typology.addPrice(price);
        typologyManager.add(typology)
    }
    else {
      Typology typologyEdit = priceListDTO.getTypology();
      String dateString = priceListDTO.getDate();
      Price priceActual  = (Price)priceManager.get(priceListDTO.getId());
      priceActual.setCalendarDate(CalendarUtils.GetGregorianCalendar(priceListDTO.getDate()));
      priceActual.setPrice(priceValue);
      priceActual.setTypology_id(priceListDTO.getTypologyId());
      priceManager.add(priceActual);
    }
  }
View Full Code Here

    String id = req.getParameter("id");
    if (id != null){
      req.setAttribute("hotels", structureManager.getAll());
      req.setAttribute("typologies", typologyManager.getAll());
      Price price = (Price) priceManager.get(Integer.parseInt(id));
      PriceListDTO priceListDTO = new PriceListDTO ();
      priceListDTO.setId(price.getId());
      priceListDTO.setDate(CalendarUtils.GetDateAsString(price.getCalendarDate()));
      BigDecimal priceBDecimal = price.getPrice();
      double priceDouble = priceBDecimal.doubleValue();
      String priceString = String.valueOf(priceDouble);
      priceListDTO.setPrice(priceString);
      priceListDTO.setTypologyId(price.getTypology_id());
      priceListDTO.setTypology((Typology)typologyManager.get(price.getTypology_id()));
      return new ModelAndView("hotel.priceList.new", "priceListDTO", priceListDTO);
     
    }
    return new ModelAndView("redirect:/priceList/list.htm");
  }
View Full Code Here

     
  }
 
  private void createPriceListDTO(){
   
    priceListDTO = new PriceListDTO();
    Typology t1=new Typology();
    t1.setId(1);
    t1.setHotelId(1);
   
    priceListDTO.setDate("35/15/70");
View Full Code Here

  }


 
  private void isDate(Object command, Errors errors){
    PriceListDTO priceListDTO = (PriceListDTO)command;
    if(priceListDTO.getDate()!=""){
    if(CalendarUtils.isDate(priceListDTO.getDate())==false){
      errors.reject("errors.dateAsStirng.noCorrectFormat","errors.dateAsStirng.noCorrectFormat");
    }
    }
  }
View Full Code Here

    }
    }
  }
 
  private void isFinischDate(Object command, Errors errors){
    PriceListDTO priceListDTO = (PriceListDTO)command;
    if(priceListDTO.getFinishDate()!="" && priceListDTO.getFinishDate()!=null) {
    if(CalendarUtils.isDate(priceListDTO.getFinishDate())==false){
      errors.reject("errors.dateAsStirng.noCorrectFormat","errors.dateAsStirng.noCorrectFormat");
    }
    }
  }
View Full Code Here

    }
    }
  }
 
  private void isPrice(Object command, Errors errors){
    PriceListDTO priceListDTO = (PriceListDTO)command;
    if(priceListDTO.getPrice()!=""){
    try {
      Double val=Double.valueOf(priceListDTO.getPrice());
      BigDecimal price=BigDecimal.valueOf(val);
     
     
    } catch (Exception e) {
      errors.reject("errors.price.notCorrect","errors.price.notCorrect");
View Full Code Here

   *@throws
   *@return
   */
  @Override
  protected Object formBackingObject (HttpServletRequest request) throws Exception {
    PriceListDTO priceListDTOForm = (PriceListDTO)super.formBackingObject(request);
    return priceListDTOForm; 
  }
View Full Code Here

  /**
   * @param
   */
  @Override
  protected void doSubmitAction (Object command){
    PriceListDTO priceListDTO = (PriceListDTO)command;
    int id = priceListDTO.getTypologyId();
    int j=0;
    ArrayList<Typology> typologies= (ArrayList<Typology>) typologyManager.getAll();
    for (Typology typology : typologies) {
      id= typologies.get(j).getId();
     typology = typologies.get(j);
      j++;
   
   
    priceListDTO.setTypology(typology);
    double price_double = Double.parseDouble(priceListDTO.getPrice());
    BigDecimal priceValue = BigDecimal.valueOf(price_double);
    GregorianCalendar begin= CalendarUtils.GetGregorianCalendar(priceListDTO.getDate());
 
    GregorianCalendar end= CalendarUtils.GetGregorianCalendar(priceListDTO.getFinishDate());
    int timeBooking=CalendarUtils.GetNumberOfDays(CalendarUtils.GetGregorianCalendar(priceListDTO.getDate()), CalendarUtils.GetGregorianCalendar(priceListDTO.getFinishDate()));
    ArrayList<Price> prices= typology.getPriceListOnDataRange(begin, end);
   
    newPrices(priceValue,  begin,  typology,  timeBooking,   begin)
    updatePrices( prices, priceValue);
    }
View Full Code Here

   * @throws
   * @return
   */
  @Override
  protected Object formBackingObject (HttpServletRequest request) throws Exception {
    PriceListDTO priceListDTOForm = (PriceListDTO)super.formBackingObject(request);
    return priceListDTOForm; 
  }
View Full Code Here

TOP

Related Classes of it.hotel.controller.pricelist.DTO.PriceListDTO

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.