Example #1
0
        public static LotViewModel getLot(int idLot)
        {
            LotDAO       pDAO = LotDAO.getLot(idLot);
            LotViewModel p    = new LotViewModel(pDAO.idLotDAO, pDAO.nomDAO, pDAO.descriptionDAO, pDAO.prix_departDAO);

            return(p);
        }
Example #2
0
        public static ObservableCollection <LotDAO> selectLots()
        {
            ObservableCollection <LotDAO> l = new ObservableCollection <LotDAO>();
            string          query           = "SELECT * FROM Lot;";
            MySqlCommand    cmd             = new MySqlCommand(query, DALConnection.OpenConnection());
            MySqlDataReader reader          = null;

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

                while (reader.Read())
                {
                    LotDAO p = new LotDAO(reader.GetInt32(0), reader.GetString(1), reader.GetString(2), reader.GetInt32(3));
                    l.Add(p);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Il y a un problème dans la table Lot : {0}", e.StackTrace);
            }
            reader.Close();
            return(l);
        }
Example #3
0
        public static void updateLot(LotDAO p)
        {
            string           query       = "UPDATE Lot set nom=\"" + p.nomDAO + "\", description=\"" + p.descriptionDAO + "\", prix_depart=\"" + p.prix_departDAO + "\"WHERE id = \"" + p.idLotDAO + "\" ;";
            MySqlCommand     cmd         = new MySqlCommand(query, DALConnection.OpenConnection());
            MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd);

            cmd.ExecuteNonQuery();
        }
Example #4
0
        public static void insertLot(LotDAO p)
        {
            int              id          = getMaxIdLot() + 1;
            string           query       = "INSERT INTO Lot (id, nom, description, prix_depart) VALUES (\"" + id + "\",\"" + p.nomDAO + "\",\"" + p.descriptionDAO + "\",\"" + p.prix_departDAO + "\");";
            MySqlCommand     cmd2        = new MySqlCommand(query, DALConnection.OpenConnection());
            MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd2);

            cmd2.ExecuteNonQuery();
        }
Example #5
0
        public static ObservableCollection <LotViewModel> listeLots()
        {
            ObservableCollection <LotDAO>       lDAO = LotDAO.listeLots();
            ObservableCollection <LotViewModel> l    = new ObservableCollection <LotViewModel>();

            foreach (LotDAO element in lDAO)
            {
                LotViewModel p = new LotViewModel(element.idLotDAO, element.nomDAO, element.descriptionDAO, element.prix_departDAO);
                l.Add(p);
            }
            return(l);
        }
Example #6
0
        public static LotDAO getLot(int idLot)
        {
            string       query = "SELECT * FROM Lot WHERE id=" + idLot + ";";
            MySqlCommand cmd   = new MySqlCommand(query, DALConnection.OpenConnection());

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

            reader.Read();
            LotDAO pers = new LotDAO(reader.GetInt32(0), reader.GetString(1), reader.GetString(2), reader.GetInt32(3));

            reader.Close();
            return(pers);
        }
Example #7
0
 public static void insertLot(LotDAO p)
 {
     LotDAL.insertLot(p);
 }
Example #8
0
 public static void updateLot(LotDAO p)
 {
     LotDAL.updateLot(p);
 }
Example #9
0
        public static LotDAO getLot(int idLot)
        {
            LotDAO p = LotDAL.getLot(idLot);

            return(p);
        }
Example #10
0
 public static void insertLot(LotViewModel p)
 {
     LotDAO.insertLot(new LotDAO(p.idLotProperty, p.nomProperty, p.descriptionProperty, p.prix_departProperty));
 }
Example #11
0
 public static void supprimerLot(int id)
 {
     LotDAO.supprimerLot(id);
 }