Package it.hotel.model.price

Examples of it.hotel.model.price.Price


    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


  public ModelAndView edit (HttpServletRequest req, HttpServletResponse resp){
    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 setUpRooms(){
   
    Typology t1 = new Typology();
    price1= new Price();
    price1.setCalendarDate(CalendarUtils.GetToday());
    price1.setTypology_id(t1.getId());
    price1.setPrice(new BigDecimal(120));
    expectedPrices1.add(price1);
    price2= new Price();
    price2.setCalendarDate(CalendarUtils.GetGregorianCalendar(CalendarUtils.getTomorrowInddMMyyyy()));
    price2.setTypology_id(t1.getId());
    price2.setPrice(new BigDecimal(120));
    expectedPrices1.add(price2);
    t1.setPriceList(expectedPrices1);
View Full Code Here


  public void setupExpectedPrice(){
      Typology typ= expectedTypologies.get(1);
    GregorianCalendar date = CalendarUtils.GetToday();
    price=new Price();
    price.setCalendarDate(date);
    price.setTypology_id(typ.getId());
    price.setPrice(new BigDecimal(120));
    expectedPrices= new HashSet<Price>();
    expectedPrices.add(price);
View Full Code Here

    }

   
    public void setPrice(){

    price= new Price();
    price.setCalendarDate(CalendarUtils.GetToday());
    price.setPrice(new BigDecimal(120));
    price.setTypology_id(t.getId());
    price.setStructure(hotel2);
    price.setHotelId(hotel2.getId());
    priceRawManager.add(price);
    t.addPrice(price);
    price1 = new Price ();
    price1.setCalendarDate(CalendarUtils.GetGregorianCalendar("01/01/2008"));
    price1.setPrice(new BigDecimal(100));
    price1.setTypology_id(t.getId());
    price1.setHotelId(hotel2.getId());
    price1.setStructure(hotel2);
    price1.setTypology_id(t.getId());
    priceRawManager.add(price1);
    t.addPrice(price1);
   
    //setPrice
    Price price2 = new Price ();
    price2.setCalendarDate(CalendarUtils.GetToday());
    price2.setPrice(new BigDecimal(100));
    price2.setTypology_id(t1.getId());
    price2.setHotelId(hotel2.getId());
    price2.setStructure(hotel2);
    price2.setTypology_id(t1.getId());
    priceRawManager.add(price2);
    t1.addPrice(price2);
    }
View Full Code Here

 
 
   
  public void testGet() throws Exception {
    BigDecimal money= new BigDecimal(120);
    Price price1= (Price) priceRawManager.get(price.getId());
   
    assertNotNull(price1);
 
      assertEquals(CalendarUtils.GetToday(), price1.getCalendarDate());
      assertEquals(money, price1.getPrice());
   
    priceRawManager.remove(price1);
   
    price1=(Price) priceRawManager.get(1);
    assertNull(price1);
View Full Code Here

 
  private void updatePrices(ArrayList<Price> prices, BigDecimal priceValue){
    int j=0;
    while(j< prices.size()){
      Price price=new Price();
      price.setStructure(prices.get(j).getStructure());
      price.setHotelId(prices.get(j).getHotelId());
      price.setPrice(priceValue);
      price.setId(prices.get(j).getId());
      price.setCalendarDate(prices.get(j).getCalendarDate());
      price.setTypology_id(prices.get(j).getTypology_id());
     
      priceManager.add(price);
      j++;
    }
  }
View Full Code Here

  }
 
  private void newPrices(BigDecimal priceValue, GregorianCalendar begin, Typology typology, int timeBooking,  GregorianCalendar date){
    ArrayList<Price> pricesOld=typology.getPriceListOnDataRange(begin, begin);
    if(pricesOld.size()==0){
    Price price = new Price ();
    price.setPrice(priceValue);
    price.setStructure(typology.getStructure());
    price.setHotelId(typology.getStructure().getId());
    price.setCalendarDate(begin);
    price.setTypology_id(typology.getId());
    typology.addPrice(price);
    typologyManager.add(typology);
    }
 
  for(int i=0; i<(timeBooking); i++){
    date=CalendarUtils.nexDay(date);
     pricesOld=typology.getPriceListOnDataRange(date, date);
    if(pricesOld.size()==0){
      Price price = new Price ();
      price.setPrice(priceValue);
      price.setStructure(typology.getStructure());
      price.setHotelId(typology.getStructure().getId());
      price.setCalendarDate(date);
      price.setTypology_id(typology.getId());
      typology.addPrice(price);
      typologyManager.add(typology);
    }

    }
View Full Code Here

 
  private void updatePrices(ArrayList<Price> prices, BigDecimal priceValue){
    int j=0;
    while(j< prices.size()){
      Price price=new Price();
      price.setStructure(prices.get(j).getStructure());
      price.setHotelId(prices.get(j).getHotelId());
      price.setPrice(priceValue);
      price.setId(prices.get(j).getId());
      price.setCalendarDate(prices.get(j).getCalendarDate());
      price.setTypology_id(prices.get(j).getTypology_id());
     
      priceManager.add(price);
      j++;
    }
  }
View Full Code Here

  }
 
  private void newPrices(BigDecimal priceValue, GregorianCalendar begin, Typology typology, int timeBooking,  GregorianCalendar date){
    ArrayList<Price> pricesOld=typology.getPriceListOnDataRange(begin, begin);
    if(pricesOld.size()==0){
    Price price = new Price ();
    price.setPrice(priceValue);
    price.setStructure(typology.getStructure());
    price.setHotelId(typology.getStructure().getId());
    price.setCalendarDate(begin);
    price.setTypology_id(typology.getId());
    typology.addPrice(price);
    typologyManager.add(typology);
    }
 
  for(int i=0; i<(timeBooking); i++){
    date=CalendarUtils.nexDay(date);
     pricesOld=typology.getPriceListOnDataRange(date, date);
    if(pricesOld.size()==0){
      Price price = new Price ();
      price.setPrice(priceValue);
      price.setStructure(typology.getStructure());
      price.setHotelId(typology.getStructure().getId());
      price.setCalendarDate(date);
      price.setTypology_id(typology.getId());
      typology.addPrice(price);
      typologyManager.add(typology);
    }

    }
View Full Code Here

TOP

Related Classes of it.hotel.model.price.Price

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.