public Vol(int _id, int _trajet, int _avion, DateTime _depart, DateTime _arrivee)
 {
     this.id        = _id;
     this.trajet    = _trajet;
     this.strtrajet = DAL_Trajet.GetTrajet(_trajet).Depart + " - " + DAL_Trajet.GetTrajet(_trajet).Arrivee;
     this.depart    = _depart;
     this.arrivee   = _arrivee;
     this.avion     = DAL_Avion.GetAvion(_avion).Matricule;
 }
        private void Nouveau_vol_click(object sender, RoutedEventArgs e)
        {
            DateTime depart;
            DateTime arrivee;

            if ((DateTime.TryParse(Depart.Text, out depart)) && (DateTime.TryParse(Arrivee.Text, out arrivee)))
            {
                DAL_Vol.AjouterVol(DAL_Trajet.FindByStrTrajet(Trajet.Text).Id, DAL_Avion.FindByMatricule(Avion.Text).Id, depart, arrivee);
                AfficherVol();
            }
        }
 public void AfficherVol()
 {
     ListeVols                 = new ObservableCollection <Vol>();
     ListeVols                 = DAL_Vol.SelectVols();
     this.grid.ItemsSource     = ListeVols;
     this.trajet.ItemsSource   = DAL_Trajet.SelectStrTrajets();
     this.avion.ItemsSource    = DAL_Avion.SelectMatriculeAvions();
     this.Trajet.ItemsSource   = DAL_Trajet.SelectStrTrajets();
     this.Trajet.SelectedValue = DAL_Trajet.SelectStrTrajets().First();
     this.Avion.ItemsSource    = DAL_Avion.SelectMatriculeAvions();
     this.Avion.SelectedValue  = DAL_Avion.SelectMatriculeAvions().First();
 }
        private void Edit(object sender, DataGridCellEditEndingEventArgs e)
        {
            if (e.EditAction == DataGridEditAction.Commit)
            {
                DataGridColumn column = e.Column;
                if (column != null)
                {
                    string   column_nom = (string)column.Header;
                    TextBox  el         = e.EditingElement as TextBox;
                    ComboBox co         = e.EditingElement as ComboBox;
                    Vol      Vol        = DAL_Vol.GetVol(IdVol);

                    switch (column_nom)
                    {
                    case "Trajet":
                        Vol.StrTrajet = co.Text;
                        Vol.Trajet    = DAL_Trajet.FindByStrTrajet(co.Text).Id;
                        break;

                    case "Avion":
                        Vol.Avion = co.Text;
                        break;

                    case "Départ":
                        DateTime depart;
                        if (!DateTime.TryParse(el.Text, out depart))
                        {
                            depart = Vol.Depart;
                        }
                        Vol.Depart = depart;
                        break;

                    case "Arrivée":
                        DateTime arrivee;
                        if (!DateTime.TryParse(el.Text, out arrivee))
                        {
                            arrivee = Vol.Arrivee;
                        }
                        Vol.Arrivee = arrivee;
                        break;

                    default:
                        break;
                    }
                    DAL_Vol.ModifierVol(Vol.Id, Vol.Trajet, DAL_Avion.FindByMatricule(Vol.Avion).Id, Vol.Depart, Vol.Arrivee);
                }
            }
        }