Ejemplo n.º 1
0
  public void saveSelected() {

    if (getCurrent().getId() != null && getCurrent().getId() > 0) {

      getFacade().edit(current);

      UtilityController.addSuccessMessage("savedOldSuccessfully");
    } else {
      current.setCreatedAt(Calendar.getInstance(TimeZone.getTimeZone("IST")).getTime());
      current.setCreater(getSessionController().getLoggedUser());
      getFacade().create(current);
      UtilityController.addSuccessMessage("savedNewSuccessfully");
    }
    recreateModel();
    getItems();
  }
Ejemplo n.º 2
0
  public void addToPackage() {
    if (getCurrentPackege() == null) {
      UtilityController.addErrorMessage("Please select a package");
      return;
    }
    if (getCurrentItem() == null) {
      UtilityController.addErrorMessage("Please select an item");
      return;
    }
    PackageItem pi = new PackageItem();

    pi.setPackege(getCurrentPackege());
    pi.setItem(getCurrentItem());
    pi.setCreatedAt(Calendar.getInstance(TimeZone.getTimeZone("IST")).getTime());
    pi.setCreater(sessionController.loggedUser);
    getFacade().create(pi);
    UtilityController.addSuccessMessage("Added");
    recreateModel();
  }