public void addCartexDesign() { CartexDesign cartexDesign = CartexDesignService.getCartexDesignByUserId(user.getId()); if (cartexDesign != null) { cartexDesign.setInformation(getInformation()); cartexDesign.setFileNumber(getFileNumber()); cartexDesign.setEconomicCode(getEconomicCode()); cartexDesign.setCity(getCity()); cartexDesign.setName1(getName1()); cartexDesign.setTitle1(getTitle1()); cartexDesign.setName2(getName2()); cartexDesign.setTitle2(getTitle2()); CartexDesignService.editCartexDesign(cartexDesign); } else { CartexDesignService.addCartexDesign( user.getId(), getInformation(), getFileNumber(), getEconomicCode(), getCity(), getName1(), getTitle1(), getName2(), getTitle2(), null); } addMessage(FacesMessage.SEVERITY_INFO, LanguageUtil.get("cartex_design_added_successfully")); }
public void uploadFile(FileUploadEvent event) throws IOException { CartexDesign cartexDesign = CartexDesignService.getCartexDesignByUserId(user.getId()); if (cartexDesign != null) { cartexDesign.setImage(IOUtils.toByteArray(event.getFile().getInputstream())); CartexDesignService.editCartexDesign(cartexDesign); } else { CartexDesignService.addCartexDesign( user.getId(), "", "", "", "", "", "", "", "", IOUtils.toByteArray(event.getFile().getInputstream())); } init(); }
private void init() { cartexDesign = CartexDesignService.getCartexDesignByUserId(user.getId()); if (cartexDesign != null) { setInformation(cartexDesign.getInformation()); setFileNumber(cartexDesign.getFileNumber()); setEconomicCode(cartexDesign.getEconomicCode()); setCity(cartexDesign.getCity()); setName1(cartexDesign.getName1()); setTitle1(cartexDesign.getTitle1()); setName2(cartexDesign.getName2()); setTitle2(cartexDesign.getTitle2()); } }