コード例 #1
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);
                }
            }
        }
コード例 #2
0
        private void Window_Loaded_1(object sender, RoutedEventArgs e)
        {
            airNautisService = new ServiceAirNautis.AirNautisServiceClient();

            this.Populate_DataGrid();
        }
コード例 #3
0
 public Display_Details()
 {
     InitializeComponent();
     airNautisService = new ServiceAirNautis.AirNautisServiceClient();
     fill_ComboBox();
 }
コード例 #4
0
 public Deactivate_Airplane()
 {
     InitializeComponent();
     airNautisService = new ServiceAirNautis.AirNautisServiceClient();
     fill_ComboBox();
 }
コード例 #5
0
 public New_InTravel()
 {
     airNautisService = new ServiceAirNautis.AirNautisServiceClient();
     InitializeComponent();
     fill_ComboBox();
 }
コード例 #6
0
 public Full_Details(int airplane_id)
 {
     airNautisService = new ServiceAirNautis.AirNautisServiceClient();
     InitializeComponent();
     Fill_Information(airplane_id);
 }
コード例 #7
0
 public Hangar_airplanes(int hangar_number)
 {
     airNautisService = new ServiceAirNautis.AirNautisServiceClient();
     InitializeComponent();
     Fill_Information(hangar_number);
 }
コード例 #8
0
 public Details_Hangar()
 {
     airNautisService = new ServiceAirNautis.AirNautisServiceClient();
     InitializeComponent();
     Populate_Hangar();
 }
コード例 #9
0
 public Historic_Travel()
 {
     airNautisService = new ServiceAirNautis.AirNautisServiceClient();
     InitializeComponent();
     Populate_Historic();
 }
コード例 #10
0
        private void btnAddAirplane_Click(object sender, RoutedEventArgs e)
        {
            airNautisService = new ServiceAirNautis.AirNautisServiceClient();
            ServiceAirNautis.Airplane airplane = new ServiceAirNautis.Airplane();

            if (!String.IsNullOrEmpty(txtBoxModel.Text) && !String.IsNullOrEmpty(txtBoxYear.Text) && !String.IsNullOrEmpty(txtBoxCapacity.Text))
            {
                int year_value, capacity_value;

                if (int.TryParse(txtBoxYear.Text, out year_value))
                {
                    if (year_value <= 1970)
                    {
                        MessageBox.Show("Sorry, for reasons of safety we only accept modern airplanes", "Alert", MessageBoxButton.OK);
                        txtBoxYear.Focus();
                    }
                    if (year_value <= 2013)
                    {
                        if (int.TryParse(txtBoxCapacity.Text, out capacity_value))
                        {
                            if (capacity_value <= 0)
                            {
                                MessageBox.Show("The capacity value needs to be greater than zero", "Error", MessageBoxButton.OK);
                                txtBoxCapacity.Text = "";
                                txtBoxCapacity.Focus();
                            }
                            if (capacity_value > 0 && capacity_value <= 1000)
                            {
                                airplane.Model    = txtBoxModel.Text.Trim();
                                airplane.Year     = year_value;
                                airplane.Capacity = capacity_value;
                                airplane.Active   = true;

                                if (airNautisService.InsertAirplane(airplane))
                                {
                                    MessageBox.Show(string.Format("Airplane {0} successfully added!", txtBoxModel.Text), "Success", MessageBoxButton.OK);
                                    DialogResult = true;
                                }
                                else
                                {
                                    MessageBox.Show("Sorry, please verify fields", "Error", MessageBoxButton.OK);
                                }
                            }
                            else
                            {
                                MessageBox.Show("Sorry, no airplane has that number of capacity", "Alert", MessageBoxButton.OK);
                            }
                        }
                        else
                        {
                            MessageBox.Show("Value of the field Capacity needs to be a number", "Error", MessageBoxButton.OK);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Wrong Year value", "Error", MessageBoxButton.OK);
                        txtBoxYear.Focus();
                    }
                }
                else
                {
                    MessageBox.Show("Value of the field Year needs to be a number", "Error", MessageBoxButton.OK);
                }
            }
        }