Пример #1
0
        public static CategorieView getCategorie(int idCategorie)
        {
            CategorieDAO  categorieDAO  = CategorieDAO.getCategorie(idCategorie);
            CategorieView categorieView = new CategorieView(categorieDAO.idCategorieDao, categorieDAO.NomDao);

            return(categorieView);
        }
Пример #2
0
        public static void insertCategorie(CategorieDAO c)
        {
            int              id          = getMaxIdCategorie() + 1;
            string           query       = "INSERT INTO catégorie VALUES (\"" + id + "\",\"" + c.NomDao + "\");";
            MySqlCommand     cmd2        = new MySqlCommand(query, ConnectionDAL.OpenConnection());
            MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd2);

            cmd2.ExecuteNonQuery();
        }
Пример #3
0
        public static ObservableCollection <CategorieView> listeCategoriesORM()
        {
            ObservableCollection <CategorieDAO>  listeDesCategoriesDAO  = CategorieDAO.listeCategoriesDAO();
            ObservableCollection <CategorieView> listeDesCategoriesView = new ObservableCollection <CategorieView>();

            foreach (CategorieDAO categorie in listeDesCategoriesDAO)
            {
                CategorieView categorieView = new CategorieView(categorie.idCategorieDao, categorie.NomDao);
                listeDesCategoriesView.Add(categorieView);
            }
            return(listeDesCategoriesView);
        }
Пример #4
0
        public static CategorieDAO getCategorie(int idCategorie)
        {
            string       query = "SELECT * FROM catégorie WHERE idCatégorie=" + idCategorie + ";";
            MySqlCommand cmd   = new MySqlCommand(query, ConnectionDAL.OpenConnection());

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

            reader.Read();
            CategorieDAO categorie = new CategorieDAO(reader.GetInt32(0), reader.GetString(1));

            reader.Close();
            return(categorie);
        }
Пример #5
0
        public static ObservableCollection <CategorieDAO> listCategorieDAL()
        {
            ObservableCollection <CategorieDAO> listeCategorie = new ObservableCollection <CategorieDAO>();
            string          query  = "SELECT * from catégorie;";
            MySqlCommand    cmd    = new MySqlCommand(query, ConnectionDAL.OpenConnection());
            MySqlDataReader reader = null;

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

            while (reader.Read())
            {
                CategorieDAO categorie = new CategorieDAO(reader.GetInt32(0), reader.GetString(1));
                listeCategorie.Add(categorie);
            }
            reader.Close();
            return(listeCategorie);
        }
Пример #6
0
 public static void insertCategorie(CategorieView c)
 {
     CategorieDAO.insertCategorie(new CategorieDAO(c.idCategorieView, c.nomView));
 }
Пример #7
0
 public static void insertCategorie(CategorieDAO categorieDAO)
 {
     CategorieDAL.insertCategorie(categorieDAO);
 }
Пример #8
0
        public static CategorieDAO getCategorie(int idCategorie)
        {
            CategorieDAO categorie = CategorieDAL.getCategorie(idCategorie);

            return(categorie);
        }