Exemplo n.º 1
0
        private void AllOrders(object sender, RoutedEventArgs e)
        {
            var allOrder = new AllOrderWindow();

            allOrder.Show();
            Close();
        }
Exemplo n.º 2
0
        private void SaveAll()
        {
            string address = txtAddress.Text;
            int    index   = cbxStatus.SelectedIndex;

            if (orderDateTimePicker.SelectedDate == null)
            {
                MessageBox.Show("Please select order date");
                return;
            }
            if (txtAddress.Text.Equals("Delivery Address"))
            {
                MessageBox.Show("Please insert address");
                return;
            }
            if (index == -1)
            {
                MessageBox.Show("Please select order status");
                return;
            }
            if (Controller.ControllerInstance.currentOrderItems.Count < 1)
            {
                MessageBox.Show("There are no items in order");
                return;
            }

            DateTime orderDate = (DateTime)orderDateTimePicker.SelectedDate;

            Controller.ControllerInstance.InserOrder(new Order(orderDate, address, statusList[index]));

            if (Controller.ControllerInstance.editable)
            {
                Controller.ControllerInstance.editable = false;
                MessageBox.Show("Order Updated");
            }
            else
            {
                MessageBox.Show("Order Saved");
            }

            AllOrderWindow allOrderWindow = new AllOrderWindow();

            allOrderWindow.Show();
            this.Close();
        }