Ejemplo n.º 1
0
        public MySqlDataReader LectureunInscrit(Int32 NumTranspondeur)
        {
            try
            {
                string bddServeur = ConfigurationManager.AppSettings["serveur"];
                string sBddPort   = ConfigurationManager.AppSettings["port"];
                int    bddPort    = Convert.ToInt16(sBddPort);
                string bddBase    = ConfigurationManager.AppSettings["base"];
                string bddIdent   = ConfigurationManager.AppSettings["identificateur"];
                string bddMdp     = ConfigurationManager.AppSettings["mdp"];

                Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp);

                if (Connex.OuvrirConnexion())
                {
                    string requete = "SELECT * FROM inscription WHERE transpondeur_IdTranspondeur = " + NumTranspondeur;

                    reader = Connex.RequeteSql(requete);
                    return(reader);
                }
                else
                {
                    return(reader);
                }
            }
            catch
            {
                Connex.FermerConnexion();
                return(reader);
            }
        }
Ejemplo n.º 2
0
        public bool AjouterTranspondeur(Transpondeurs unTranspondeur)
        {
            bool opeOK = false;

            try
            {
                string bddServeur = ConfigurationManager.AppSettings["serveur"];
                string sBddPort   = ConfigurationManager.AppSettings["port"];
                int    bddPort    = Convert.ToInt16(sBddPort);
                string bddBase    = ConfigurationManager.AppSettings["base"];
                string bddIdent   = ConfigurationManager.AppSettings["identificateur"];
                string bddMdp     = ConfigurationManager.AppSettings["mdp"];

                Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp);

                if (Connex.OuvrirConnexion())
                {
                    string requete = "INSERT INTO `transpondeur` (`IdTranspondeur`, `Perdu`) " +
                                     "VALUES ('" + unTranspondeur.Id + "', '" + unTranspondeur.Perdu + "')";
                    Connex.RequeteNoData(requete);
                    opeOK = true;
                }
            }
            catch
            {
                opeOK = false;
            }
            Connex.FermerConnexion();
            return(opeOK);
        }
Ejemplo n.º 3
0
        public bool AjouterCategories(Categories UneCategories)
        {
            bool opeOK = false;

            try
            {
                string bddServeur = ConfigurationManager.AppSettings["serveur"];
                string sBddPort   = ConfigurationManager.AppSettings["port"];
                int    bddPort    = Convert.ToInt16(sBddPort);
                string bddBase    = ConfigurationManager.AppSettings["base"];
                string bddIdent   = ConfigurationManager.AppSettings["identificateur"];
                string bddMdp     = ConfigurationManager.AppSettings["mdp"];

                Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp);

                if (Connex.OuvrirConnexion())
                {
                    string requete = "INSERT INTO `categorie` (`Nom`, `AgeMini`, `AgeMaxi`, `DistanceMax`) " +
                                     "VALUES ('" + UneCategories.Nom + "', '" + UneCategories.ageMini + "', '" + UneCategories.ageMaxi + "', '" + UneCategories.dista + "')";
                    Connex.RequeteNoData(requete);
                    opeOK = true;
                }
            }
            catch
            {
                opeOK = false;
            }
            Connex.FermerConnexion();
            return(opeOK);
        }
Ejemplo n.º 4
0
        public bool AjouterClub(Clubs UnClub)
        {
            bool opeOK = false;

            try
            {
                string bddServeur = ConfigurationManager.AppSettings["serveur"];
                string sBddPort   = ConfigurationManager.AppSettings["port"];
                int    bddPort    = Convert.ToInt16(sBddPort);
                string bddBase    = ConfigurationManager.AppSettings["base"];
                string bddIdent   = ConfigurationManager.AppSettings["identificateur"];
                string bddMdp     = ConfigurationManager.AppSettings["mdp"];

                Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp);

                if (Connex.OuvrirConnexion())
                {
                    string requete = "INSERT INTO `club` (`Nom`, `Adresse`, `CodePostal`, `Ville`) " +
                                     "VALUES ('" + UnClub.Nom + "', '" + UnClub.Adresse + "', '" + UnClub.Cp + "', '" + UnClub.Ville + "')";
                    Connex.RequeteNoData(requete);
                    opeOK = true;
                }
            }
            catch
            {
                opeOK = false;
            }
            Connex.FermerConnexion();
            return(opeOK);
        }
