}
if(hasErrors()){
return INPUT;
}
DiscountSchema discountSchema;
if(getDiscountSchema().getId() == null || "".equalsIgnoreCase(getDiscountSchema().getId())){
discountSchema = new DiscountSchema();
logInfo = new LogInformation();
logInfo.setCreateBy(sessionCredentials.getCurrentUser().getId());
logInfo.setCreateDate(new Timestamp(System.currentTimeMillis()));
msg = "Successfully Add "+getDiscountSchema().getName();
} else {
discountSchema = (DiscountSchema) manager.getById(DiscountSchema.class, getDiscountSchema().getId());
logInfo = discountSchema.getLogInformation();
msg = "Successfully Edit "+getDiscountSchema().getName();
}
logInfo.setActiveFlag(getActive());
logInfo.setLastUpdateBy(sessionCredentials.getCurrentUser().getId());
logInfo.setLastUpdateDate(new Timestamp(System.currentTimeMillis()));
discountSchema.setLogInformation(logInfo);
discountSchema.setName(getDiscountSchema().getName());
discountSchema.setDescription(getDiscountSchema().getDescription());
discountSchema.setDiscountType(getDiscountSchema().getDiscountType());
discountSchema.setQuantityBased(getDiscountSchema().getQuantityBased());
discountSchema.setAccumulationLevel(getDiscountSchema().getAccumulationLevel());
manager.save(discountSchema);
setDiscountSchema(getDiscountSchema());
return SUCCESS;