Example #1
0
        private void btnAjouter_Click(object sender, EventArgs e)
        {
            PharmacieMapper pM = new PharmacieMapper();
            Pharmacie       p  = new Pharmacie
            {
                Numéro          = txtNumeroPharmacie.Text,
                Nom             = txtNomPharmacie.Text,
                NomRésponsable  = txtResponsablePharmacie.Text,
                Adresse         = txtAdressePharmacie.Text,
                NuméroTéléphone = txtTelephonePharmacie.Text,
            };

            if (pM.Insert(p) > 0)
            {
                System.Windows.Forms.MessageBox.Show("Succès ! Pharmacie ajouté !");
                var dlgPhar = (PHAR01)Tag;
                dlgPhar.Show();
                Close();
                dlgPhar.Search("", "");
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("Erreur ! Pharmacie non ajouté !");
            }
        }
 /// <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(string libelleDemande,string moisAnnee)
 {
     this.libelleDemande = libelleDemande;
     this.moisAnnee = moisAnnee;
     unePharmacie = null;
     UnTypePromo = null;
 }
Example #4
0
        private void btnModifierPharmacie_Click(object sender, EventArgs e)
        {
            if (btnModifierPharmacie.Text == "Modifier")
            {
                btnModifierPharmacie.Text = "Confirmer";
                enabled(true);
                lbPharmacies.Enabled        = false;
                btnAjouterPharmacie.Enabled = false;
            }
            else if (btnModifierPharmacie.Text == "Confirmer")
            {
                btnModifierPharmacie.Text = "Modifier";
                enabled(false);
                lbPharmacies.Enabled        = true;
                btnAjouterPharmacie.Enabled = true;

                PharmacieMapper pM = new PharmacieMapper();
                Pharmacie       p  = new Pharmacie
                {
                    Numéro          = txtNumeroPharmacie.Text,
                    Nom             = txtNomPharmacie.Text,
                    NomRésponsable  = txtResponsablePharmacie.Text,
                    Adresse         = txtAdressePharmacie.Text,
                    NuméroTéléphone = txtTelephonePharmacie.Text,
                };
                pM.Delete(lp[lbPharmacies.SelectedIndex]);
                pM.Insert(p);
                Search(txtRechercheNumero.Text, txtRechercheNom.Text);
            }
        }
Example #5
0
        //--------------------------------------------------------------------

        public int Insert(Pharmacie pPharmacie)
        {
            string[] lsCols   = null;
            string[] lsValues = null;
            this.FillArray(ref lsCols, ref lsValues, pPharmacie, true);
            return(DataBase.Insert("[tblPharmacie]", lsCols, lsValues));
        }
 public Demande( string libelleDemande, string moisAnnee,Pharmacie unePharmacie,TypePromo unTypePromo)
 {
     this.libelleDemande = libelleDemande;
     this.moisAnnee = moisAnnee;
     this.unePharmacie =unePharmacie;
     this.unTypePromo = unTypePromo;
 }
        public List<Promotion>SelectPromotionPourUneRegionPourUnType(int idType,int idRegion)
        {
            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 = "SelectPromotionPourUneRegionPourUnType";

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

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

            monLecteur = maCommand.ExecuteReader();
            while(monLecteur.Read())
            {
                Pharmacie unePharmacie = new Pharmacie((string)monLecteur["nomPharmacie"]);
                Intervenant unIntervenant = new Intervenant((string)monLecteur["nomIntervenant"]);
                Promotion unePromotion = new Promotion((int)monLecteur["idPromotion"], (string)monLecteur["intitulePromo"], (DateTime)monLecteur["datePromo"], (string)monLecteur["commentairePromo"], unIntervenant, unePharmacie);
                lesPromotions.Add(unePromotion);
            }

            return lesPromotions;
        }
Example #8
0
        //---------------------------------------------------------------------
        public int Update(Pharmacie pPharmacie)
        {
            string[] lsCols   = null;
            string[] lsValues = null;

            this.FillArray(ref lsCols, ref lsValues, pPharmacie, false);
            return(DataBase.UpdateID("tblPharmacie", lsCols, lsValues, pPharmacie.ID));
        }
 public Demande(int numDemande,string libelleDemande,string moisAnnee, Pharmacie unePharmacie, Region uneRegion)
 {
     this.idDemande = numDemande;
     this.libelleDemande = libelleDemande;
     this.moisAnnee = moisAnnee;
     this.unePharmacie = unePharmacie;
     this.UneRegion = uneRegion;
 }
 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(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;
 }
