private void btAccepter_Click(object sender, EventArgs e) { try { ActiviteDA aDA = new ActiviteDA(); AdherentDA aDDA = new AdherentDA(); ParticipantDA pDA = new ParticipantDA(); int reste = aDA.restePlace(int.Parse(dataActiviteActuel.CurrentRow.Cells[0].Value.ToString())); if (reste <= 0) { MessageBox.Show("Le nombre de place est peline", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { int i = 0; int nbr = 0; foreach (Participation l in listAdherent) { nbr++; } if (nbr <= reste) { reste = nbr; } else { } Mailing m; foreach (Participation l in listAdherent) { if ((aDDA.getNombrePoint(l.participant.matricule) <= 0)) { pc.refuser(l.id); MessageBox.Show("Demande réfusé", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); continue; } else { foreach (String a in a.listAdresse(l.participant.matricule)) { m = new Mailing(a, "Notification", "Vous etes le bienvenue , nous avons accepte votre demande"); m.sendMail(); } pc.AccepterAdherent(l.participant.matricule, int.Parse(dataActiviteActuel.CurrentRow.Cells[0].Value.ToString()), 0, int.Parse(dataActiviteActuel.CurrentRow.Cells[4].Value.ToString())); if (i == reste) { MessageBox.Show("Erreur"); break; } i++; } } foreach (Participation l in listConjoint) { pc.AccepterConjoint(l.participant.matricule, int.Parse(dataActiviteActuel.CurrentRow.Cells[0].Value.ToString()), 0, 0); } foreach (Participation l in listEnfant) { pc.AccepterEnfant(l.participant.matricule, int.Parse(dataActiviteActuel.CurrentRow.Cells[0].Value.ToString()), 0, 0); } a = new AdherentDA(); listAdherent = pc.DemandeListAdherent(int.Parse(dataActiviteActuel.CurrentRow.Cells[0].Value.ToString())); pc.AfficheDemandeParActivite(dataDemande, int.Parse(dataActiviteActuel.CurrentRow.Cells[0].Value.ToString())); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }