Package oss.ngocminh.lego.data

Examples of oss.ngocminh.lego.data.EntityImpl


      List<Entity> orders = (List<Entity>) req.getSession().getAttribute("orders");
      if (orders == null) {
        orders = new LinkedList<Entity>();
        req.getSession().setAttribute("orders", orders);
      }
      Entity order = new EntityImpl();
      order.put("product_id", productId);
      order.put("product", product);
      order.put("quantity", quantity);
      addOrMerge(orders, order);
     
      redirect("cart_view", resp);
    } catch (SQLException e) {
      throw new ServletException(e);
View Full Code Here


   */
  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    try {
      Connection conn = getConnection();
      categoryDAO.setConnection(conn);
      Entity category = new EntityImpl();
      category.put("name", request.getParameter("name"));
      category.put("image", request.getParameter("image"));
      categoryDAO.save(category);
      conn.close();
     
      String message = "Tạo thành công chủ đề " + category.get("name");
      redirect("cat_manage?message=" + URLEncoder.encode(message, "UTF-8"), response);
    } catch (SQLException e) {
      throw new ServletException(e);
    }
  }
View Full Code Here

  public void save(Invoice invoice) throws SQLException {
    invoice.put("user_id", invoice.getUser().getId());
    save("Invoice", invoice);
    for (Entity order : invoice.getOrders()) {
      EntityImpl invoiceOrder = new EntityImpl();
      invoiceOrder.put("invoice_id", invoice.getId());
      invoiceOrder.put("order_id", order.getId());
      save("InvoiceOrder", invoiceOrder);
    }
  }
View Full Code Here

    if (!error.isEmpty()) {
      renderView(request, response);
      return;
    }

    Entity product = new EntityImpl();
    product.put("name", name);
    product.put("imageCollection", request.getParameter("imageCollection"));
    product.put("description", description);
    product.put("quantity", quantity);
    product.put("price", price);
    product.put("discount", discount);
    product.put("type", type);
    product.put("category", category);
    try {
      Connection conn = getConnection();
      conn.setAutoCommit(false);
      productDAO.setConnection(conn);
      imageCollectionDAO.setConnection(conn);
      imageDAO.setConnection(conn);

      Entity imageCollection = new EntityImpl();
      imageCollectionDAO.save(imageCollection);
      for (Entity image : images) {
        image.put("collection", imageCollection.get("id"));
        imageDAO.save(image);
      }
      product.put("imageCollection", imageCollection.get("id"));
      productDAO.save(product);

      conn.commit();
      conn.close();
View Full Code Here

    List<Entity> images = new LinkedList<Entity>();
    int imageCount = Integer.parseInt(request.getParameter("imageCount"));
    for (int i = 1; i <= imageCount; i++) {
      String fileName = request.getParameter("image" + i);
      if (!StringUtils.isEmpty(fileName)) {
        Entity image = new EntityImpl();
        image.put("fileName", fileName);
        images.add(image);
      }
    }
    return images;
  }
View Full Code Here

TOP

Related Classes of oss.ngocminh.lego.data.EntityImpl

Copyright © 2018 www.massapicom. 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.