public static DepartementViewModel getDepartement(int idDep)
        {
            DAODepartement       m           = DAODepartement.getDepatrement(idDep);
            DepartementViewModel departement = new DepartementViewModel(m.idDepartement, m.nomDAODepartement);

            return(departement);
        }
        public static CommuneViewModel getCommune(int idCommune)
        {
            DAOCommune           cDAO  = DAOCommune.getCommune(idCommune);
            int                  idDep = cDAO.idDepartementDAOCommune;
            DepartementViewModel d     = DepartementORM.getDepartement(idDep);
            CommuneViewModel     c     = new CommuneViewModel(cDAO.idDAOCommune, cDAO.nomDAOCommune, d);

            return(c);
        }
        public static ObservableCollection <DepartementViewModel> listeDepartement()
        {
            ObservableCollection <DAODepartement>       lDAO = DAODepartement.listeDepartements();
            ObservableCollection <DepartementViewModel> l    = new ObservableCollection <DepartementViewModel>();

            foreach (var element in lDAO)
            {
                DepartementViewModel p = new DepartementViewModel(element.idDepartement, element.nomDAODepartement);
                l.Add(p);
            }

            return(l);
        }
        public static ObservableCollection <CommuneViewModel> listeCommune()
        {
            ObservableCollection <DAOCommune>       lDAO = DAOCommune.listeCommune();
            ObservableCollection <CommuneViewModel> l    = new ObservableCollection <CommuneViewModel>();

            foreach (DAOCommune element in lDAO)
            {
                int idDep = element.idDepartementDAOCommune;

                DepartementViewModel d = DepartementORM.getDepartement(idDep); // Plus propre que d'aller chercher le métier dans la DAO.
                CommuneViewModel     c = new CommuneViewModel(element.idDAOCommune, element.nomDAOCommune, d);
                l.Add(c);
            }
            return(l);
        }
 public static void insertDepartement(DepartementViewModel d)
 {
     DALDepartement.insertDepartement(new DAODepartement(d.nomDepartementProperty));
 }
 public static void updateDepartement(DepartementViewModel d)
 {
     DALDepartement.updateDepartement(new DAODepartement(d.idDepartementProperty, d.nomDepartementProperty));
 }
 public CommuneViewModel(string nom, DepartementViewModel dep)
 {
     this.nomCommune  = nom;
     this.departement = dep;
 }
 public CommuneViewModel(int id, string nom, DepartementViewModel dep)
 {
     this.idCommune   = id;
     this.nomCommune  = nom;
     this.departement = dep;
 }
 public static void updateDepartement(DepartementViewModel d)
 {
     DAODepartement.updateDepartement(d);
 }