private void DeleteOrderButton_Click(object sender, RoutedEventArgs e)
        {
            string s     = OrderListBox.SelectedItem.ToString();
            Order  order = new Order();

            foreach (Order o in orders)
            {
                if (o.compareTo(s))
                {
                    order = o;
                }
            }

            SQLiteDataAccess.deleteOrder(order.Order_ID);
            SQLiteDataAccess.deleteOrderDetailsByOrderID(order.Order_ID);

            LoadAll();
        }
Exemplo n.º 2
0
        private void FinishOrder_Button_Click(object sender, RoutedEventArgs e)
        {
            List <Order> allOrders = SQLiteDataAccess.LoadOrders();
            int          i         = 1;

            /*
             * if(allOrders.Count != 0)
             * {
             *  i = allOrders.Last().Order_ID + 1;
             * }
             */

            Order finishedOrder = new Order(i, customer.Customer_ID, System.DateTime.Today.ToString());

            SQLiteDataAccess.SaveOrder(finishedOrder);

            allOrders = SQLiteDataAccess.LoadOrders();
            OrderDetails od = new OrderDetails();

            od.Order_ID   = allOrders.Last().Order_ID;
            finishedOrder = allOrders.Last();

            foreach (Product p in newOrder)
            {
                od.Product_ID    = p.Product_ID;
                od.Product_Price = p.Product_Price;

                SQLiteDataAccess.SaveOrderDetails(od);
            }

            EmailManager emailManager = new EmailManager(customer, finishedOrder);

            emailManager.SendEmail();

            CustomerInfoWindow customerInfoWindow = new CustomerInfoWindow(customer);

            customerInfoWindow.Show();
            this.Close();
        }
Exemplo n.º 3
0
        public void LoadCustomerList()
        {
            products = SQLiteDataAccess.LoadProducts();

            WireUpProductList(products);
        }
Exemplo n.º 4
0
 public void Refresh()
 {
     products = SQLiteDataAccess.LoadProducts();
     LoadCustomerList();
     setTextBlank();
 }
Exemplo n.º 5
0
        /// <summary>
        /// gets all customers from db and displays them in
        /// CustomerListBox using WireUpPeopleList method
        /// </summary>
        public void LoadCustomerList()
        {
            customers = SQLiteDataAccess.LoadCustomers();

            WireUpPeopleList(customers);
        }
Exemplo n.º 6
0
 public void setItems()
 {
     items = SQLiteDataAccess.GetProductsByOrderID(Order_ID);
 }
Exemplo n.º 7
0
 public void LoadProductsList()
 {
     products = SQLiteDataAccess.LoadProducts();
     productsList.ItemsSource = products;
 }
 public void LoadOrderList()
 {
     orders = SQLiteDataAccess.GetOrderHistoryById(cust.Customer_ID);
     WireUpOrderList(orders);
 }