Beispiel #1
0
 private void BtnValider_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (string.IsNullOrWhiteSpace(txtDesignation.Text) ||
             string.IsNullOrWhiteSpace(txtQte.Text) ||
             string.IsNullOrWhiteSpace(txtDatePeremption.Text) ||
             cmbEtatMateriel.SelectedIndex == -1)
         {
             MessageBox.Show("Veuillez remplir tous les champs !", "mTransport", MessageBoxButton.OK, MessageBoxImage.Error);
         }
         else
         {
             Materiel M = new Materiel();
             M.Designation    = txtDesignation.Text;
             M.QteStock       = int.Parse(txtQte.Text);
             M.Etat           = cmbEtatMateriel.SelectedItem.ToString();
             M.DatePeremption = txtDatePeremption.SelectedDate;
             M.Insert();
             ListMateriel.Add(M);
             TabMateriel.Items.Refresh();
             MessageBox.Show("Enregistrement effectué !");
             GriserChamps();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }