Пример #1
0
        private void bt_Ajouter_Click(object sender, EventArgs e)
        {
            try
            {
                Adherent ad = new Adherent();
                int      x  = int.Parse(txt_Id.Text);
                if (x <= 0)
                {
                    throw new Exception("erreur Id negatif");
                }
                ad.ID        = x;
                ad.Nom       = txt_Titre.Text;
                ad.Datenaiss = dtp_naiss.Value;
                ad.Sexe      = Genre.Homme;
                if (rd_Femme.Checked)
                {
                    ad.Sexe = Genre.Femme;
                }
                ad.NoEmpruntEnCours = int.Parse(cmb_NbreEmprunts.Text);
                bool res = Form1.OurBib.LesAdherents.Add(ad);
                if (!res)
                {
                    throw new Exception("L'adhérent existe déjà\n  Verifier Id");
                }
                MessageBox.Show("Adhérent ajouté avec succés...");



                //update the dataGridView's Content
                dataGridView1.DataSource = null;
                dataGridView1.DataSource = Form1.OurBib.LesAdherents.lstAdherents;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #2
0
        private void bt_Modifier_Click(object sender, EventArgs e)
        {
            Adherent ad = Form1.OurBib.LesAdherents.FindById(11);

            MessageBox.Show(ad.Nom);
        }