public static EnchereViewModel getEnchere(int idEnchere)
        {
            EnchereDAO       pDAO = EnchereDAO.getEnchere(idEnchere);
            EnchereViewModel p    = new EnchereViewModel(pDAO.idEnchereDAO, pDAO.nomEnchereDAO, pDAO.heureEnchereDAO, pDAO.dateVenteEnchereDAO, pDAO.idLieuEnchereDAO, pDAO.idAdminEnchereDAO);

            return(p);
        }
        public static ObservableCollection <EnchereDAO> selectEnchere()
        {
            ObservableCollection <EnchereDAO> l = new ObservableCollection <EnchereDAO>();
            string          query  = "SELECT * FROM enchere;";
            MySqlCommand    cmd    = new MySqlCommand(query, DALConnection.OpenConnection());
            MySqlDataReader reader = null;

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

                while (reader.Read())
                {
                    EnchereDAO p = new EnchereDAO(reader.GetInt32(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), reader.GetInt32(4), reader.GetInt32(5));
                    l.Add(p);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Il y a un problème dans la table Michelle : {0}", e.StackTrace);
            }
            reader.Close();
            return(l);
        }
Esempio n. 3
0
        public static EnchereViewModel getEnchere(int idEnchere)
        {
            EnchereDAO       pDAO = EnchereDAO.getEnchere(idEnchere);
            EnchereViewModel p    = new EnchereViewModel(pDAO.id_vente_enchere, pDAO.date_vente_enchere, pDAO.id_lieu);

            return(p);
        }
Esempio n. 4
0
        // SELECT ---------------------------------------------------------------------

        public static EnchereDAO SelectEnchereById(string id)

        {
            // Selectionné l'Enchere a partir de l'id

            var dao = new EnchereDAO();

            var query = "SELECT * FROM public.enchere  where \"idEnchere\" =:id";
            var cmd   = new NpgsqlCommand(query, DALconnection.OpenConnection());

            cmd.Parameters.AddWithValue("id", id);
            var reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                var idEnchere      = (string)reader["idEnchere"];
                var prixProposer   = (double)reader["prixProposer"];
                var estAdjuger     = (bool)reader["estAdjuger"];
                var dateHeureVente = (DateTime)reader["dateHeureVente"];
                var lotId          = (string)reader["lotId"];
                var commissaireId  = (string)reader["commissaireId"];

                var sender = Convert.IsDBNull(reader["ordreAchatId"])
                    ? (string)reader["utilisateurId"]
                    : (string)reader["ordreAchatId"];
                dao = Convert.IsDBNull(reader["ordreAchatId"])
                    ? new EnchereDAO(idEnchere, prixProposer, estAdjuger, dateHeureVente, lotId, commissaireId, null,
                                     sender)
                    : new EnchereDAO(idEnchere, prixProposer, estAdjuger, dateHeureVente, lotId, commissaireId, sender,
                                     null);
            }

            reader.Close();
            return(dao);
        }
        public static void updateEnchere(EnchereDAO p)
        {
            string           query       = "UPDATE enchere set nom=\"" + p.nomEnchereDAO + "\", heure=\"" + p.heureEnchereDAO + "\", dateVente=\"" + p.dateVenteEnchereDAO + "\", idLieu=\"" + p.idLieuEnchereDAO + "\", idAdmin=\"" + p.idAdminEnchereDAO + "\" where id=" + p.idEnchereDAO + ";";
            MySqlCommand     cmd         = new MySqlCommand(query, DALConnection.OpenConnection());
            MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd);

            cmd.ExecuteNonQuery();
        }
Esempio n. 6
0
        public static void updateEnchere(EnchereDAO p)
        {
            string           query       = "UPDATE vente_enchere set date_vente_enchere=\"" + p.date_vente_enchere + "\", id_lieu=\"" + p.id_lieu + "\" where id_vente_enchere=" + p.id_vente_enchere + ";";
            MySqlCommand     cmd         = new MySqlCommand(query, DALConnection.OpenConnection());
            MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd);

            cmd.ExecuteNonQuery();
        }
Esempio n. 7
0
        public static void insertEnchere(EnchereDAO p)
        {
            int              id          = getMaxIdEnchere() + 1;
            string           query       = "INSERT INTO vente_enchere VALUES ('" + id + "','" + p.date_vente_enchere + "','" + p.id_lieu + "');";
            MySqlCommand     cmd2        = new MySqlCommand(query, DALConnection.OpenConnection());
            MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd2);

            cmd2.ExecuteNonQuery();
        }
        public static void insertEnchere(EnchereDAO p)
        {
            int              id          = getMaxIdEnchere() + 1;
            string           query       = "INSERT INTO enchere VALUES (\"" + id + "\",\"" + p.nomEnchereDAO + "\",\"" + p.heureEnchereDAO + "\",\"" + p.dateVenteEnchereDAO + "\",\"" + p.idLieuEnchereDAO + "\",\"" + p.idAdminEnchereDAO + "\");";
            MySqlCommand     cmd2        = new MySqlCommand(query, DALConnection.OpenConnection());
            MySqlDataAdapter sqlDataAdap = new MySqlDataAdapter(cmd2);

            cmd2.ExecuteNonQuery();
        }
        public static ObservableCollection <EnchereViewModel> listeEnchere()
        {
            ObservableCollection <EnchereDAO>       lDAO = EnchereDAO.listeEnchere();
            ObservableCollection <EnchereViewModel> l    = new ObservableCollection <EnchereViewModel>();

            foreach (EnchereDAO element in lDAO)
            {
                EnchereViewModel p = new EnchereViewModel(element.idEnchereDAO, element.nomEnchereDAO, element.heureEnchereDAO, element.dateVenteEnchereDAO, element.idLieuEnchereDAO, element.idAdminEnchereDAO);
                l.Add(p);
            }
            return(l);
        }
Esempio n. 10
0
        public static ObservableCollection <EnchereViewModel> listeEncheres()
        {
            ObservableCollection <EnchereDAO>       lDAO = EnchereDAO.listeEncheres();
            ObservableCollection <EnchereViewModel> l    = new ObservableCollection <EnchereViewModel>();

            foreach (EnchereDAO element in lDAO)
            {
                EnchereViewModel p = new EnchereViewModel(element.id_vente_enchere, element.date_vente_enchere, element.id_lieu);
                l.Add(p);
            }
            return(l);
        }
        public static EnchereDAO getEnchere(int id)
        {
            string       query = "SELECT * FROM enchere WHERE id=" + id + ";";
            MySqlCommand cmd   = new MySqlCommand(query, DALConnection.OpenConnection());

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

            reader.Read();
            EnchereDAO cat = new EnchereDAO(reader.GetInt32(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), reader.GetInt32(4), reader.GetInt32(5));

            reader.Close();
            return(cat);
        }
Esempio n. 12
0
        public static EnchereDAO getEnchere(int idEnchere)
        {
            string       query = "SELECT * FROM vente_enchere WHERE id_vente_enchere=" + idEnchere + ";";
            MySqlCommand cmd   = new MySqlCommand(query, DALConnection.OpenConnection());

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

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

            reader.Close();
            return(pers);
        }
