private void BtnAddIncident_Click(object sender, RoutedEventArgs e) { if (String.IsNullOrEmpty(LDAvion.Text) || String.IsNullOrEmpty(getTitre.Text) || String.IsNullOrEmpty(getDesc.Text)) { MessageBox.Show("Veuillez remplir tous les champs !"); } else { var singleton = Datas.GetInstance(); Avion RecupAvion = LDAvion.SelectedItem as Avion; Incident UnIncident = new Incident(); UnIncident.Id_Employe = singleton.Id_Employe; UnIncident.Id_Avion = RecupAvion.Id_Avion; UnIncident.Titre = getTitre.Text; UnIncident.Description = getDesc.Text; UnIncident.DateIncident = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss").Replace("/", "-"); IncidentDAL AjoutIncident = new IncidentDAL(); AjoutIncident.AjouterIncident(UnIncident); this.NavigationService.Navigate(new AjoutIncident()); } }
public MainWindow() { InitializeComponent(); DispatcherTimer timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(1); timer.Tick += timer_Tick; timer.Start(); //Connexion à la bdd Bdd bdd = new Bdd(); var singleton = Datas.GetInstance(); if (singleton.Id_Service == 7 | singleton.Id_Service == 8) { hrefVol.Visibility = Visibility.Visible; } if (singleton.Id_Service == 6 | singleton.Id_Service == 8) { hrefIncident.Visibility = Visibility.Visible; hrefMaintenance.Visibility = Visibility.Visible; } }