Exemplo n.º 1
0
        private void dgMain_MouseDoubleClick_1(object sender, MouseButtonEventArgs e)
        {
            ServiceAirNautis.Airplane selected         = dgMain.SelectedItem as ServiceAirNautis.Airplane;
            Details_Airplane          detailedAirplane = new Details_Airplane(selected);

            detailedAirplane.ShowDialog();
        }
Exemplo n.º 2
0
        public void Fill_Information(ServiceAirNautis.Airplane airplane_received)
        {
            txtBoxModelData.Text    = airplane_received.Model;
            txtBoxCapacityData.Text = airplane_received.Capacity.ToString();
            txtBoxYearData.Text     = airplane_received.Year.ToString();
            txtBoxHangarData.Text   = airplane_received.Hangar.ToString();

            // Non editable TextBox
            txtBoxModelData.IsReadOnly    = true;
            txtBoxCapacityData.IsReadOnly = true;
            txtBoxYearData.IsReadOnly     = true;
            txtBoxHangarData.IsReadOnly   = true;
        }
Exemplo n.º 3
0
        public void Fill_Information(int airplane_id)
        {
            selected_airplane       = airNautisService.GetAirplaneById(airplane_id);
            txtBoxModelData.Text    = selected_airplane.Model;
            txtBoxCapacityData.Text = selected_airplane.Capacity.ToString();
            txtBoxYearData.Text     = selected_airplane.Year.ToString();
            txtBoxActiveData.Text   = selected_airplane.Active.ToString();

            // Non editable TextBox
            txtBoxModelData.IsReadOnly    = true;
            txtBoxCapacityData.IsReadOnly = true;
            txtBoxYearData.IsReadOnly     = true;
            txtBoxActiveData.IsReadOnly   = true;

            dgTravels.ItemsSource = airNautisService.GetAirplaneTravels(airplane_id);
        }
Exemplo n.º 4
0
        private void btnEditAirplane_Click(object sender, RoutedEventArgs e)
        {
            ServiceAirNautis.Airplane airplane = airNautisService.GetAirplaneById(this.airplane.Id);

            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;

                                if (airNautisService.EditAirplane(airplane))
                                {
                                    MessageBox.Show(string.Format("Airplane {0} successfully updated!", 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);
                }
            }
        }
Exemplo n.º 5
0
 public void Fill_Information(ServiceAirNautis.Airplane airplane_received)
 {
     txtBoxModel.Text    = airplane_received.Model;
     txtBoxCapacity.Text = airplane_received.Capacity.ToString();
     txtBoxYear.Text     = airplane_received.Year.ToString();
 }
Exemplo n.º 6
0
 public Edit_Airplane(ServiceAirNautis.Airplane new_airplane)
 {
     InitializeComponent();
     this.airplane = new_airplane;
     Fill_Information(this.airplane);
 }
Exemplo n.º 7
0
 public Details_Airplane(ServiceAirNautis.Airplane new_airplane)
 {
     airplane = new_airplane;
     InitializeComponent();
     Fill_Information(new_airplane);
 }