public String productSave() throws Exception { // add new product information initServlet(); try { ClothesCheck model = clothesCheckService.getClothesCheckById(Integer.valueOf(checkid)); clothesProduct.setClothesCheck(model); clothesProductService.saveClothesProduct(clothesProduct); message = " 商品: [ " + clothesProduct.getProductName() + " ] 新增成功! "; if (clothesProduct != null) clothesProduct = null; } catch (Exception e) { e.printStackTrace(); } return productList(); }
public String modifyProduct() throws Exception { // modify information initServlet(); try { clothesProducts = clothesProductService.getAllClothesProduct(); ClothesCheck check = clothesCheckService.getClothesCheckById(Integer.valueOf(checkid)); clothesProduct.setClothesCheck(check); clothesProductService.updateClothesProduct(clothesProduct); clothesProducts = clothesProductService.getAllClothesProduct(); message = "商品資料已經修改。"; if (clothesProduct != null) clothesProduct = null; } catch (Exception e) { e.printStackTrace(); } return "productedit"; }