Examples of AreaCategory


Examples of com.lgx8.gateway.entities.AreaCategory

        product.setOnsale(1);
      } else {
        product.setOnsale(0);
      }
     
      AreaCategory areaCategory = null;
      try {
        areaCategory = gatewayService.findAreaCategory(new Long(areaCategoryId));
      } catch (Exception e) {
        areaCategory = null;
      }
      if(areaCategory!=null) {
        product.setAreaCategory(areaCategory);
      } else {
        out.print("({'result':'0','msg':'请选择商品分区!'})");
        out.flush();
        return;
      }
     
      Category category = null;
      try {
        category = gatewayService.findCategory(new Long(categoryId));
      } catch (Exception e) {
        category = null;
      }
      if(category!=null) {
        product.setCategory(category);
      } else {
        out.print("({'result':'0','msg':'请选择商品类型!'})");
        out.flush();
        return;
      }
     
      product.setDescription(description);
      product.setFarewaydesc(farewaydesc);
      product.setSaledesc(saledesc);
     
      if(colors!=null) {
        String color = "";
        for(int i=0;i<colors.length;i++) {
          if(i!=colors.length-1) {
            color = color+colors[i]+";";
          } else {
            color = color+colors[i];
          }
        }
        product.setColor(color);
      }
     
      if(colthesizes!=null) {
        String clothessize = "";
        for(int i=0;i<colthesizes.length;i++) {
          if(i!=colthesizes.length-1) {
            clothessize = clothessize+colthesizes[i]+";";
          } else {
            clothessize = clothessize+colthesizes[i];
          }
        }
        product.setClothessize(clothessize);
      }
     
      if(shoesizes!=null) {
        String shoesize = "";
        for(int i=0;i<shoesizes.length;i++) {
          if(i!=shoesizes.length-1) {
            shoesize = shoesize+shoesizes[i]+";";
          } else {
            shoesize = shoesize+shoesizes[i];
          }
        }
        product.setShoesize(shoesize);
      }
     
      if(fareways!=null) {
        String fareway = "";
        for(int i=0;i<fareways.length;i++) {
          if(i!=fareways.length-1) {
            fareway = fareway+fareways[i]+";";
          } else {
            fareway = fareway+fareways[i];
          }
        }
        product.setFareway(fareway);
      } else {
        out.print("({'result':'0','msg':'请选择商品运费支付方式!'})");
        out.flush();
        return;
      }
     
      product.setCreatedate(new Date());
     
      gatewayService.createProduct(product);
     
      out.print("({'result':'1','msg':'成功添加商品!'})");
      out.flush();
      return;
     
    } else if("3".equals(operation)) {
      String id = request.getParameter("id");
     
      long lid = -1;
      try {
        lid = Long.parseLong(id);
      } catch (Exception e) {
        lid = -1;
      }
      ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
      IGatewayService gatewayService = (IGatewayService) ac.getBean("gatewayService");
     
      gatewayService.deleteProduct(lid);
     
      request.getRequestDispatcher("page/gateway/admin/product/ProductList.jsp").forward(request, response);
    } else if("2".equals(operation)) {
      String id = request.getParameter("id");
     
      long lid = -1;
      try {
        lid = Long.parseLong(id);
      } catch (Exception e) {
        lid = -1;
      }
      ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
      IGatewayService gatewayService = (IGatewayService) ac.getBean("gatewayService");
     
      Product product = gatewayService.findProductById(lid);
      if(product==null) {
        out.print("({'result':'0','msg':'修改的商品信息不存在!'})");
        out.flush();
        return;
      }
      String name = request.getParameter("name");
      String areaNode = request.getParameter("areaNode");
      String weight = request.getParameter("weight");
      String productImageId = request.getParameter("productImageId");
      String price = request.getParameter("price");
      String amount = request.getParameter("amount");
      String leaves = request.getParameter("leaves");
      String brandId = request.getParameter("brandId");
      String onsale = request.getParameter("onsale");
      String areaCategoryId = request.getParameter("areaCategoryId");
      String categoryId = request.getParameter("categoryId");
      String[] colors = request.getParameterValues("color");
      String[] colthesizes = request.getParameterValues("colthesize");
      String[] shoesizes = request.getParameterValues("shoesize");
      String[] fareways = request.getParameterValues("fareway");
      String description = request.getParameter("description");
      String farewaydesc = request.getParameter("farewaydesc");
      String saledesc = request.getParameter("saledesc");
      String code = request.getParameter("code");
     
      product.setName(name);
      product.setAreaNode(areaNode);
      product.setWeight(Double.parseDouble(weight));
      product.setCode(code);
     
      long imageid = -1;
      try {
        imageid = Long.parseLong(productImageId);
      } catch (Exception e) {
        imageid = -1;
        out.print("({'result':'0','msg':'请上传商品图片!'})");
        out.flush();
        return;
      }
      ProductImage image = gatewayService.findProductImage(imageid);
      if(image!=null) {
        product.setImage(image);
      } else {
        out.print("({'result':'0','msg':'未找到商品图片!'})");
        out.flush();
        return;
      }
       
     
      long lbrandid = -1;
      try {
        lbrandid = Long.parseLong(brandId);
      } catch (Exception e) {
        lbrandid = -1;
        out.print("({'result':'0','msg':'请选择商品品牌!'})");
        out.flush();
        return;
      }
      Brand brand = gatewayService.findBrandById(lbrandid);
      if(brand!=null) {
        product.setBrand(brand);
      } else {
        out.print("({'result':'0','msg':'未找到商品品牌!'})");
        out.flush();
        return;
      }
     
      double pprice = 0;
      try {
        pprice = new Double(price);
      } catch (Exception e) {
        pprice = 0;
      }
      if(pprice<=0) {
        out.print("({'result':'0','msg':'请正确添加价格!'})");
        out.flush();
        return;
      }
      product.setPrice(pprice);
     
      int pleaves = 0;
      try {
        pleaves = new Integer(leaves);
      } catch (Exception e) {
        pleaves = 0;
      }
      if(pleaves<0) {
        out.print("({'result':'0','msg':'请正确填写库存!'})");
        out.flush();
        return;
      }
      product.setLeaves(pleaves);
     
      int pamount = 0;
      try {
        pamount = new Integer(amount);
      } catch (Exception e) {
        pamount = 0;
      }
      if(pamount<=0) {
        out.print("({'result':'0','msg':'请正确填写总量!'})");
        out.flush();
        return;
      }
      product.setAmount(pamount);
     
      if("1".equals(onsale)) {
        product.setOnsale(1);
      } else {
        product.setOnsale(0);
      }
     
      AreaCategory areaCategory = null;
      try {
        areaCategory = gatewayService.findAreaCategory(new Long(areaCategoryId));
      } catch (Exception e) {
        areaCategory = null;
      }
View Full Code Here

Examples of com.lgx8.gateway.entities.AreaCategory

    } else {
      product.setOnsale(0);
    }
   
    String areaCategoryId = request.getParameter("areaCategoryId");
    AreaCategory areaCategory = null;
    try {
      areaCategory = gatewayService.findAreaCategory(new Long(areaCategoryId));
    } catch (Exception e) {
      areaCategory = null;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.