Пример #1
0
        private void btnSetupCrew_Click(object sender, RoutedEventArgs e)
        {
            if (currentFlight != null)
            {
                try
                {
                    if (currentFlight.Schedule.Date + currentFlight.Schedule.Time < DateTime.Now)
                    {
                        MessageBox.Show("This flight cannot be changed because it took off!", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                        return;
                    }

                    ChooseCrewWindow setUpCrewWindow = new ChooseCrewWindow();
                    setUpCrewWindow.Flight = currentFlight;
                    setUpCrewWindow.ShowDialog();
                    currentFlight = null;
                }
                catch (Exception)
                {
                }
            }
            else
            {
                MessageBox.Show("Please choose a flight!", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Пример #2
0
 private void btnSetupCrew_Click(object sender, RoutedEventArgs e)
 {
     if (currentFlight != null)
     {
         if ((currentFlight.Schedule.Date + currentFlight.Schedule.Time) < DateTime.Now)
         {
             MessageBox.Show("This flight cannot be changed because it was took off", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
         }
         else
         {
             if (currentFlight.Schedule.CrewId != null)
             {
                 if (MessageBox.Show("This flight was set up the crew. Do you want to change crew for it?", "Message", MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.OK)
                 {
                     ChooseCrewWindow chooseCrewWindow = new ChooseCrewWindow();
                     chooseCrewWindow.Flight       = currentFlight;
                     chooseCrewWindow.ManageWindow = this;
                     chooseCrewWindow.ShowDialog();
                 }
             }
             else
             {
                 ChooseCrewWindow chooseCrewWindow = new ChooseCrewWindow();
                 chooseCrewWindow.Flight       = currentFlight;
                 chooseCrewWindow.ManageWindow = this;
                 chooseCrewWindow.ShowDialog();
             }
         }
     }
     else
     {
         MessageBox.Show("Please choose a flight", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }