public void Add(Donner d)
        {
            int idx = InnerSearch(d.CIN);

            if (idx != -1)
            {
                throw new Exception("Deja dans la liste");
            }
            Donners.Add(d);
        }
        public void Update(string cin, Donner newDonner)
        {
            int idx = InnerSearch(cin);

            if (idx == -1)
            {
                throw new Exception("Introuvable");
            }
            Donners[idx] = newDonner;
        }
Exemple #3
0
        private void AddBtn_Click(object sender, EventArgs e)
        {
            try
            {
                BloodType bloodGrp = (BloodType)Enum.Parse(typeof(BloodType), BloodGrpCbBx.Text);

                RH rhesus = RHPlusRdBtn.Checked ? RH.Minus : RH.Plus;

                Donner d = new Donner(CINTxBx.Text, LastNameTxBx.Text, FirstNameTxBx.Text, bloodGrp, rhesus);

                donnerManagement.Add(d);

                RefreshDataGrid();

                MessageBox.Show("Ajout avec succe");
                Reset();
            }
            catch (Exception ep)
            {
                MessageBox.Show(ep.Message);
            }
        }