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();
        }
예제 #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();
        }
예제 #3
0
        public void LoadCustomerList()
        {
            products = SQLiteDataAccess.LoadProducts();

            WireUpProductList(products);
        }
예제 #4
0
 public void Refresh()
 {
     products = SQLiteDataAccess.LoadProducts();
     LoadCustomerList();
     setTextBlank();
 }
예제 #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);
        }
예제 #6
0
 public void setItems()
 {
     items = SQLiteDataAccess.GetProductsByOrderID(Order_ID);
 }
예제 #7
0
 public void LoadProductsList()
 {
     products = SQLiteDataAccess.LoadProducts();
     productsList.ItemsSource = products;
 }
 public void LoadOrderList()
 {
     orders = SQLiteDataAccess.GetOrderHistoryById(cust.Customer_ID);
     WireUpOrderList(orders);
 }