Beispiel #1
0
        private void InfoButton_Click(object sender, RoutedEventArgs e)
        {
            Customer searchedFor = new Customer();

            if (CustomerListBox.SelectedItem != null)
            {
                string s = CustomerListBox.SelectedItem.ToString();
                foreach (Customer customer in customers)
                {
                    if (customer.compareTo(s))
                    {
                        searchedFor = customer;
                        break;
                    }
                }

                CustomerInfoWindow customerInfoWindow = new CustomerInfoWindow(searchedFor);
                customerInfoWindow.Show();
                this.Close();
            }
        }
Beispiel #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();
        }