public static PersonneViewModel connexion(string name, string pass) { ObservableCollection <DAOPersonne> lDAO = DAOPersonne.listePersonnes(); PersonneViewModel personne = null; foreach (DAOPersonne element in lDAO) { if (element.nomDAOPersonne == name && element.passwdDAOPersonne == pass) { personne = new PersonneViewModel(element.idDAOPersonne, element.nomDAOPersonne, element.prenomDAOPersonne, GroupeORM.getGroupe(element.groupeDAOPersonne), element.passwdDAOPersonne); } } return(personne); }
public static ObservableCollection <PersonneViewModel> listePersonnes() { ObservableCollection <DAOPersonne> lDAO = DAOPersonne.listePersonnes(); ObservableCollection <PersonneViewModel> l = new ObservableCollection <PersonneViewModel>(); foreach (DAOPersonne element in lDAO) { int idGroupe = element.groupeDAOPersonne; GroupeViewModel g = GroupeORM.getGroupe(idGroupe); // Plus propre que d'aller chercher le métier dans la DAO. PersonneViewModel p = new PersonneViewModel(element.idDAOPersonne, element.nomDAOPersonne, element.prenomDAOPersonne, g, element.passwdDAOPersonne); l.Add(p); } return(l); }