Exemplo n.º 1
0
  /**
   * get completed order
   *
   * @param orderId
   * @return
   */
  @Override
  public LinkedList<Dish> getCompleteOrder(int orderId) {

    LinkedList<Dish> dishList = new LinkedList();

    LinkedList<Integer> dishIdList = selectAllByOrderId(orderId);
    ComponentDAO componentDao = DAOFactory.getFactory(DB_MYSQL).createComponentDAO();
    DishDAO dishDao = DAOFactory.getFactory(DB_MYSQL).createDishDAO();
    for (int i = 0; i < dishIdList.size(); i++) {
      dishList.add(
          dishDao.selectByID(dishIdList.get(i), componentDao.dishContent(dishIdList.get(i))));
    }

    return dishList;
  }
Exemplo n.º 2
0
  /**
   * fill the order dish list
   *
   * @param order
   * @return
   */
  @Override
  public LinkedList<Dish> fillOrderDishList(LinkedList<Integer> order) {
    DishDAO dishDao = DAOFactory.getFactory(DB_MYSQL).createDishDAO();
    LinkedList<Dish> orderDishList = new LinkedList();
    for (int i = 0; i < order.size(); i++) {
      orderDishList.add(dishDao.selectByID(order.get(i), null));
    }

    return orderDishList;
  }
 /**
  * confirm orders
  *
  * @param request
  * @param response
  */
 private synchronized void confirmOrders(
     HttpServletRequest request, HttpServletResponse response) {
   if (!Boolean.parseBoolean(request.getParameter(REQUEST_SUBMIT_ORDERS.toString()))) {
     Logger.getLogger(OrderTableCommand.class.getName())
         .info(
             REQUEST_SUBMIT_ORDERS.toString()
                 + request.getParameter(REQUEST_SUBMIT_ORDERS.toString()));
     return;
   }
   for (int i = 0; i < list.size(); i++) {
     Logger.getLogger(OrderTableCommand.class.getName()).info(REQUEST_SUBMIT_ORDERS.toString());
     String str =
         MYSQL_ORDER_ID.toString()
             + list.get(i).getOrderId()
             + MYSQL_USER_ID.toString()
             + list.get(i).getUserId();
     OrderDAO orderDao = DAOFactory.getFactory(DB_MYSQL).createOrderDAO();
     Logger.getLogger(OrderTableCommand.class.getName()).info(str + request.getParameter(str));
     if (Boolean.parseBoolean(request.getParameter(str))) {
       orderDao.confirmOrder(list.get(i).getOrderId());
     }
   }
 }
  private double getSumm() {
    OrderDAO orderDao = DAOFactory.getFactory(DB_MYSQL).createOrderDAO();

    return orderDao.getSumm();
  }
  /** fill orders for admin table */
  private void fillOrders() {
    OrderDAO orderDao = DAOFactory.getFactory(DB_MYSQL).createOrderDAO();

    list = orderDao.selectAllForOrderTable();
  }