コード例 #1
0
        public static void insertPlage(DAOPlage c)
        {
            string           query       = "INSERT INTO plage (`Nom`,`idCommune`,`superficie`) VALUES (\"" + c.nomDAOPlage + "\",\"" + c.idCommuneDAOPlage + "\",\"" + c.superficieDAOPlage + "\");";
            MySqlCommand     cmd2        = new MySqlCommand(query, connection);
            MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd2);

            cmd2.ExecuteNonQuery();
        }
コード例 #2
0
        public static void updatePlage(DAOPlage c)
        {
            string           query       = "UPDATE plage set nom=\"" + c.nomDAOPlage + "\",idCommune=\"" + c.idCommuneDAOPlage + "\" where idPlage=" + c.idDAOPlage + ";";
            MySqlCommand     cmd         = new MySqlCommand(query, connection);
            MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd);

            cmd.ExecuteNonQuery();
        }
コード例 #3
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);
        }
コード例 #4
0
        private void OnPropertyChanged(string info)
        {
            PropertyChangedEventHandler handler = PropertyChanged;

            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(info));
                DAOPlage.updatePlage(this);
            }
        }
コード例 #5
0
        public static DAOPlage getPlage(int idDAOPlage)
        {
            string       query = "SELECT * FROM plage WHERE idPlage=" + idDAOPlage + ";";
            MySqlCommand cmd   = new MySqlCommand(query, connection);

            cmd.ExecuteNonQuery();
            MySqlDataReader reader = cmd.ExecuteReader();

            reader.Read();
            DAOPlage com = new DAOPlage(reader.GetInt32(0), reader.GetString(1), reader.GetInt32(2), reader.GetInt32(3));

            reader.Close();
            return(com);
        }
コード例 #6
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);
        }
コード例 #7
0
        public static ObservableCollection <DAOPlage> selectPlage()
        {
            ObservableCollection <DAOPlage> l = new ObservableCollection <DAOPlage>();
            string       query = "SELECT * FROM plage;";
            MySqlCommand cmd   = new MySqlCommand(query, connection);

            cmd.ExecuteNonQuery();

            MySqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                DAOPlage c = new DAOPlage(reader.GetInt32(0), reader.GetString(1), reader.GetInt32(2), reader.GetInt32(3));
                l.Add(c);
            }
            reader.Close();
            return(l);
        }
コード例 #8
0
        public static DAOPlage getPlage(int idPlage)
        {
            DAOPlage plage = DALPlage.getPlage(idPlage);

            return(plage);
        }
コード例 #9
0
 public static void supprimerPlage(PlageViewModel plage)
 {
     DAOPlage.supprimerPlage(plage.idPlageProperty);
 }
コード例 #10
0
 public static void ajouterPlage(PlageViewModel plage)
 {
     DAOPlage.insertPlage(plage);
 }