示例#1
0
        private void ExitButton_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = MessageBox.Show("Are you sure that you are finished?", "Exit", MessageBoxButton.YesNo, MessageBoxImage.Stop);

            switch (result)
            {
            case MessageBoxResult.Yes:
                this.Close();
                Window window = new OrderWindow();
                window.Show();
                break;

            case MessageBoxResult.No:

                break;
            }
        }
示例#2
0
        private void AddOrderButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                guestrequest = GuestrequestComboBox.SelectedValue as BE.GuestRequest;
                if (guestrequest == null)
                {
                    throw new NullReferenceException("please choose a guest request");
                }

                hostingunit = HostingUnitComboBox.SelectedValue as BE.HostingUnit;
                if (hostingunit == null)
                {
                    throw new NullReferenceException("please choose a hosting unit");
                }
                order.GuestRequestKey = guestrequest.GuestRequestKey;
                order.HostingUnitKey  = hostingunit.HostingUnitKey;
                this.DataContext      = order;

                bl.AddOrder(order.GuestRequestKey, order.HostingUnitKey);
                order = new BE.Order();
                MessageBoxResult result = MessageBox.Show("Thank You, your order has been added. Would you like to add another order?", "Status", MessageBoxButton.YesNo, MessageBoxImage.Information);
                switch (result)
                {
                case MessageBoxResult.Yes:
                    this.Close();
                    Window AddOrderWindow = new AddOrderWindow();
                    AddOrderWindow.Show();
                    break;

                case MessageBoxResult.No:
                    this.Close();
                    Window OrderWindow = new OrderWindow();
                    OrderWindow.Show();
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }