public Checkout_Categorised(Database Database, string Category)
        {
            OldDB           = Database;
            DB              = Database;
            CurrentCheckout = DB.GetCurrentCheckout();
            InitializeComponent();
            Label.Content = Category;

            if (Category == "Custom Orders")
            {
                List <CustomOrder> CustomOrders = new List <CustomOrder>();
                foreach (CustomOrder custOrder in DB.GetListOfCustomOrders())
                {
                    if (!custOrder.getIsPaid() && custOrder.getActiveOrder())
                    {
                        CustomOrders.Add(custOrder);
                    }
                }
                listBoxItems.ItemsSource = CustomOrders;
            }
            else
            {
                List <Product> RawProducts = DB.GetListOfProducts();
                List <Product> Products    = new List <Product>();
                foreach (Product Product in RawProducts)
                {
                    if (Product.GetItemType() == Category)
                    {
                        Products.Add(Product);
                    }
                }
                listBoxItems.ItemsSource = Products;
            }

            listBoxCheckout.ItemsSource = CurrentCheckout.GetCollection();
            UpdateTotal();
        }
예제 #2
0
 public void ClearCheckout()
 {
     currentTransaction = new Checkout();
 }