Ejemplo n.º 1
0
        public static void insertEtudeHasPlage(EtudeHasPlageDAO e)
        {
            string           query       = "INSERT INTO etude_has_Plage VALUES (\"" + e.Etude_idEtudeDAO + "\",\"" + e.Plage_idPlageDAO + "\",\"" + e.Zone_idZoneDAO + "\",\"" + e.name_concatenationDAO + "\");";
            MySqlCommand     cmd2        = new MySqlCommand(query, DALConnection.connection);
            MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd2);

            cmd2.ExecuteNonQuery();
        }
Ejemplo n.º 2
0
        public static void updateEtudeHasPlage(EtudeHasPlageDAO e)
        {
            string           query       = "UPDATE etude_has_Plage SET name_concatenation =" + e.name_concatenationDAO + " WHERE Etude_idEtude =" + e.Etude_idEtudeDAO + " AND Plage_idPlage =" + e.Plage_idPlageDAO + " AND zoneprelevement_idZonePrelevement =" + e.Zone_idZoneDAO + ";";
            MySqlCommand     cmd         = new MySqlCommand(query, DALConnection.connection);
            MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd);

            cmd.ExecuteNonQuery();
        }
        public static EtudeHasPlageViewModel getEtudeHasPlage(int idEtude, int idPlage, int idZone)
        {
            EtudeHasPlageDAO eDAO = EtudeHasPlageDAO.getEtudeHasPlage(idEtude, idPlage, idZone);

            int            Etude_idEtude = eDAO.Etude_idEtudeDAO;
            EtudeViewModel et            = EtudeORM.getEtude(Etude_idEtude);

            int            Plage_idPlage = eDAO.Plage_idPlageDAO;
            PlageViewModel p             = PlageORM.getPlage(Plage_idPlage);

            int           Zone_idZone = eDAO.Zone_idZoneDAO;
            ZoneViewModel z           = ZoneORM.getZone(Zone_idZone);

            EtudeHasPlageViewModel ep = new EtudeHasPlageViewModel(et, p, z, eDAO.name_concatenationDAO);

            return(ep);
        }
Ejemplo n.º 4
0
        public static ObservableCollection <EtudeHasPlageDAO> selectEtudeHasPlages()
        {
            ObservableCollection <EtudeHasPlageDAO> l = new ObservableCollection <EtudeHasPlageDAO>();
            string       query = "SELECT * FROM etude_has_Plage;";
            MySqlCommand cmd   = new MySqlCommand(query, DALConnection.connection);

            cmd.ExecuteNonQuery();

            MySqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                EtudeHasPlageDAO u = new EtudeHasPlageDAO(reader.GetInt32(0), reader.GetInt32(1), reader.GetInt32(2), reader.GetString(3));
                l.Add(u);
            }
            reader.Close();
            return(l);
        }
        public static ObservableCollection <EtudeHasPlageViewModel> listeEtudeHasPlages()
        {
            ObservableCollection <EtudeHasPlageDAO>       lDAO = EtudeHasPlageDAO.listeEtudeHasPlages();
            ObservableCollection <EtudeHasPlageViewModel> l    = new ObservableCollection <EtudeHasPlageViewModel>();

            foreach (EtudeHasPlageDAO element in lDAO)
            {
                int            Etude_idEtude = element.Etude_idEtudeDAO;
                EtudeViewModel et            = EtudeORM.getEtude(Etude_idEtude);

                int            Plage_idPlage = element.Plage_idPlageDAO;
                PlageViewModel p             = PlageORM.getPlage(Plage_idPlage);

                int           Zone_idZone = element.Zone_idZoneDAO;
                ZoneViewModel z           = ZoneORM.getZone(Zone_idZone);

                EtudeHasPlageViewModel ep = new EtudeHasPlageViewModel(et, p, z, element.name_concatenationDAO);
                l.Add(ep);
            }
            return(l);
        }
Ejemplo n.º 6
0
        public static EtudeHasPlageDAO getEtudeHasPlage(int idEtude, int idPlage, int idZone)
        {
            string       query = "SELECT * FROM etude_has_Plage WHERE Etude_idEtude=" + idEtude + " and plage_idPlage=" + idPlage + " and zoneprelevement_idZonePrelevement=" + idZone + ";";
            MySqlCommand cmd   = new MySqlCommand(query, DALConnection.connection);

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

            reader.Read();
            EtudeHasPlageDAO etude;

            if (reader.HasRows)
            {
                etude = new EtudeHasPlageDAO(reader.GetInt32(0), reader.GetInt32(1), reader.GetInt32(2), reader.GetString(3));
            }
            else
            {
                etude = new EtudeHasPlageDAO(1, 1, 1, "Pas de nom");
            }
            reader.Close();
            return(etude);
        }
 public static void insertEtudeHasPlage(EtudeHasPlageViewModel ep)
 {
     EtudeHasPlageDAO.insertEtudeHasPlage(new EtudeHasPlageDAO(ep.Etude_EtudeHasPlageProperty.idEtudeProperty, ep.Plage_EtudeHasPlageProperty.idPlageProperty, ep.Zone_EtudeHasPlageProperty.idZonePrelevementProperty, ep.name_concatenationProperty));
 }
 public static void supprimerEtudeHasPlage(int idEtude, int idPlage, int idZone)
 {
     EtudeHasPlageDAO.supprimerEtudeHasPlage(idEtude, idPlage, idZone);
 }