private void metroButtonAjouter_Click(object sender, EventArgs e) { //string nom = textBoxN.Text; adherentModif.nom = textBoxN.Text; adherentModif.prenom = textBoxP.Text; adherentModif.ville = textBoxVille.Text; adherentModif.cotisation = Convert.ToDouble(maskedTextBoxCotisation.Text); adherentModif.codepostal = maskedTextBoxCodePostal.Text; adherentModif.Adresse = textBoxAdresse.Text; adherentModif.date = monthCalendar1.SelectionStart; DAOadherent connect = new DAOadherent(); connect.ModifAdherent(adherentModif); MetroFramework.MetroMessageBox.Show(this, "l'adhérent a été modifier , relancer la liste pour voir les modifications !", "Félicitation", MessageBoxButtons.OK, MessageBoxIcon.Information); textBoxN.Text = string.Empty; textBoxP.Text = string.Empty; maskedTextBoxCodePostal.Text = string.Empty; maskedTextBoxCotisation.Text = string.Empty; textBoxVille.Text = string.Empty; textBoxAdresse.Text = string.Empty; }
public static List <adhérent> creationliste() { List <adhérent> listcréer = new List <adhérent>(); DAOadherent connect = new DAOadherent(); // listcréer = connect.Readadherent() ; // listcréer.AddRange(connect.ReadadherentSansClub()); listcréer = connect.ReadadherentSansClub(); listcréer.AddRange(connect.Readadherent()); return(listcréer); }
private void metroButtonAjouter_Click(object sender, EventArgs e) { try { //string nom = textBoxN.Text; string nom = textBoxN.Text; string prenom = textBoxP.Text; string ville = textBoxVille.Text; double cotisation = Convert.ToDouble(maskedTextBoxCotisation.Text); string numero = Convert.ToString(rand.Next()); string codepostal = maskedTextBoxCodePostal.Text; string adresse = textBoxAdresse.Text; DateTime date = monthCalendar1.SelectionStart; adhérent adherent = new adhérent(nom, prenom, ville, numero, codepostal, cotisation, date, adresse); // listAd.AjouterAdherent(adherent); adherent.date = date; DAOadherent connect = new DAOadherent(); connect.ajouterAdherent(adherent); MetroFramework.MetroMessageBox.Show(this, "l'adhérent a été ajouté à la base de données avec succès !", "Félicitation", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { MetroFramework.MetroMessageBox.Show(this, "problème lors de la saisie !", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error); } textBoxN.Text = string.Empty; textBoxP.Text = string.Empty; maskedTextBoxCodePostal.Text = string.Empty; maskedTextBoxCotisation.Text = string.Empty; textBoxVille.Text = string.Empty; textBoxAdresse.Text = string.Empty; }