public void completeOrder(int orderNumber)
 {
     OrderDAO datalayer = new OrderDAO();
     this.order = getOrder(orderNumber);
     datalayer.completeOrder(orderNumber);
     updateInventory();
 }
 public Order getOrder(int orderId)
 {
     OrderDAO dataLayer = new OrderDAO();
     Order singleOrder = dataLayer.getSingleOrder(orderId);
     this.order = singleOrder;
     return singleOrder;
 }
 public List<OrderId> getAllInvalidOrders()
 {
     OrderDAO datalayer = new OrderDAO();
     List<OrderId> orderNumbers = datalayer.getAllInvalidOrders();
     return orderNumbers;
 }
 public void validateOrder(int orderNumber)
 {
     OrderDAO datalayer = new OrderDAO();
     datalayer.validateOrder(orderNumber);
 }
        public int submitOrder()
        {
            int orderNumber = -1;
            if (paymentInformation != null && orderItems.Count() >= 1)
            {
                order.setPaymentInformation(paymentInformation);
                order.setOrderItems(orderItems);

                double orderTotal = getTotalOrderCost();

                if (isCollectOnDelivery)
                {
                    if (paymentAmount >= (Math.Round((orderTotal *.1), 2, MidpointRounding.AwayFromZero)))
                    {
                        order.setPaymentAmount(paymentAmount);
                        order.setIsCollctOnDelivery(isCollectOnDelivery);
                        OrderDAO datalayer = new OrderDAO();
                        orderNumber = datalayer.createOrder(order);
                    }
                    else
                    {
                        return orderNumber;
                    }
                }
                else if (paymentAmount == Math.Round(getTotalOrderCost(), 2, MidpointRounding.AwayFromZero))
                {
                    order.setPaymentAmount(paymentAmount);
                    order.setIsCollctOnDelivery(isCollectOnDelivery);
                    OrderDAO datalayer = new OrderDAO();
                    orderNumber = datalayer.createOrder(order);
                }

            }
            updateInventory(inventoryItems);
            return orderNumber;
        }
        public List<UserOrder> getUserOrders(string userName)
        {
            OrderDAO dataLayer = new OrderDAO();
            List<Order> orders = dataLayer.getUserOrders(userName);
            List<UserOrder> userOrders = new List<UserOrder>();

            foreach (Order order in orders)
            {
                UserOrder userOrder = new UserOrder();
                userOrder.orderId = order.getOrderId();
                userOrder.orderTotal = getOrderTotal(order);

                userOrder.orderItems = getUserOrderItems(order);
                userOrder.paymentAmount = order.getPaymentAmount();
                userOrder.creditCardNumber = order.getPaymentInformation().getCreditCardNumber();
                userOrders.Add(userOrder);
            }

            return userOrders;
        }