Ejemplo n.º 5
0
        public MySqlDataReader LecturetoutCategories()
        {
            try
            {
                string bddServeur = ConfigurationManager.AppSettings["serveur"];
                string sBddPort   = ConfigurationManager.AppSettings["port"];
                int    bddPort    = Convert.ToInt16(sBddPort);
                string bddBase    = ConfigurationManager.AppSettings["base"];
                string bddIdent   = ConfigurationManager.AppSettings["identificateur"];
                string bddMdp     = ConfigurationManager.AppSettings["mdp"];

                Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp);

                if (Connex.OuvrirConnexion())
                {
                    string requete = "SELECT * FROM categorie";
                    reader = Connex.RequeteSql(requete);
                    return(reader);
                }
            }
            catch
            {
                return(reader);
            }
            Connex.FermerConnexion();
            return(reader);
        }
Ejemplo n.º 6
0
        public bool AjouterArrivee(Arrivee UnArrivee)
        {
            bool opeOK = false;

            try
            {
                string bddServeur = ConfigurationManager.AppSettings["serveur"];
                string sBddPort   = ConfigurationManager.AppSettings["port"];
                int    bddPort    = Convert.ToInt16(sBddPort);
                string bddBase    = ConfigurationManager.AppSettings["base"];
                string bddIdent   = ConfigurationManager.AppSettings["identificateur"];
                string bddMdp     = ConfigurationManager.AppSettings["mdp"];

                Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp);

                if (Connex.OuvrirConnexion())
                {
                    string dateSql = Convert.ToDateTime(UnArrivee.Temps).ToString("s", System.Globalization.DateTimeFormatInfo.InvariantInfo);
                    dateSql = dateSql.Replace("T", " ");

                    string requete = "INSERT INTO `arrivee` (`Temps`, `Inscription_IdInscription`) " +
                                     "VALUES ('" + dateSql + "', '" + UnArrivee.IdInscription + "')";
                    Connex.RequeteNoData(requete);
                    opeOK = true;
                }
            }
            catch
            {
                opeOK = false;
            }
            Connex.FermerConnexion();
            return(opeOK);
        }
Ejemplo n.º 7
0
        public bool AjouterInscription(Inscriptions UnInscription)
        {
            bool opeOK = false;

            try
            {
                string bddServeur = ConfigurationManager.AppSettings["serveur"];
                string sBddPort   = ConfigurationManager.AppSettings["port"];
                int    bddPort    = Convert.ToInt16(sBddPort);
                string bddBase    = ConfigurationManager.AppSettings["base"];
                string bddIdent   = ConfigurationManager.AppSettings["identificateur"];
                string bddMdp     = ConfigurationManager.AppSettings["mdp"];

                Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp);

                if (Connex.OuvrirConnexion())
                {
                    string requete = "INSERT INTO `Inscription` (`NumDossard`, `coureur_IdCoureur`, `transpondeur_IdTranspondeur`, `course_IdCourse`) " +
                                     "VALUES ('" + UnInscription.NumDossard + "', '" + UnInscription.IdCoureur + "', '" + UnInscription.IdTranspondeur + "', '" + UnInscription.IdCourse + "')";
                    Connex.RequeteNoData(requete);
                    opeOK = true;
                }
            }
            catch
            {
                opeOK = false;
            }
            Connex.FermerConnexion();
            return(opeOK);
        }
Ejemplo n.º 8
0
        //Fermeture base

        private void buttonDeconnexion_Click(object sender, EventArgs e)
        {
            try
            {
                bool OuvertureOk = Bdd.FermerConnexion();
                if (OuvertureOk != false)
                {
                    MessageBox.Show("Echec de la déconnexion de la base de données :" +
                                    "Exception retournée = " + Bdd.Erreur);
                }
            }
            catch { }
        }
