예제 #1
0
        private void buttonUpdate_Click(object sender, EventArgs e)
        {
            if (condition())
            {
                TypeClub letype = new TypeClub();
                letype.setLibelle(comboBox1.Text);

                Clubs club = new Clubs();

                club.setId(Int32.Parse(textID.Text));
                club.setLienSite(textLienSite.Text);
                club.setNom(textNom.Text);
                club.setMail(textEmail.Text);
                club.setType(letype);
                club.setAdresse(textAdresse.Text);
                club.setCPT(Int32.Parse(textCPT.Text));
                club.setVille(textVille.Text);
                club.setTel(Int32.Parse(textTel.Text));

                ModeleBDD bd = new ModeleBDD();

                bd.UPDATEClub(club);

                labelInfo.Text = club.getNom() + " a été modifié ";
                dataGridView1.ClearSelection();
                FillDataGridView();
            }
            else
            {
                MessageBox.Show("Veuillez remplir tout les champs");
            }
        }
예제 #2
0
        private void buttonUpdate_Click(object sender, EventArgs e)
        {
            if (condition())
            {
                Clubs club = new Clubs();
                club.setNom(comboBox1.Text);

                Evenements Event = new Evenements();
                Event.setId(Int32.Parse(textID.Text));
                Event.setClub(club);
                Event.setTitre(textBox1.Text);
                Event.setMoment(dateTimePicker1.Value);
                Event.setLienSite(textBox2.Text);
                Event.setType(comboBox2.Text);
                Event.setAdresse(textBox3.Text);
                Event.setVille(textBox7.Text);
                Event.setCPT(Int32.Parse(textBox4.Text));


                ModeleBDD con = new ModeleBDD();

                con.UPDATEEvent(Event);

                //labelInfo.Text = club.getNom() + " a été modifié ";
                dataGridView1.ClearSelection();
                FillDataGridView();
            }
            else
            {
                MessageBox.Show("Veuillez remplir tout les champs");
            }
        }
예제 #3
0
        /// <summary>
        /// Modifie l'évènement
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonUpdate_Click(object sender, EventArgs e)
        {
            if (condition())
            {
                if (verifiLicence())
                {
                    Clubs club = new Clubs();
                    club.setNom(comboBox2.Text);
                    Adherents adherent = new Adherents();
                    adherent.setId(Int32.Parse(textID.Text));
                    adherent.setClub(club);
                    adherent.setSexe(comboBox1.Text);
                    adherent.setNom(textNom.Text);
                    adherent.setPrenom(textPrenom.Text);
                    adherent.setLicence(textLicence.Text);
                    adherent.setNaissance(dateTimePicker1.Value);
                    adherent.setAdresse(textAdresse.Text);
                    adherent.setCPT(Int32.Parse(textCodePostal.Text));
                    adherent.setVille(textVille.Text);
                    adherent.setCotisation(Int32.Parse(textCotisation.Text));
                    try
                    {
                        ModeleBDD bd = new ModeleBDD();

                        bd.UPDATEAdherent(adherent);

                        comboBox1.Text   = "";
                        comboBox2.Text   = "";
                        textID.Text      = "";
                        textNom.Text     = "";
                        textPrenom.Text  = "";
                        textLicence.Text = "";
                        //dateTimePicker1.Value = DateTime.Now;
                        textAdresse.Text    = "";
                        textCodePostal.Text = "";
                        textVille.Text      = "";
                        textCotisation.Text = "";
                        label10.Text        = adherent.getNom() + " a été modifié ";
                        dataGridView1.ClearSelection();
                        FillDataGridView();
                    }catch (Exception e2)
                    {
                        MessageBox.Show("Message d'erreur : " + e2.Message + " \nType de l'exception " + e2.GetType() + " \nPile d'appel" + e2.StackTrace);
                    }
                }
                else
                {
                    MessageBox.Show("La licence doit être unique");
                }
            }
            else
            {
                MessageBox.Show("Veuillez remplir tout les champs");
            }
        }
예제 #4
0
        /// <summary>
        /// Ajoute un évènements
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e">l'évènement à ajouter</param>
        private void buttonInsertion_Click(object sender, EventArgs e)
        {
            if (condition())
            {
                if (verifiLicence())
                {
                    Clubs club = new Clubs();
                    club.setNom(comboBox2.Text);
                    Adherents adherent = new Adherents();
                    adherent.setClub(club);
                    adherent.setSexe(comboBox1.Text);
                    adherent.setNom(textNom.Text);
                    adherent.setPrenom(textPrenom.Text);
                    adherent.setLicence(textLicence.Text);
                    adherent.setNaissance(dateTimePicker1.Value);
                    adherent.setAdresse(textAdresse.Text);
                    adherent.setCPT(Int32.Parse(textCodePostal.Text));
                    adherent.setVille(textVille.Text);
                    adherent.setCotisation(Int32.Parse(textCotisation.Text));

                    ModeleBDD bd = new ModeleBDD();

                    bd.setAdherent(adherent);

                    comboBox1.Text   = "";
                    comboBox2.Text   = "";
                    textNom.Text     = "";
                    textPrenom.Text  = "";
                    textLicence.Text = "";
                    //dateTimePicker1.Value = DateTime.Now;
                    textAdresse.Text    = "";
                    textCodePostal.Text = "";
                    textVille.Text      = "";
                    textCotisation.Text = "";
                    label10.Text        = adherent.getNom() + " a été ajouter avec succès ";
                    dataGridView1.ClearSelection();
                    FillDataGridView();
                }
                else
                {
                    MessageBox.Show("La Licence doit être unique");
                }
            }
            else
            {
                MessageBox.Show("Veuillez rmplir tout les champs");
            }
        }
예제 #5
0
        private void buttonInsert_Click(object sender, EventArgs e)
        {
            if (condition())
            {
                TypeClub letype = new TypeClub();
                letype.setLibelle(comboBox1.Text);

                Clubs club = new Clubs();
                club.setLienSite(textLienSite.Text);
                club.setNom(textNom.Text);
                club.setMail(textEmail.Text);
                club.setType(letype);
                club.setAdresse(textAdresse.Text);
                club.setCPT(Int32.Parse(textCPT.Text));
                club.setVille(textVille.Text);
                club.setTel(Int32.Parse(textTel.Text));

                try
                {
                    ModeleBDD bd = new ModeleBDD();

                    bd.setClub(club);


                    textNom.Text      = "";
                    textLienSite.Text = "";
                    comboBox1.Text    = "";
                    textEmail.Text    = "";
                    textAdresse.Text  = "";
                    textCPT.Text      = "";
                    textVille.Text    = "";
                    textTel.Text      = "";
                    labelInfo.Text    = club.getNom() + " a été ajouter avec succès ";
                    dataGridView1.ClearSelection();
                    FillDataGridView();
                }catch (Exception e1)
                {
                    MessageBox.Show("Message d'erreur : " + e1.Message + " \nType de l'exception " + e1.GetType() + " \nPile d'appel" + e1.StackTrace);
                }
            }
            else
            {
                MessageBox.Show("Veuillez remplir tout les champs");
            }
        }
예제 #6
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (comboBox1.ToString() != "")
         {
             string    AVG    = "";
             ModeleBDD con    = new ModeleBDD();
             Clubs     leclub = new Clubs();
             leclub.setNom(comboBox1.ToString());
             AVG = con.AVGCotisation(leclub);
         }
     }
     catch (Exception n)
     {
         MessageBox.Show("Message d'erreur : " + n.Message + " \nType de l'exception " + n.GetType() + " \nPile d'appel" + n.StackTrace);
     }
 }
예제 #7
0
        private void Insert_Click(object sender, EventArgs e)
        {
            if (condition())
            {
                Clubs club = new Clubs();
                club.setNom(comboBox1.Text);

                Evenements Event = new Evenements();
                Event.setTitre(textBox1.Text);
                Event.setLienSite(textBox2.Text);
                Event.setMoment(dateTimePicker1.Value);
                Event.setClub(club);
                Event.setType(comboBox2.Text);
                Event.setVille(textBox7.Text);
                Event.setCPT(Int32.Parse(textBox4.Text));
                Event.setAdresse(textBox3.Text);
                try
                {
                    ModeleBDD con = new ModeleBDD();
                    con.setEvent(Event);

                    textBox1.Text         = "";
                    textBox2.Text         = "";
                    textBox3.Text         = "";
                    textBox4.Text         = "";
                    dateTimePicker1.Value = DateTime.Now;
                    textBox7.Text         = "";
                    comboBox1.Text        = "";
                    comboBox2.Text        = "";


                    dataGridView1.ClearSelection();
                    FillDataGridView();
                }catch (Exception e1)
                {
                    MessageBox.Show("Message d'erreur : " + e1.Message + " \nType de l'exception " + e1.GetType() + " \nPile d'appel" + e1.StackTrace);
                }
            }
            else
            {
                MessageBox.Show("Veuillez remplir tout les champs");
            }
        }