Esempio n. 13
0
// UPDATE -------------------------------------------------------------------------------

        public static void UpdateEnchere(EnchereDAO enchere)
        {
            // Mettre a jour Enchere dans la bdd

            var query =
                "UPDATE public.enchere SET \"idEnchere\" = @id, \"prixProposer\" = @prix ,\"estAdjuger\" = @adjuger , \"dateHeureVente\" = @timestamp, \"ordreAchatId\" = @ordreAchatId, \"lotId\" = @lotId, \"commissaireId\" = @commissaireId, \"utilisateurId\" = @utilisateurId, WHERE \"idEnchere\" = @id ";


            var cmd = new NpgsqlCommand(query, DALconnection.OpenConnection());

            cmd.Parameters.AddWithValue("id", enchere.IdEnchere);
            cmd.Parameters.AddWithValue("prix", enchere.PrixProposer);
            cmd.Parameters.AddWithValue("adjuger", enchere.EstAdjuger);
            cmd.Parameters.AddWithValue("timestamp", enchere.DateHeureVente);
            cmd.Parameters.AddWithValue("ordreAchatId", enchere.OrdreAchatId);
            cmd.Parameters.AddWithValue("lotId", enchere.LotId);
            cmd.Parameters.AddWithValue("commissaireId", enchere.CommissaireId);
            cmd.Parameters.AddWithValue("utilisateurId", enchere.UtilisateurId);
            cmd.ExecuteNonQuery();
        }
Esempio n. 14
0
// INSERT -------------------------------------------------------------------------------

        public static void InsertNewEnchere(EnchereDAO enchere)
        {
            // Inserer Enchere dans la bdd


            if (enchere.UtilisateurId != null)
            {
                var query =
                    "INSERT INTO public.enchere (\"idEnchere\", \"prixProposer\", \"estAdjuger\", \"dateHeureVente\",\"lotId\", \"commissaireId\", \"utilisateurId\") VALUES (:idEnchere ,:prix ,:adjuger ,:timestamp  ,:lotId ,:commissaireId ,:utilisateurId )";

                var cmd = new NpgsqlCommand(query, DALconnection.OpenConnection());
                cmd.Parameters.AddWithValue("idEnchere", enchere.IdEnchere);
                cmd.Parameters.AddWithValue("prix", enchere.PrixProposer);
                cmd.Parameters.AddWithValue("adjuger", enchere.EstAdjuger);
                cmd.Parameters.AddWithValue("timestamp", enchere.DateHeureVente);
                cmd.Parameters.AddWithValue("lotId", enchere.LotId);
                cmd.Parameters.AddWithValue("commissaireId", enchere.CommissaireId);
                cmd.Parameters.AddWithValue("utilisateurId", enchere.UtilisateurId);

                cmd.ExecuteNonQuery();
            }
            else
            {
                var query =
                    "INSERT INTO public.enchere (\"idEnchere\", \"prixProposer\", \"estAdjuger\", \"dateHeureVente\",\"lotId\", \"commissaireId\", \"ordreAchatId\") VALUES (:idEnchere ,:prix ,:adjuger ,:timestamp ,:lotId ,:commissaireId ,:ordreAchatId )";

                var cmd = new NpgsqlCommand(query, DALconnection.OpenConnection());
                cmd.Parameters.AddWithValue("idEnchere", enchere.IdEnchere);
                cmd.Parameters.AddWithValue("prix", enchere.PrixProposer);
                cmd.Parameters.AddWithValue("adjuger", enchere.EstAdjuger);
                cmd.Parameters.AddWithValue("timestamp", enchere.DateHeureVente);
                cmd.Parameters.AddWithValue("lotId", enchere.LotId);
                cmd.Parameters.AddWithValue("commissaireId", enchere.CommissaireId);
                cmd.Parameters.AddWithValue("ordreAchatId", enchere.OrdreAchatId);

                cmd.ExecuteNonQuery();
            }
        }
 public static void supprimerEnchere(int id)
 {
     EnchereDAO.supprimerEnchere(id);
 }
 public static void insertEnchere(EnchereViewModel p)
 {
     EnchereDAO.insertEnchere(new EnchereDAO(p.idEnchereProperty, p.nomEnchereProperty, p.heureEnchereProperty, p.dateVenteEnchereProperty, p.idLieuEnchereProperty, p.idAdminEnchereProperty));
 }
Esempio n. 17
0
 public static void insertEnchere(EnchereViewModel p)
 {
     EnchereDAO.insertEnchere(new EnchereDAO(p.id, p.date_vente_enchere, p.id_lieu));
 }