Ejemplo n.º 9
0
        public (bool, string) ModifierCoureurs(Coureurs UnCoureurs, int IdCoureurs)
        {
            bool   opeOK      = false;
            int    ligneMod   = 0;
            string messErreur = "";

            try
            {
                string bddServeur = ConfigurationManager.AppSettings["serveur"];
                string sBddPort   = ConfigurationManager.AppSettings["port"];
                int    bddPort    = Convert.ToInt16(sBddPort);
                string bddBase    = ConfigurationManager.AppSettings["base"];
                string bddIdent   = ConfigurationManager.AppSettings["identificateur"];
                string bddMdp     = ConfigurationManager.AppSettings["mdp"];

                Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp);

                if (Connex.OuvrirConnexion())
                {
                    // mettre la date dans le format Mysql

                    string datnais = Convert.ToDateTime(UnCoureurs.Date).ToString("s", DateTimeFormatInfo.InvariantInfo);
                    datnais = datnais.Replace("T", " ");

                    string requete = "UPDATE Coureur SET `Club_IdClub`= '" + UnCoureurs.IdClub + "', `Nom`= '" + UnCoureurs.Nom + "', `Prenom`= '" + UnCoureurs.Prenom
                                     + "', `Adresse`= '" + UnCoureurs.Adresse + "', `CodePostal`= '" + UnCoureurs.Cp + "', `Ville`= '" + UnCoureurs.Ville +
                                     "', `DateNaissance`= '" + datnais + "', `Sexe`= '" + UnCoureurs.Sexe + "', `Categorie_IdCategorie`= '" + UnCoureurs.IdCat +
                                     "' WHERE IdCoureur = " + IdCoureurs + "";

                    ligneMod = Connex.RequeteNoData(requete);
                    if (ligneMod == 0)
                    {
                        messErreur = Connex.Erreur;
                        opeOK      = false;
                    }
                    else
                    {
                        opeOK = true;
                    }
                }
            }
            catch
            {
                opeOK      = false;
                messErreur = "Erreur de connexion !";
            }
            Connex.FermerConnexion();
            return(opeOK, messErreur);
        }
Ejemplo n.º 10
0
        public (bool, string) ModifierCourse(Courses UnCourse, int IdCourse)
        {
            bool   opeOK      = false;
            int    ligneMod   = 0;
            string messErreur = "";

            try
            {
                string bddServeur = ConfigurationManager.AppSettings["serveur"];
                string sBddPort   = ConfigurationManager.AppSettings["port"];
                int    bddPort    = Convert.ToInt16(sBddPort);
                string bddBase    = ConfigurationManager.AppSettings["base"];
                string bddIdent   = ConfigurationManager.AppSettings["identificateur"];
                string bddMdp     = ConfigurationManager.AppSettings["mdp"];

                Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp);

                if (Connex.OuvrirConnexion())
                {
                    string datprevue = Convert.ToDateTime(UnCourse.DatePrevue).ToString("s", DateTimeFormatInfo.InvariantInfo);
                    datprevue = datprevue.Replace("T", " ");
                    string datheure = Convert.ToDateTime(UnCourse.HeureDepart).ToString("s", DateTimeFormatInfo.InvariantInfo);
                    datheure = datheure.Replace("T", " ");

                    string requete = "UPDATE course SET `Nom`= '" + UnCourse.Nom + "', `Date`= '" +
                                     datprevue + "', `Distance`= '" + UnCourse.Distance + "', `HeureDepart`= '" +
                                     datheure + "' WHERE IdCourse = " + IdCourse + "";
                    ligneMod = Connex.RequeteNoData(requete);
                    if (ligneMod == 0)
                    {
                        messErreur = Connex.Erreur;
                        opeOK      = false;
                    }
                    else
                    {
                        opeOK = true;
                    }
                }
            }
            catch
            {
                opeOK      = false;
                messErreur = "Erreur de connexion !";
            }
            Connex.FermerConnexion();
            return(opeOK, messErreur);
        }
