Пример #1
0
        private static void GestionMenus()
        {
            string Rep = "";

            do
            {
                Console.WriteLine("Choisir une options L pour Liste A pour Ajout S pour sortir");
                Rep = Console.ReadLine();
                switch (Rep)
                {
                case "L":
                    AdherentManager adhMan = new AdherentManager(Configuration._serviceProvider.GetService <IAdherentRepository>());
                    foreach (Adherent adh in adhMan.Lister())
                    {
                        Console.WriteLine($"Code {adh.IdAdherent} Nom {adh.NomAdherent} prénom {adh.PrenomAdherent}");
                    }
                    break;

                case "A":
                    AdherentManager adhMan2 = new AdherentManager(Configuration._serviceProvider.GetService <IAdherentRepository>());
                    break;

                default:
                    break;
                }
            } while (Rep != "S");
        }
Пример #2
0
        public FrmRecAdherent(string debNom, BindingSource adherentBS) : this()
        {
            adherentBSG = adherentBS;
            AdherentManager    adhMan    = new AdherentManager(Configuration._serviceProvider.GetService <IAdherentRepository>());
            HashSet <Adherent> adherents = adhMan.Lister().Where(a => a.NomAdherent
                                                                 .StartsWith(debNom, StringComparison.CurrentCultureIgnoreCase)).ToHashSet();

            if (adherents.Count > 0)
            {
                adherentBindingSource.DataSource = adherents;
            }
        }
        private void btnValider_Click(object sender, EventArgs e)
        {
            // Vérifier la validité
            Adherent adherent = adherentBindingSource.Current as Adherent;

            if (adherent.IsValid)
            {
                adherentBindingSource.EndEdit();
                if (contexteActuel == Contexte.Nouveau)
                {
                    // Create
                    AdherentManager adhMan = new AdherentManager(Configuration._serviceProvider.GetService <IAdherentRepository>());
                    adhMan.CreerAdherent(adherent);
                }
                if (contexteActuel == Contexte.Edition)
                {
                    // Update
                }

                GererContextes(Contexte.Initial);
            }
        }
        private Adherent SelectionnerAdherentByID(string adherentID)
        {
            AdherentManager adhMan = new AdherentManager(Configuration._serviceProvider.GetService <IAdherentRepository>());

            return(adhMan.Lister().Where(a => a.IdAdherent == adherentID).FirstOrDefault());
        }