/**
* @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);
}
}