Exemplo n.º 1
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");
            }
        }