Beispiel #1
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));
                    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);
        }
Beispiel #2
0
        public static LotViewModel getLot(int idLot)
        {
            LotDAO lDAO = LotDAO.getLot(idLot);

            LotViewModel p = new LotViewModel(lDAO.idLotDAO, lDAO.nomLotDAO, lDAO.descriptionLotDAO);

            return(p);
        }
Beispiel #3
0
        public static void updateLot(LotDAO p)
        {
            string           query       = "UPDATE lot set nomLot=\"" + p.nomLotDAO + "\", descriptionLot=\"" + p.descriptionLotDAO + "\" where idLot=" + p.idLotDAO + ";";
            MySqlCommand     cmd         = new MySqlCommand(query, DALConnection.OpenConnection());
            MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd);

            cmd.ExecuteNonQuery();
        }
Beispiel #4
0
        public static void insertLot(LotDAO p)
        {
            int id = getMaxIdLot() + 1;

            string           query       = "INSERT INTO lot VALUES (\"" + id + "\",\"" + p.nomLotDAO + "\",\"" + p.descriptionLotDAO + "\");";
            MySqlCommand     cmd2        = new MySqlCommand(query, DALConnection.OpenConnection());
            MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd2);

            cmd2.ExecuteNonQuery();
        }
Beispiel #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.nomLotDAO, element.descriptionLotDAO);
                l.Add(p);
            }

            return(l);
        }
Beispiel #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.Close();
            return(pers);
        }
Beispiel #7
0
 public static void insertLot(LotViewModel l)
 {
     LotDAO.insertLot(new LotDAO(l.idLotProperty, l.nomLotProperty, l.descriptionLotProperty));
 }
Beispiel #8
0
 public static void supprimerLot(int id)
 {
     LotDAO.supprimerLot(id);
 }
Beispiel #9
0
 public static void insertLot(LotDAO p)
 {
     LotDAL.insertLot(p);
 }
Beispiel #10
0
 public static void updateLot(LotDAO p)
 {
     LotDAL.updateLot(p);
 }
Beispiel #11
0
        public static LotDAO getLot(int idLot)
        {
            LotDAO p = LotDAL.getLot(idLot);

            return(p);
        }