Esempio n. 1
0
 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();
 }
Esempio n. 2
0
 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";
 }
Esempio n. 3
0
  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";
  }