public PlageViewModel(int id, string nom, CommuneViewModel Com, int sup)
 {
     this.idPlage    = id;
     this.nomPlage   = nom;
     this.Commune    = Com;
     this.superficie = sup;
 }
Example #2
0
        public static PlageViewModel getPlage(int id)
        {
            DAOPlage         pDAO  = DAOPlage.getPlage(id);
            int              idCom = pDAO.idCommuneDAOPlage;
            CommuneViewModel c     = CommuneORM.getCommune(idCom);
            PlageViewModel   p     = new PlageViewModel(pDAO.idDAOPlage, pDAO.nomDAOPlage, c, pDAO.superficieDAOPlage);

            return(p);
        }
        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);
        }
 private void Ajouter_une_plage(object sender, RoutedEventArgs e)
 {
     try
     {
         CommuneViewModel commune = (CommuneViewModel)listeCommunes.SelectedItem;
         PlageViewModel   pl      = new PlageViewModel(nomTextBox.Text, commune, Int32.Parse(supTextBox.Text));
         PlageORM.ajouterPlage(pl);
         this.NavigationService.Navigate(new PageListPlages());
     }
     catch { }
 }
Example #5
0
        public static ObservableCollection <PlageViewModel> listePlage()
        {
            ObservableCollection <DAOPlage>       lDAO = DAOPlage.listePlages();
            ObservableCollection <PlageViewModel> l    = new ObservableCollection <PlageViewModel>();

            foreach (DAOPlage element in lDAO)
            {
                int idCom = element.idCommuneDAOPlage;

                CommuneViewModel c = CommuneORM.getCommune(idCom); // Plus propre que d'aller chercher le métier dans la DAO.
                PlageViewModel   p = new PlageViewModel(element.idDAOPlage, element.nomDAOPlage, c, element.superficieDAOPlage);
                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);
        }
Example #7
0
 public static void insertCommune(CommuneViewModel c)
 {
     DALCommune.insertCommune(new DAOCommune(c.nomCommuneProperty, c.departement.idDepartementProperty));
 }
 public static void supprimerCommune(CommuneViewModel commune)
 {
     DAOCommune.deleteCommune(commune.idCommuneProperty);
 }
 public static void insertCommune(CommuneViewModel commune)
 {
     DAOCommune.insertCommune(commune);
 }