Exemplo n.º 1
0
        private void Nouveau_maintenance_click(object sender, RoutedEventArgs e)
        {
            DateTime date;

            if (DateTime.TryParse(Date.Text, out date))
            {
                DAL_Maintenance.AjouterMaintenance(DAL_Avion.FindByMatricule(Avion.Text).Id, date, DAL_Aeroport.FindByName(Aeroport.Text).Id, Details.Text, employe);
                AfficherMaintenance();
            }
        }
Exemplo n.º 2
0
        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;
                    Maintenance maintenance = DAL_Maintenance.GetMaintenance(IdMaintenance);

                    switch (column_nom)
                    {
                    case "Avion":
                        maintenance.Avion = co.Text;
                        break;

                    case "Date":
                        DateTime date;
                        if (!DateTime.TryParse(el.Text, out date))
                        {
                            date = maintenance.Date;
                        }
                        maintenance.Date = date;
                        break;

                    case "Aéroport":
                        maintenance.Aeroport = co.Text;
                        break;

                    case "Détails":
                        maintenance.Details = el.Text;
                        break;

                    default:
                        break;
                    }
                    DAL_Maintenance.ModifierMaintenance(maintenance.Id, DAL_Avion.FindByMatricule(maintenance.Avion).Id, maintenance.Date, DAL_Aeroport.FindByName(maintenance.Aeroport).Id, maintenance.Details, employe);
                }
            }
        }
Exemplo n.º 3
0
 public void AfficherMaintenance()
 {
     ListeMaintenances     = new ObservableCollection <Maintenance>();
     ListeMaintenances     = DAL_Maintenance.SelectMaintenancesByEmploye(employe);
     this.grid.ItemsSource = ListeMaintenances;
 }
Exemplo n.º 4
0
 private void Supp_maintenance_click(object sender, RoutedEventArgs e)
 {
     DAL_Maintenance.SupprimerMaintenance(IdMaintenance);
     AfficherMaintenance();
 }