Example #1
0
 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);
     }
 }
Example #2
0
        public void ListCmbVoyage()
        {
            var l = Voyage.getAll();

            foreach (var item in l)
            {
                LoadCombo lCombo = new LoadCombo();
                lCombo.Id      = item.Id;
                lCombo.Libelle = item.Designation;
                ListVoyage.Add(lCombo);
            }
            cmbVoyage.ItemsSource = ListVoyage;
            //Verifier si c'est l'id du véhicule qui est renseigner, sélectionner et afficher le libellé correspondant, griser le champ
            if (voyageId > 0)
            {
                var c   = ListVoyage.SingleOrDefault(a => a.Id == voyageId);
                int val = ListVoyage.IndexOf(c);
                cmbVoyage.SelectedIndex = val;
                cmbVoyage.IsEnabled     = false;
            }
        }