Ejemplo n.º 11
0
        public (bool, string) ModifierArrivee(Arrivee UnArrivee, int IdArrivee)
        {
            bool   opeOK      = false;
            int    ligneMod   = 0;
            string messErreur = "";

            try
            {
                string bddServeur = ConfigurationManager.AppSettings["serveur"];
                string sBddPort   = ConfigurationManager.AppSettings["port"];
                int    bddPort    = Convert.ToInt16(sBddPort);
                string bddBase    = ConfigurationManager.AppSettings["base"];
                string bddIdent   = ConfigurationManager.AppSettings["identificateur"];
                string bddMdp     = ConfigurationManager.AppSettings["mdp"];

                Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp);

                if (Connex.OuvrirConnexion())
                {
                    string dateSql = Convert.ToDateTime(UnArrivee.Temps).ToString("s", System.Globalization.DateTimeFormatInfo.InvariantInfo);
                    dateSql = dateSql.Replace("T", " ");

                    string requete = "UPDATE arrivee SET `Temps`= '" + dateSql + "', `Inscription_IdInscription`= '" + UnArrivee.IdInscription + "' WHERE IdArrivee = " + IdArrivee;
                    ligneMod = Connex.RequeteNoData(requete);
                    if (ligneMod == 0)
                    {
                        messErreur = Connex.Erreur;
                        opeOK      = false;
                    }
                    else
                    {
                        opeOK = true;
                    }
                }
            }
            catch
            {
                opeOK      = false;
                messErreur = "Erreur de connexion !";
            }
            Connex.FermerConnexion();
            return(opeOK, messErreur);
        }
Ejemplo n.º 12
0
        public (bool, string) ModifierTranspondeur(Transpondeurs UnTranspondeur, int IdTranspondeur)
        {
            bool   opeOK      = false;
            int    ligneMod   = 0;
            string messErreur = "";

            try
            {
                string bddServeur = ConfigurationManager.AppSettings["serveur"];
                string sBddPort   = ConfigurationManager.AppSettings["port"];
                int    bddPort    = Convert.ToInt16(sBddPort);
                string bddBase    = ConfigurationManager.AppSettings["base"];
                string bddIdent   = ConfigurationManager.AppSettings["identificateur"];
                string bddMdp     = ConfigurationManager.AppSettings["mdp"];

                Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp);


                if (Connex.OuvrirConnexion())
                {
                    string requete = "UPDATE transpondeur SET `Perdu`= '" + UnTranspondeur.Perdu + "' WHERE IdTranspondeur = " + IdTranspondeur + "";
                    ligneMod = Connex.RequeteNoData(requete);
                    if (ligneMod == 0)
                    {
                        messErreur = Connex.Erreur;
                        opeOK      = false;
                    }
                    else
                    {
                        opeOK = true;
                    }
                }
            }
            catch
            {
                opeOK      = false;
                messErreur = "Erreur de connexion !";
            }
            Connex.FermerConnexion();
            return(opeOK, messErreur);
        }
Ejemplo n.º 13
0
        public (bool, string) SupprimerCategories(Categories UneCategories, int IdCategories)
        {
            bool   opeOK      = false;
            int    ligneMod   = 0;
            string messErreur = "";

            try
            {
                string bddServeur = ConfigurationManager.AppSettings["serveur"];
                string sBddPort   = ConfigurationManager.AppSettings["port"];
                int    bddPort    = Convert.ToInt16(sBddPort);
                string bddBase    = ConfigurationManager.AppSettings["base"];
                string bddIdent   = ConfigurationManager.AppSettings["identificateur"];
                string bddMdp     = ConfigurationManager.AppSettings["mdp"];

                Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp);

                if (Connex.OuvrirConnexion())
                {
                    string requete = "DELETE FROM categorie WHERE IdCategorie = " + IdCategories;
                    ligneMod = Connex.RequeteNoData(requete);
                    if (ligneMod == 0)
                    {
                        messErreur = Connex.Erreur;
                        opeOK      = false;
                    }
                    else
                    {
                        opeOK = true;
                    }
                }
            }
            catch
            {
                opeOK      = false;
                messErreur = "Erreur de connexion !";
            }
            Connex.FermerConnexion();
            return(opeOK, messErreur);
        }
