public String deleteProduct() throws Exception { // delete product information try { initServlet(); ClothesProduct product = clothesProductService.getClothesProductById(productId); clothesProductService.deleteClothesProduct(product); message = "商品: [ " + product.getProductName() + " ] 已經刪除。"; if (clothesProduct != null) clothesProduct = null; clothesProducts = clothesProductService.getAllClothesProduct(); } catch (Exception e) { message = "無法刪除,此商品正在被選取中。"; e.printStackTrace(); } return "productdelete"; }
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"; }
public String detailProduct() throws Exception { // link to admin_edit.jsp initServlet(); try { clothesProduct = clothesProductService.getClothesProductById(productId); resultPage = "detailProduct"; } catch (Exception e) { e.printStackTrace(); } return resultPage; }
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 jumpproductedit() { clothesProduct = clothesProductService.getClothesProductById(productId); clothesChecks = clothesCheckService.getAllClothesCheck(); return "changeproductedit"; }
// 超連結-跳到adminproduct public String jumpadminProduct() throws Exception { clothesProducts = clothesProductService.getAllClothesProduct(); System.out.println("start jumpadminProduct.."); return "adminProduct"; }
public String productList() { clothesProducts = clothesProductService.getAllClothesProduct(); return "success"; }
public String jumpproductdelete() { clothesProduct = clothesProductService.getClothesProductById(productId); return "changeproductdelete"; }