Example #12
0
 private void remplirChampInfo(Pharmacie p)
 {
     txtNumeroPharmacie.Text      = p.Numéro;
     txtNomPharmacie.Text         = p.Nom;
     txtResponsablePharmacie.Text = p.NomRésponsable;
     txtAdressePharmacie.Text     = p.Adresse;
     txtTelephonePharmacie.Text   = p.NuméroTéléphone;
     chbPharmacieActif.Checked    = false;
 }
        private async void btnmodif_Click(object sender, RoutedEventArgs e)
        {
            Pharmacie ph = new Pharmacie {
                Id = selectedpharmacie.Id, nom = txtNom.Text, adresse = txtAdresse.Text, disponibilite = txtDisponibilite.SelectedItem.ToString(), latitude = Double.Parse(txtLatitude.Text), longitude = Double.Parse(txtLongetude.Text)
            };
            await pharmacietable.UpdateAsync(ph);

            Frame.Navigate(typeof(GestionPharmacies));
        }
 public Promotion(int idPromotion, string intitulePromo, DateTime datePromo, string commentairePromo,Intervenant unIntervenant,Pharmacie unePharmacie)
 {
     this.idPromotion = idPromotion;
     this.intitulePromo = intitulePromo;
     this.datePromo = datePromo;
     this.commentairePromo = commentairePromo;
     this.UnIntervenant = unIntervenant;
     this.unePharmacie = unePharmacie;
 }
 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;
 }
 private void listv_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     selectedpharmacie = listv.SelectedItem as Pharmacie;
     txtNom.Text       = selectedpharmacie.nom;
     txtAdresse.Text   = selectedpharmacie.adresse;
     txtDisponibilite.PlaceholderText = selectedpharmacie.disponibilite;
     txtLongetude.Text        = selectedpharmacie.longitude.ToString();
     txtLatitude.Text         = selectedpharmacie.latitude.ToString();
     btnmedicament.Visibility = Visibility.Visible;
 }
Example #17
0
        //--------------------------------------------------------------------
        public Pharmacie Find(Guid ID)
        {
            Pharmacie lPharmacie = (Pharmacie)AbstractFind(ID);

            if (Util.isNULL(lPharmacie))
            {
                DataRow row = DataBase.SelectID(ID, "[tblPharmacie]");
                if (Util.isNULL(row))
                {
                    return(null);
                }
                lPharmacie = this.FillFields(row);
                LoadedMap.Add(lPharmacie.ID, lPharmacie);
            }
            return(lPharmacie);
        }
Example #18
0
        //----------------------------------------------------------------------------------------
        public int Delete(Pharmacie pPharmacie)
        {
            int liErreur = int.MinValue;
            int liTemp;
            int liI = 0;

            liTemp = DataBase.DeleteID(pPharmacie.ID, "[tblPharmacie]");
            if (liTemp == liErreur)
            {
                liI = liErreur;
            }
            if (liI != liErreur)
            {
                liI += liTemp;
            }


            return(liI);
        }
Example #19
0
        //--------------------------------------------------------------------
        private Pharmacie FillFields(DataRow pDataRow)
        {
            Pharmacie lPharmacie = new Pharmacie();

            lPharmacie.Numéro = (string)pDataRow["Numéro"];

            lPharmacie.Nom = (string)pDataRow["Nom"];

            lPharmacie.NomRésponsable = (string)pDataRow["NomRésponsable"];

            lPharmacie.Adresse = (string)pDataRow["Adresse"];

            lPharmacie.NuméroTéléphone = (string)pDataRow["NuméroTéléphone"];

            lPharmacie.ID = new Guid(pDataRow["ID"].ToString());


            return(lPharmacie);
        }
Example #20
0
        //---------------------------------------------------------------------
        private void FillArray(ref string[] pCols, ref string[] pValues, Pharmacie pPharmacie, bool pIsInsertID)
        {
            int liCpt    = 0;
            int liNombre = 5 + 0;

            if (pIsInsertID)
            {
                pCols            = new string[liNombre + 1];
                pValues          = new string[liNombre + 1];
                pCols[liCpt]     = "ID";
                pValues[liCpt++] = "'" + pPharmacie.ID.ToString() + "'";
            }
            else
            {
                pCols   = new string[liNombre];
                pValues = new string[liNombre];
            }


            pCols[liCpt] = "Numéro";

            pValues[liCpt++] = "'" + Util.DoubleQuote(pPharmacie.Numéro) + "'";

            pCols[liCpt] = "Nom";

            pValues[liCpt++] = "'" + Util.DoubleQuote(pPharmacie.Nom) + "'";

            pCols[liCpt] = "NomRésponsable";

            pValues[liCpt++] = "'" + Util.DoubleQuote(pPharmacie.NomRésponsable) + "'";

            pCols[liCpt] = "Adresse";

            pValues[liCpt++] = "'" + Util.DoubleQuote(pPharmacie.Adresse) + "'";

            pCols[liCpt] = "NuméroTéléphone";

            pValues[liCpt++] = "'" + Util.DoubleQuote(pPharmacie.NuméroTéléphone) + "'";
        }
        public List<Pharmacie> SelectPharmacie()
        {
            SqlConnection cnx = AccesBDD.GetInstance().GetSqlConnexion();
            SqlCommand maCommand = new SqlCommand();
            maCommand.Parameters.Clear();

            maCommand.Connection = cnx;

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

            List<Pharmacie> lesPharmacies = new List<Pharmacie>();

            SqlDataReader monLecteur = maCommand.ExecuteReader();

            while (monLecteur.Read())
            {
                Pharmacie unePharmacie = new Pharmacie((int)monLecteur["idPharmacie"], (string)monLecteur["nomPharmacie"]);
                lesPharmacies.Add(unePharmacie);
            }
            return lesPharmacies;
        }
        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;
        }