private void dgHangar_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            ServiceAirNautis.Hangar selected        = dgHangar.SelectedItem as ServiceAirNautis.Hangar;
            Hangar_airplanes        hangar_airplane = new Hangar_airplanes(selected.Number);

            hangar_airplane.ShowDialog();
        }
        public void Fill_Information(int hangar_number)
        {
            selected_hangar = airNautisService.GetHangar(hangar_number);


            txtBoxCapacity.Text = selected_hangar.Capacity.ToString();
            txtBoxCurrent.Text  = airNautisService.GetAirplanesByHangar(hangar_number).Count().ToString();

            // Non editable TextBox
            txtBoxCapacity.IsReadOnly = true;
            txtBoxCurrent.IsReadOnly  = true;

            dgHangarAirplane.ItemsSource = airNautisService.GetAirplanesByHangar(hangar_number);
        }
Beispiel #3
0
        private void btnCreateHangar_Click(object sender, RoutedEventArgs e)
        {
            airNautisService = new ServiceAirNautis.AirNautisServiceClient();
            ServiceAirNautis.Hangar hangar = new ServiceAirNautis.Hangar();

            if (!String.IsNullOrEmpty(txtBoxHangarCapacity.Text))
            {
                int capacity_value;

                if (int.TryParse(txtBoxHangarCapacity.Text, out capacity_value))
                {
                    if (capacity_value > 0)
                    {
                        hangar.Capacity = capacity_value;
                        if (airNautisService.CreateHangar(hangar))
                        {
                            MessageBox.Show(string.Format("Hangar successfully created with {0} capacity!", capacity_value), "Success", MessageBoxButton.OK);
                            DialogResult = true;
                        }
                        else
                        {
                            MessageBox.Show("Sorry, please verify fields", "Error", MessageBoxButton.OK);
                        }
                    }
                    else
                    {
                        MessageBox.Show("The capacity value needs to be greater than zero", "Alert", MessageBoxButton.OK);
                        txtBoxHangarCapacity.Text = "";
                        txtBoxHangarCapacity.Focus();
                    }
                }
                else
                {
                    MessageBox.Show("Value of the field Capacity needs to be a number", "Error", MessageBoxButton.OK);
                }
            }
        }