Ejemplo n.º 14
0
        public (bool, string) ModifierCategories(Categories UneCategories, int IdCategories)
        {
            bool   opeOK      = false;
            int    ligneMod   = 0;
            string messErreur = "";

            try
            {
                string bddServeur = ConfigurationManager.AppSettings["serveur"];
                string sBddPort   = ConfigurationManager.AppSettings["port"];
                int    bddPort    = Convert.ToInt16(sBddPort);
                string bddBase    = ConfigurationManager.AppSettings["base"];
                string bddIdent   = ConfigurationManager.AppSettings["identificateur"];
                string bddMdp     = ConfigurationManager.AppSettings["mdp"];

                Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp);

                if (Connex.OuvrirConnexion())
                {
                    string requete = "UPDATE categorie SET `Nom`= '" + UneCategories.Nom + "', `AgeMini`= '" + UneCategories.ageMini + "', `AgeMaxi`= '" + UneCategories.ageMaxi + "', `DistanceMax`= '" + UneCategories.dista + "' WHERE IdCategorie = " + IdCategories + "";
                    ligneMod = Connex.RequeteNoData(requete);
                    if (ligneMod == 0)
                    {
                        messErreur = Connex.Erreur;
                        opeOK      = false;
                    }
                    else
                    {
                        opeOK = true;
                    }
                }
            }
            catch
            {
                opeOK      = false;
                messErreur = "Erreur de connexion !";
            }
            Connex.FermerConnexion();
            return(opeOK, messErreur);
        }
Ejemplo n.º 15
0
        public (bool, string) ModifierInscription(Inscriptions UnInscription, int IdInscription)
        {
            bool   opeOK      = false;
            int    ligneMod   = 0;
            string messErreur = "";

            try
            {
                string bddServeur = ConfigurationManager.AppSettings["serveur"];
                string sBddPort   = ConfigurationManager.AppSettings["port"];
                int    bddPort    = Convert.ToInt16(sBddPort);
                string bddBase    = ConfigurationManager.AppSettings["base"];
                string bddIdent   = ConfigurationManager.AppSettings["identificateur"];
                string bddMdp     = ConfigurationManager.AppSettings["mdp"];

                Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp);

                if (Connex.OuvrirConnexion())
                {
                    string requete = "UPDATE inscription SET `NumDossard`= '" + UnInscription.NumDossard + "', `coureur_IdCoureur`= '" + UnInscription.IdCoureur + "', `transpondeur_IdTranspondeur`= '" + UnInscription.IdTranspondeur + "', `course_IdCourse`= '" + UnInscription.IdCourse + "' WHERE IdInscription = " + IdInscription + "";
                    ligneMod = Connex.RequeteNoData(requete);
                    if (ligneMod == 0)
                    {
                        messErreur = Connex.Erreur;
                        opeOK      = false;
                    }
                    else
                    {
                        opeOK = true;
                    }
                }
            }
            catch
            {
                opeOK      = false;
                messErreur = "Erreur de connexion !";
            }
            Connex.FermerConnexion();
            return(opeOK, messErreur);
        }
Ejemplo n.º 16
0
        public (bool, string) ModifierClub(Clubs UnClub, int IdClub)
        {
            bool   opeOK      = false;
            int    ligneMod   = 0;
            string messErreur = "";

            try
            {
                string bddServeur = ConfigurationManager.AppSettings["serveur"];
                string sBddPort   = ConfigurationManager.AppSettings["port"];
                int    bddPort    = Convert.ToInt16(sBddPort);
                string bddBase    = ConfigurationManager.AppSettings["base"];
                string bddIdent   = ConfigurationManager.AppSettings["identificateur"];
                string bddMdp     = ConfigurationManager.AppSettings["mdp"];

                Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp);

                if (Connex.OuvrirConnexion())
                {
                    string requete = "UPDATE club SET `Nom`= '" + UnClub.Nom + "', `Adresse`= '" + UnClub.Adresse + "', `CodePostal`= '" + UnClub.Cp + "', `Ville`= '" + UnClub.Ville + "' WHERE IdClub = " + IdClub + "";
                    ligneMod = Connex.RequeteNoData(requete);
                    if (ligneMod == 0)
                    {
                        messErreur = Connex.Erreur;
                        opeOK      = false;
                    }
                    else
                    {
                        opeOK = true;
                    }
                }
            }
            catch
            {
                opeOK      = false;
                messErreur = "Erreur de connexion !";
            }
            Connex.FermerConnexion();
            return(opeOK, messErreur);
        }
Ejemplo n.º 17
0
        public bool AjouterCoureur(Coureurs UnCoureurs)
        {
            bool opeOK = false;

            try
            {
                string bddServeur = ConfigurationManager.AppSettings["serveur"];
                string sBddPort   = ConfigurationManager.AppSettings["port"];
                int    bddPort    = Convert.ToInt16(sBddPort);
                string bddBase    = ConfigurationManager.AppSettings["base"];
                string bddIdent   = ConfigurationManager.AppSettings["identificateur"];
                string bddMdp     = ConfigurationManager.AppSettings["mdp"];

                Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp);

                if (Connex.OuvrirConnexion())
                {
                    // mettre la date dansq le format Mysql

                    string datnais = Convert.ToDateTime(UnCoureurs.Date).ToString("s", DateTimeFormatInfo.InvariantInfo);
                    datnais = datnais.Replace("T", " ");


                    string requete = "INSERT INTO `coureur` (`Club_IdClub`, `Nom`, `Prenom`, `Adresse`, `CodePostal`, `Ville`, `DateNaissance`, `Sexe`, `Categorie_IdCategorie`) " +
                                     "VALUES ('" + UnCoureurs.IdClub + "', '" + UnCoureurs.Nom + "', '" + UnCoureurs.Prenom + "', '" + UnCoureurs.Adresse +
                                     "', '" + UnCoureurs.Cp + "', '" + UnCoureurs.Ville + "', '" + datnais + "', '" + UnCoureurs.Sexe + "', '" + UnCoureurs.IdCat + "')";
                    Connex.RequeteNoData(requete);
                    opeOK = true;
                }
            }
            catch
            {
                opeOK = false;
            }
            Connex.FermerConnexion();
            return(opeOK);
        }
Ejemplo n.º 18
0
        public bool AjouterCourse(Courses UnCourse)
        {
            bool opeOK = false;

            try
            {
                string bddServeur = ConfigurationManager.AppSettings["serveur"];
                string sBddPort   = ConfigurationManager.AppSettings["port"];
                int    bddPort    = Convert.ToInt16(sBddPort);
                string bddBase    = ConfigurationManager.AppSettings["base"];
                string bddIdent   = ConfigurationManager.AppSettings["identificateur"];
                string bddMdp     = ConfigurationManager.AppSettings["mdp"];

                Connex = new Dbconnect(bddServeur, bddPort, bddBase, bddIdent, bddMdp);

                if (Connex.OuvrirConnexion())
                {
                    string datprevue = Convert.ToDateTime(UnCourse.DatePrevue).ToString("s", DateTimeFormatInfo.InvariantInfo);
                    datprevue = datprevue.Replace("T", " ");
                    string datheure = Convert.ToDateTime(UnCourse.HeureDepart).ToString("s", DateTimeFormatInfo.InvariantInfo);
                    datheure = datheure.Replace("T", " ");

                    string requete = "INSERT INTO `course` (`Nom`, `Date`, `Distance`, `HeureDepart`) " +
                                     "VALUES ('" + UnCourse.Nom + "', '" + datprevue + "', '" + UnCourse.Distance + "', '" + datheure + "')";

                    Connex.RequeteNoData(requete);
                    opeOK = true;
                }
            }
            catch
            {
                opeOK = false;
            }
            Connex.FermerConnexion();
            return(opeOK);
        }