private void ProductShowButton_Click(object sender, RoutedEventArgs e)
        {
            if (OrderListBox.SelectedItem != null)
            {
                Order  selectedOrder = new Order();
                string s             = OrderListBox.SelectedItem.ToString();
                if (orders.Count != 0)
                {
                    foreach (Order o in orders)
                    {
                        if (o.compareTo(s))
                        {
                            selectedOrder = o;
                        }
                    }
                }

                //id = int.Parse(OrderListBox.SelectedItem.ToString().Substring(0, 1));
                products = SQLiteDataAccess.GetProductsByOrderID(selectedOrder.Order_ID);
                ProductListBox.ItemsSource = products;

                double amount = 0.0;
                foreach (Product p in products)
                {
                    amount += p.Product_Price;
                }
                productTotalBlock.Text = "$" + amount;
            }
        }
        public void setTotalDue()
        {
            double amount = 0.0;

            foreach (Order o in orders)
            {
                List <Product> prods = SQLiteDataAccess.GetProductsByOrderID(o.Order_ID);
                foreach (Product p in prods)
                {
                    amount += p.Product_Price;
                }
            }

            totalBlock.Text = "$" + amount;
        }
Esempio n. 3
0
 public void setItems()
 {
     items = SQLiteDataAccess.GetProductsByOrderID(Order_ID);
 }