Example #1
0
        public void UpdateOrderedProducts(object sender, BakeryEventArgs args)
        {
            var orderedProduct = args.OrderedBakeryProduct;

            orderedProduct.AlwaysTrue = true;
            OrderedProducts.Add(orderedProduct);
            RaisePropertyChanged("OrderedProducts");
        }
Example #2
0
        private void RefreshProducts(ICollection <Product> products)
        {
            OrderedProducts.Clear();

            foreach (var item in products)
            {
                OrderedProducts.Add(item);
            }
        }
Example #3
0
        private void AddProduct(int i)
        {
            ClickedProduct = (from p in Products where p.Id == i select p).First();
            try
            {
                OrderedProducts.Add(ClickedProduct);

                TotalPrice            += ClickedProduct.Price;
                DifferenceTotalBalance = ScannedCustomer.Balance - TotalPrice;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            switch (state)
            {
            case 0:
                SelectedProducts = new ObservableCollection <Product>();
                foreach (var products in DataHolder.Products)
                {
                    if (products.Category == ((Product)((Button)sender).DataContext).Category)    //
                    {
                        SelectedProducts.Add(products);
                    }
                }
                ProductsMenuBack.IsEnabled = true;
                ProductsMenu.ItemsSource   = SelectedProducts;
                state++;
                break;

            case 1:
                ProductsMenu.ItemsSource   = Categories;
                ProductsMenuBack.IsEnabled = false;
                var prod  = (Product)((Button)sender).DataContext;
                var query = OrderedProducts.FirstOrDefault(op => op.Product == prod);
                if (query != null)
                {
                    query.Quantity++;
                }
                else
                {
                    OrderedProducts.Add(new OrderedProduct()
                    {
                        Product  = prod,
                        Quantity = 1,
                        Sliced   = false,
                        Slicable = prod.Category == "Pain" ? true : false
                    });
                }
                state--;
                break;
            }
        }