コード例 #1
0
 /// <summary>
 /// Ajout d'une demande de promotion
 /// </summary>
 /// <param name="libelleDemande"></param>
 /// <param name="moisAnnee"></param>
 /// <param name="idPharmacie"></param>
 /// <param name="idTypePromo"></param>
 /// <returns></returns>
 public int CreerDemande(string libelleDemande,string moisAnnee,int idPharmacie, int idTypePromo)
 {
     Pharmacie laPharmacie = new Pharmacie(idPharmacie);
     TypePromo leTypePromo = new TypePromo(idTypePromo);
     Demande laDemande = new Demande(libelleDemande, moisAnnee, laPharmacie, leTypePromo);
     return DemandeDAO.GetInstanceDAODemande().AjoutDemande(laDemande);
 }
コード例 #2
0
        public int AjoutDemande(Demande laDemande)
        {
            SqlConnection cnx = AccesBDD.GetInstance().GetSqlConnexion();
            SqlCommand maCommand = new SqlCommand();
            maCommand.Parameters.Clear();

            maCommand.Connection = cnx;

            maCommand.CommandType = System.Data.CommandType.StoredProcedure;
            maCommand.CommandText = "ajoutDemande";

            maCommand.Parameters.Add("libelleDemande", System.Data.SqlDbType.VarChar);
            maCommand.Parameters[0].Value = laDemande.LibelleDemande;

            maCommand.Parameters.Add("moisAnnee", System.Data.SqlDbType.VarChar);
            maCommand.Parameters[1].Value = laDemande.MoisAnnee;

            maCommand.Parameters.Add("idPharmacie", System.Data.SqlDbType.Int);
            maCommand.Parameters[2].Value = laDemande.UnePharmacie.IdPharmacie;

            maCommand.Parameters.Add("idTypePromo", System.Data.SqlDbType.Int);
            maCommand.Parameters[3].Value = laDemande.UnTypePromo.IdTypePromo;

            return maCommand.ExecuteNonQuery();
        }
コード例 #3
0
        public List<Demande> SelectDemandePourUnTypeDePromo(int idTypePromotion)
        {
            SqlConnection cnx = AccesBDD.GetInstance().GetSqlConnexion();
            SqlCommand maCommand = new SqlCommand();
            SqlDataReader monLecteur;
            maCommand.Parameters.Clear();
            List<Demande> lesDemandes = new List<Demande>();

            maCommand.Connection = cnx;

            maCommand.CommandType = System.Data.CommandType.StoredProcedure;
            maCommand.CommandText = "SelectDemandePourUnTypeDePromo";

            maCommand.Parameters.Add("idPromo", System.Data.SqlDbType.Int);
            maCommand.Parameters[0].Value = idTypePromotion;

            monLecteur = maCommand.ExecuteReader();
            while (monLecteur.Read())
            {
                Region uneRegion = new Region((string)monLecteur["intituleRegion"]);
                Pharmacie unePharmacie = new Pharmacie((string)monLecteur["nomPharmacie"]);
                Demande uneDemande = new Demande((int)monLecteur["idDemande"], (string)monLecteur["libelleDemande"], (string)monLecteur["moisAnnee"],unePharmacie,uneRegion);
                lesDemandes.Add(uneDemande);
            }
            return lesDemandes;
        }