예제 #8
0
        //les sont modifié //adherent
        /// <summary>
        /// Methode qui selection tous adhernts sur la base de données
        /// </summary>
        /// <returns>Return un Listes des adherents</returns>
        public List <Adherents> getAdherents()
        {
            List <Adherents> lesAdherents = new List <Adherents>();

            using (MySqlConnection connection = new MySqlConnection(connectionString))
            {
                connection.Open();
                string query = "SELECT a.id AS IdAdherent, a.Licence, a.Sexe, a.Nom, a.Prenom, a.Naissance, a.Adresse, a.CodePostal, a.Ville, a.Cotisation, c.id AS IdClub, c.Nom AS NomClub FROM adherents AS a INNER JOIN clubs AS c ON a.id_clubs=c.id";

                //Crée Commande
                MySqlCommand command = new MySqlCommand(query, connection);
                //On crée un datareader et on execute la commande
                using (MySqlDataReader dataReader = command.ExecuteReader())
                {
                    //On li la base de données et on ajoute dans la liste les ahderents de la base de données
                    while (dataReader.Read())
                    {
                        Clubs club = new Clubs();
                        club.setId((int)dataReader["IdClub"]);
                        club.setNom((string)dataReader["NomClub"]);
                        Adherents lAdherent = new Adherents();
                        lAdherent.setId((int)dataReader["IdAdherent"]);
                        lAdherent.setClub(club);
                        lAdherent.setLicence((string)dataReader["Licence"]);
                        lAdherent.setSexe((string)dataReader["Sexe"]);
                        lAdherent.setNom((string)dataReader["Nom"]);
                        lAdherent.setPrenom((string)dataReader["Prenom"]);
                        lAdherent.setNaissance((DateTime)dataReader["Naissance"]);
                        lAdherent.setAdresse((string)dataReader["Adresse"]);
                        lAdherent.setCPT((int)dataReader["CodePostal"]);
                        lAdherent.setVille((string)dataReader["Ville"]);
                        lAdherent.setCotisation((int)dataReader["Cotisation"]);

                        lesAdherents.Add(lAdherent);
                    }
                    //string MySQLFormatDate = dateValue.ToString("yyyy-MM-dd HH:mm:ss")
                }

                connection.Close();

                return(lesAdherents);
            }
        }
예제 #9
0
        /* /// <summary>
         * /// La méthode Read retourne un Adherent en fonction de l'id en parametre.
         * /// </summary>
         * /// <param name="id">id de l'adherent selectionnedans la dataGridView</param>
         * /// <returns>un adhrent</returns>
         * public Adherents Read(int id)
         * {
         *   Adherents lAdherent = null;
         *
         *   using (MySqlConnection connection = new MySqlConnection(connectionString))
         *   {
         *       connection.Open();
         *       string query = "SELECT * FROM adherents where id=@id";
         *
         *       //Create Command
         *       MySqlCommand cmd = new MySqlCommand(query, connection);
         *
         *       cmd.Parameters.AddWithValue("@id", id);
         *
         *       //Create a data reader and Execute the command
         *       using (MySqlDataReader dataReader = cmd.ExecuteReader())
         *       {
         *           //Read the data and store them in the list
         *           while (dataReader.Read())
         *           {
         *               lAdherent = new Adherents();
         *               lAdherent.setId((int)dataReader["id"]);
         *               lAdherent.setLicence((string)dataReader["Licence"]);
         *               lAdherent.setNom((string)dataReader["Nom"]);
         *               lAdherent.setPrenom((string)dataReader["Prenom"]);
         *               lAdherent.setNaissance((string)dataReader["Naissance"]);
         *               lAdherent.setAdresse((string)dataReader["Adresse"]);
         *               lAdherent.setCPT((int)dataReader["CodePoastal"]);
         *               lAdherent.setVille((string)dataReader["Ville"]);
         *               lAdherent.setCotisation(dataReader["Cotisation"] != DBNull.Value ? (int)dataReader["Cotisation"] : 0);
         *           }
         *       }
         *   }
         *
         *   return lAdherent;
         * } */

        //methode evenement
        /// <summary>
        /// Methode qui selection tous Evenements sur la base de données
        /// </summary>
        /// <returns>Return un Listes des evenements</returns>
        public List <Evenements> getEvent()
        {
            List <Evenements> Events = new List <Evenements>();

            using (MySqlConnection connection = new MySqlConnection(connectionString))
            {
                connection.Open();
                string query = "SELECT e.id AS IdEven, e.Titre, e.LienSite, e.Adresse, e.Ville, e.CodePostal, e.Moment, e.Type, e.id_clubs, c.id AS IdClub, c.Nom From evenements AS e INNER JOIN Clubs AS c ON e.id_clubs = c.id ORDER BY e.id ";

                //Crée Commande
                MySqlCommand command = new MySqlCommand(query, connection);
                //On crée un datareader et on execute la commande
                using (MySqlDataReader dataReader = command.ExecuteReader())
                {
                    //On li la base de données et on ajiute dans la liste les ahderents de la base de données
                    while (dataReader.Read())
                    {
                        Clubs LeClub = new Clubs();
                        LeClub.setId((int)dataReader["IdClub"]);
                        LeClub.setNom((string)dataReader["Nom"]);

                        Evenements Event = new Evenements();
                        Event.setId((int)dataReader["IdEven"]);
                        Event.setLienSite((string)dataReader["LienSite"]);
                        Event.setType((string)dataReader["Type"]);
                        Event.setTitre((string)dataReader["Titre"]);
                        Event.setClub(LeClub);
                        Event.setMoment((DateTime)dataReader["Moment"]);
                        Event.setAdresse((string)dataReader["Adresse"]);
                        Event.setCPT((int)dataReader["CodePostal"]);
                        Event.setVille((string)dataReader["Ville"]);

                        Events.Add(Event);
                    }
                }

                connection.Close();

                return(Events);
            }
        }
