Пример #1
0
        public static void updatePrelevement(PrelevementDAO p)
        {
            string           query       = "UPDATE prelevement set PositionGPS=\"" + p.PositionGPSDAO + "\", Type=\"" + p.TypeDAO + "\", where idprelevement=" + p.idprelevementDAO + ";";
            MySqlCommand     cmd         = new MySqlCommand(query, connection);
            MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd);

            cmd.ExecuteNonQuery();
        }
Пример #2
0
        public static void insertPrelevement(PrelevementDAO p)
        {
            int              id          = getMaxIdPrelevement() + 1;
            string           query       = "INSERT INTO prelevement VALUES (\"" + id + "\",\"" + p.PositionGPSDAO + "\",\"" + p.TypeDAO + "\");";
            MySqlCommand     cmd2        = new MySqlCommand(query, DALConnection.connection);
            MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd2);

            cmd2.ExecuteNonQuery();
        }
Пример #3
0
        public static PrelevementDAO getPrelevement(int idprelevement)
        {
            string       query = "SELECT * FROM prelevement WHERE idprelevement=" + idprelevement + ";";
            MySqlCommand cmd   = new MySqlCommand(query, DALConnection.connection);

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

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

            reader.Close();
            return(pers);
        }
Пример #4
0
        public static ObservableCollection <PrelevementDAO> selectPrelevements()
        {
            ObservableCollection <PrelevementDAO> l = new ObservableCollection <PrelevementDAO>();
            string       query = "SELECT * FROM prelevement;";
            MySqlCommand cmd   = new MySqlCommand(query, DALConnection.OpenConnection());

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

                while (reader.Read())
                {
                    PrelevementDAO p = new PrelevementDAO(reader.GetInt32(0), reader.GetString(1), reader.GetString(2));
                    l.Add(p);
                }
                reader.Close();
            }
            catch (Exception e)
            {
                MessageBox.Show("La base de données n'est pas connectée");
            }
            return(l);
        }
Пример #5
0
 public static void insertPrelevement(PrelevementDAO p)
 {
     PrelevementDAL.insertPrelevement(p);
 }
Пример #6
0
 public static void updatePrelevement(PrelevementDAO p)
 {
     PrelevementDAL.updatePrelevement(p);
 }
Пример #7
0
        public static PrelevementDAO getPrelevement(int idprelevement)
        {
            PrelevementDAO p = PrelevementDAL.getPrelevement(idprelevement);

            return(p);
        }