private void BtnModifier_Click(object sender, RoutedEventArgs e) { try { Depense Tab = TabDepense.SelectedItem as Depense; var T = Depense.getDepense(Tab.Id); Id = T.Id; txtMontant.Text = T.Montant.ToString(); var c = ListHistoriquePanne.SingleOrDefault(a => a.Id == T.IdHistoriquePanne); int val = ListHistoriquePanne.IndexOf(c); cmbHistoriquePanne.SelectedIndex = val; var k = ListVoyage.SingleOrDefault(a => a.Id == T.IdVoyage); int l = ListVoyage.IndexOf(k); //cmbVoyage.SelectedIndex = l; var d = ListTypeDepense.SingleOrDefault(a => a.Id == T.IdTypeDepense); int ii = ListTypeDepense.IndexOf(d); cmbTypeDepense.SelectedIndex = ii; BtnNouveau.IsEnabled = false; DegriserChamps(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void BtnSupprimer_Click(object sender, RoutedEventArgs e) { try { if (TabDepense.SelectedIndex != -1) { Depense Tab = (Depense)TabDepense.SelectedItem; var T = Depense.getDepense(Tab.Id); T.Supprime = true; T.Delete(); LoadTabDepense(); InitChamps(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }