示例#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();
        }
        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;
        }
示例#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);
        }
示例#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);
                }
            }
        }
示例#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();
 }
示例#6
0
 public Edit_Airplane(ServiceAirNautis.Airplane new_airplane)
 {
     InitializeComponent();
     this.airplane = new_airplane;
     Fill_Information(this.airplane);
 }
 public Details_Airplane(ServiceAirNautis.Airplane new_airplane)
 {
     airplane = new_airplane;
     InitializeComponent();
     Fill_Information(new_airplane);
 }