Package it.hotel.model.typology

Examples of it.hotel.model.typology.Typology


    currentPrice= new HashMap<Typology,  ArrayList<Price>>();
    int size = roomsToSelect.size();
   

    for(Map.Entry<Typology, List<Room> > valore: roomsToSelect.entrySet() ){
      Typology key= (Typology) valore.getKey();
      ArrayList<Price> price=null;
   
       
      price=key.getPriceListOnDataRange(startDate, endDate);
         price=orderPrice(price,startDate);
        currentPrice.put(key, price);
    }
   
 
View Full Code Here


   */
  @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());
View Full Code Here

   * @param resp
   * @return
   */
  public ModelAndView list (HttpServletRequest req, HttpServletResponse resp){
    Map allPrices = new HashMap();
    Typology typology=null;
    IUser user = userContainer.getUser();
    ArrayList<Typology> listTypology = (ArrayList<Typology>)typologyManager.getTypologiesFromStructure(user.getStructureId());
    for(int i=0;i<listTypology.size(); i++){
      if(listTypology.get(i).getBeds()==0){
      listTypology.remove(i);
View Full Code Here

  @Override
  protected void doSubmitAction (Object command){
    PriceListDTO priceListDTO = (PriceListDTO)command;
    int id = priceListDTO.getTypologyId();
   
    Typology typology = (Typology)typologyManager.get(id);
   
    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());
    String endDate=priceListDTO.getFinishDate();
   
    if(end==null){
      end=begin;
      endDate=priceListDTO.getDate();
     
    }
    int timeBooking=CalendarUtils.GetNumberOfDays(CalendarUtils.GetGregorianCalendar(priceListDTO.getDate()),CalendarUtils.GetGregorianCalendar(endDate));
   
    ArrayList<Price> prices= typology.getPriceListOnDataRange(begin, end);
   
    newPrices(priceValue,  begin,  typology,  timeBooking,   begin)
    updatePrices( prices, priceValue);
   
  }
View Full Code Here

import org.easymock.EasyMock;

public class TestPriceManager extends TestCase{
 
  public void testGetPricesOnDateRange() throws Exception {
    Typology typ= new Typology();
    typ.setId(1);
    GregorianCalendar startDate = null;
    GregorianCalendar endDate = null;
    Collection<Price> list= new ArrayList<Price>();
   
    IPriceDAO dao= EasyMock.createMock(IPriceDAO.class);
View Full Code Here

  }


  public void testEdit() throws Exception {
    req.addParameter("id", "1");  
    Typology typ= expectedTypologies.get(1);
    expect(priceManager.get(1)).andReturn(price);
    expect(typologyManager.get(typ.getId())).andReturn(typology);
    expect(typologyManager.getAll()).andReturn( expectedTypologies);

    replay(priceManager);
    replay(typologyManager);
    mvc =priceControllerDelegate.edit(req, resp);
View Full Code Here

    verify(typologyManager);

}
 
public void testPriceListEdit() throws Exception {
  Typology typ=expectedTypologies.get(1);
    listFormController.setSuccessView("hotel.price.list");
   
    expect(priceManager.get(1)).andReturn(price);
    expect(typologyManager.get(typ.getId())).andReturn(typology);
    expect(typologyManager.getAll()).andReturn(expectedTypologies);
    expect(structureManager.getAll()).andReturn(expectedHotels);
    expect(priceManager.add(price)).andReturn(true);
    req.setMethod("POST");
    req.setRequestURI("http://localhost:8080/hotel/priceList/edit.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");
    priceListDTO.setFinishDate("40/51/64");
    priceListDTO.setTypology(t1);
    priceListDTO.setPrice("noPrice")
View Full Code Here

  }



  private void setUpExpectedTypologies() {
    Typology t1=new Typology();
    t1.setId(1);
    t1.setHotelId(1);
    Typology t2=new Typology();
    t2.setId(2);
    t2.setHotelId(1);
    Typology t3=new Typology();
    t3.setId(3);
    t3.setHotelId(1);
    expectedTypologies.add(t1);
    expectedTypologies.add(t2);
    expectedTypologies.add(t3);
  }
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);
    room1 = new Room();
    room1.setTypology(t1);
    Hotel h1 = new Hotel();
    h1.setId(4);
    room1.setStructure(h1);
View Full Code Here

TOP

Related Classes of it.hotel.model.typology.Typology

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.