コード例 #1
0
        public List <ActionAffichage> ActionAffichagesRechercheFromBdd(int id_activite, int id_ville, DateTime dateFrom, DateTime dateTo,
                                                                       int id_util)
        {
            List <ActionAffichage> lesActionsAffichages = new List <ActionAffichage>();
            AccesBDD bdd = new AccesBDD();

            bdd.OuvertureBDD();
            SqlCommand cmd = new SqlCommand("dbo.RecuperationActionsRecherche", bdd.Cnx);

            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@id_activite", id_activite));
            cmd.Parameters.Add(new SqlParameter("@id_ville", id_ville));
            cmd.Parameters.Add(new SqlParameter("@dateFrom", dateFrom.ToString("yyyy-MM-dd")));
            cmd.Parameters.Add(new SqlParameter("@dateTo", dateTo.ToString("yyyy-MM-dd")));
            cmd.Parameters.Add(new SqlParameter("@id_util", id_util));
            SqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                ActionAffichage actionAff = new ActionAffichage(dr);
                lesActionsAffichages.Add(actionAff);
            }
            dr.Close();
            bdd.FermetureBDD();
            return(lesActionsAffichages);
        }
コード例 #2
0
        //methodes pour hydrater les objets ActionAffichage :

        public List <ActionAffichage> ActionAffichagesFromBdd(int idUtilisateur)
        {
            List <ActionAffichage> lesActionsAffichages = new List <ActionAffichage>();
            AccesBDD bdd = new AccesBDD();

            bdd.OuvertureBDD();
            SqlCommand cmd = new SqlCommand("dbo.recupererToutesActionsPourRecherche", bdd.Cnx);

            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@id_utilisateur", idUtilisateur));
            SqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                ActionAffichage actionAff = new ActionAffichage(dr);
                lesActionsAffichages.Add(actionAff);
            }
            dr.Close();
            bdd.FermetureBDD();
            return(lesActionsAffichages);
        }