예제 #10
0
        //La methode est modifié //club
        /// <summary>
        /// Methode qui selection tous clubs sur la base de données
        /// </summary>
        /// <returns>Return un Listes des clubs</returns>
        public List <Clubs> getClubs()
        {
            List <Clubs> lesClubs = new List <Clubs>();

            using (MySqlConnection connection = new MySqlConnection(connectionString))
            {
                connection.Open();
                string query = "SELECT c.id AS IdClub, c.Nom, c.LienSIte, c.Adresse, c.Ville, c.CodePostal, c.Telephone, c.Email, c.id_type, t.id AS IdType, t.Libelle From clubs AS c INNER JOIN type AS t ON c.id_type = t.id";

                //Crée Commande
                MySqlCommand command = new MySqlCommand(query, connection);
                //On crée un datareader et on execute la commande
                using (MySqlDataReader dataReader = command.ExecuteReader())
                {
                    //On li la base de données et on ajiute dans la liste les ahderents de la base de données
                    while (dataReader.Read())
                    {
                        TypeClub Type = new TypeClub();
                        Type.setId((int)dataReader["IdType"]);
                        Type.setLibelle((string)dataReader["Libelle"]);

                        Clubs lClub = new Clubs();
                        lClub.setId((int)dataReader["IdClub"]);
                        lClub.setLienSite((string)dataReader["LienSite"]);
                        lClub.setMail((string)dataReader["Email"]);
                        lClub.setNom((string)dataReader["Nom"]);
                        lClub.setType(Type);
                        lClub.setTel((int)dataReader["Telephone"]);
                        lClub.setAdresse((string)dataReader["Adresse"]);
                        lClub.setCPT((int)dataReader["CodePostal"]);
                        lClub.setVille((string)dataReader["Ville"]);

                        lesClubs.Add(lClub);
                    }
                }

                connection.Close();

                return(lesClubs);
            }
        }
예제 #11
0
        private void Insert_Click(object sender, EventArgs e)
        {
            if (condition())
            {
                Clubs club = new Clubs();
                club.setNom(comboBox1.Text);

                Evenements Event = new Evenements();
                Event.setTitre(textBox1.Text);
                Event.setLienSite(textBox2.Text);
                Event.setMoment(dateTimePicker1.Value);
                Event.setClub(club);
                Event.setType(comboBox2.Text);
                Event.setVille(textBox7.Text);
                Event.setCPT(Int32.Parse(textBox4.Text));
                Event.setAdresse(textBox3.Text);
                ModeleBDD con = new ModeleBDD();
                con.setEvent(Event);

                textBox1.Text         = "";
                textBox2.Text         = "";
                textBox3.Text         = "";
                textBox4.Text         = "";
                dateTimePicker1.Value = DateTime.Now;
                textBox7.Text         = "";
                comboBox1.Text        = "";
                comboBox2.Text        = "";


                dataGridView1.ClearSelection();
                FillDataGridView();
            }
            else
            {
                MessageBox.Show("Veuillez remplir tout les champs");
            }
        }