Example #1
0
        private void btnOrderCart_Click(object sender, EventArgs e)
        {
            activeCustomer.Orders.Add(firstOrder);
            OrderDetail orderDetail = new OrderDetail();

            foreach (var item in firstOrder.Cart.LineItems)
            {
                orderDetail.Loss   += item.Product.Cost * item.Quantity;
                orderDetail.Profit += item.Price;
            }
            ODA.AddItem(activeCustomer.Orders.ElementAt(activeCustomer.Orders.Count - 1));
            orderDetail.OrderID = activeCustomer.Orders.ElementAt(activeCustomer.Orders.Count - 1).OrderID;
            DetailDA.AddItem(orderDetail);
            firstOrder            = null;
            firstOrder            = new Order();
            firstOrder.Customer   = activeCustomer;
            firstOrder.CustomerID = activeCustomer.CustomerID;
            firstOrder.OrderState = Order.OrderStatus.Open;
            btnResetCart_Click(this, null);
        }