public Demande( string libelleDemande, string moisAnnee,Pharmacie unePharmacie,TypePromo unTypePromo)
 {
     this.libelleDemande = libelleDemande;
     this.moisAnnee = moisAnnee;
     this.unePharmacie =unePharmacie;
     this.unTypePromo = unTypePromo;
 }
 /// <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);
 }
 public Demande(int numDemande, string libelleDemande, string moisAnnee,TypePromo unTypePromo)
 {
     this.idDemande = numDemande;
     this.libelleDemande = libelleDemande;
     this.moisAnnee = moisAnnee;
     this.unTypePromo = unTypePromo;
 }
 public int CreerPromotion(string sonIntitulePromo,DateTime saDatePromo,string sonCommentairePromo,int sonIdPharmacie,int sonIdTypePromo,int sonIdIntervenant)
 {
     Pharmacie laPharmacie = new Pharmacie(sonIdPharmacie);
     TypePromo leTypePromo = new TypePromo(sonIdTypePromo);
     Intervenant lIntervenant = new Intervenant(sonIdIntervenant);
     Promotion laPromotion = new Promotion(sonIntitulePromo, saDatePromo, sonCommentairePromo, laPharmacie, leTypePromo,lIntervenant);
     return PromotionDAO.GetInstanceDAOPromotion().AjoutPromotion(laPromotion);
 }
 public Promotion(int idPromotion, string intitulePromo, DateTime datePromo, string commentairePromo, Intervenant unIntervenant, TypePromo unTypePromo)
 {
     this.idPromotion = idPromotion;
     this.intitulePromo = intitulePromo;
     this.datePromo = datePromo;
     this.commentairePromo = commentairePromo;
     this.UnIntervenant = unIntervenant;
     this.unTypePromo = unTypePromo;
 }
 public Promotion(string intitulePromo, DateTime datePromo, string commentairePromo)
 {
     this.intitulePromo = intitulePromo;
     this.datePromo = datePromo;
     this.commentairePromo = commentairePromo;
     this.unePharmacie = null;
     this.unTypePromo = null;
     this.UnIntervenant = null;
 }
 public Promotion(string intitulePromo,DateTime datePromo,string commentairePromo,Pharmacie unePharmacie,TypePromo unTypePromo,Intervenant unIntervenant)
 {
     this.intitulePromo = intitulePromo;
     this.datePromo = datePromo;
     this.commentairePromo = commentairePromo;
     this.unePharmacie = unePharmacie;
     this.unTypePromo = unTypePromo;
     this.UnIntervenant = unIntervenant;
 }
        public List<TypePromo> SelectTypePromo()
        {
            SqlConnection cnx = AccesBDD.GetInstance().GetSqlConnexion();
            SqlCommand maCommand = new SqlCommand();
            maCommand.Parameters.Clear();

            maCommand.Connection = cnx;

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

            List<TypePromo> lesTypePromos = new List<TypePromo>();

            SqlDataReader monLecteur = maCommand.ExecuteReader();

            while (monLecteur.Read())
            {
                TypePromo unTypePromo = new TypePromo((int)monLecteur["idTypePromo"], (string)monLecteur["libelleTypePromo"]);
                lesTypePromos.Add(unTypePromo);
            }
            return lesTypePromos;
        }
        public List<Promotion> SelectPromotionPourUnePharmacie(int idPharmacie)
        {
            SqlConnection cnx = AccesBDD.GetInstance().GetSqlConnexion();
            SqlCommand maCommand = new SqlCommand();
            SqlDataReader monLecteur;
            maCommand.Parameters.Clear();

            List<Promotion> lesPromotions = new List<Promotion>();

            maCommand.Connection = cnx;

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

            maCommand.Parameters.Add("idPharmacie", System.Data.SqlDbType.Int);
            maCommand.Parameters[0].Value = idPharmacie;
            monLecteur = maCommand.ExecuteReader();

            while (monLecteur.Read())
            {
                TypePromo unTypePromo = new TypePromo((string)monLecteur["libelleTypePromo"]);
                Intervenant unIntervenant = new Intervenant((string)monLecteur["nomIntervenant"]);
                Promotion unePromotion = new Promotion((int)monLecteur["idPromotion"], (string)monLecteur["intitulePromo"], (DateTime)monLecteur["datePromo"], (string)monLecteur["commentairePromo"], unIntervenant, unTypePromo);
                lesPromotions.Add(unePromotion);
            }

            return lesPromotions;
        }
        public List<Demande> SelectDemandePouruneRegionPharmacie(int idRegion,int idPharmacie)
        {
            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 = "SelectDemandePouruneRegionPharmacie";

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

            maCommand.Parameters.Add("idPharmacie", System.Data.SqlDbType.Int);
            maCommand.Parameters[1].Value = idPharmacie;

            monLecteur = maCommand.ExecuteReader();
            while (monLecteur.Read())
            {
                TypePromo unTypePromo = new TypePromo((string)monLecteur["libelleTypePromo"]);

                Demande uneDemande = new Demande((int)monLecteur["idDemande"], (string)monLecteur["libelleDemande"], (string)monLecteur["moisAnnee"], unTypePromo);
                lesDemandes.Add(uneDemande);
            }
            return lesDemandes;
        }