コード例 #1
0
 public static Customer addOrdersFromDB(Customer c) {
   Customer newCustomer = new Customer(c.getID());
   List<Order> orders = orderDAO.retrieveOrders(c);
   for (Order o : orders) {
     newCustomer.addOrder(o);
   }
   return newCustomer;
 }
コード例 #2
0
 public static void addOrderToDB(Order o) {
   Customer customer = CustomerServiceImpl.getCustomer(o.getCustomerID());
   customer.setOrders(OrderServiceImpl.retrieveUnpaidOrders(customer));
   customer.addOrder(o);
   if (customer.getOrders().contains(o)) {
     orderDAO.addOrder(o);
     List<OrderItem> items = o.getItems();
     Inventory inventory = new Inventory(InventoryServiceImpl.getAllAvailableProductsInDB());
     for (OrderItem i : items) {
       Product product = ProductServiceImpl.getProduct(i.getItemSKUNumber());
       InventoryItem inventoryitem = InventoryServiceImpl.getInventoryItem(inventory, product);
       InventoryServiceImpl.deductFromInventory(inventory, inventoryitem, i.getQuantity());
     }
   }
 }
コード例 #3
0
 public static List<Order> retrieveUnpaidOrders(Customer customer) {
   List<Order> orders = orderDAO.retrieveUnpaidOrders(customer.getID());
   return orders;
 }
コード例 #4
0
 public List<Order> retrieveOrdersFromDB(Customer c) {
   return orderDAO.retrieveOrders(c);
 }
コード例 #5
0
 public static Order retrieveOrderFromDB(int orderNumber) {
   return orderDAO.retrieveOrder(orderNumber);
 }
コード例 #6
0
 public static void updateStatusOfOrderInDB(Order o) {
   orderDAO.payOrder(o);
 }
コード例 #7
0
 public static int getLastOrderNumber() {
   return orderDAO.getLastOrderNumber();
 }