/// <summary> /// Cette méthode sert à créer le fichier pdf d'un adhérent. /// </summary> /// <param name="adh"></param> public void adhInfos(Adhérents adh) { Connection connexion = new Connection(); List <Club> liste = connexion.listeClubs(); string nom = "Pas de club"; foreach (var item in liste) { if (adh.idClub == item.id) { nom = item.nom; } } PdfDocument pdf = new PdfDocument(); PdfPage pdfPage = pdf.AddPage(); XGraphics graph = XGraphics.FromPdfPage(pdfPage); XFont font = new XFont("Tahoma", 14, XFontStyle.Regular); graph.DrawString(adh.Nom + " " + adh.Prenom, font, XBrushes.Black, new XRect(0, 0, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft); graph.DrawString("Adresse : " + adh.Adresse + ", " + adh.Codepostal + ", " + adh.Ville, font, XBrushes.Black, new XRect(0, 15, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft); graph.DrawString("Date de naissance : " + adh.Naissance, font, XBrushes.Black, new XRect(0, 30, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft); graph.DrawString("Club : " + nom + "; Cotisation : " + adh.cotisation, font, XBrushes.Black, new XRect(0, 45, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft); pdf.Save("Infos" + adh.Nom + "-" + adh.Prenom + ".pdf"); Process.Start("Infos" + adh.Nom + "-" + adh.Prenom + ".pdf"); Console.WriteLine("oui"); }
private void btnAffecter_Click(object sender, EventArgs e) { int positionA = listBoxAdh.SelectedIndex; Adhérents adh = liste[positionA]; connexion.affecterAdhToEvent(adh, even); }
private void btnAdh_Click(object sender, EventArgs e) { int positionC = listBoxClub.SelectedIndex; int positionA = listBoxAdh.SelectedIndex; Adhérents adh = listeA[positionA]; connexion.desaffectation(adh); listBoxAdh.DataSource = null; listeA = connexion.listeAdherentsInClub(listeC[positionC]); listBoxAdh.Items.Clear(); foreach (var item in listeA) { listBoxAdh.Items.Add(item.Nom + " " + item.Prenom); } }
public void TestCotisations() { Connection connexion = new Connection(); Club club = new Club("Test", "Test.com", "20 rue des Tests", "92140", "Test", "06 66 66 66 66", "*****@*****.**", 1); club.id = 15; Adhérents adhérents = new Adhérents("Test", "Test", new DateTime(1998, 8, 8), "Test", "92140", "Test"); adhérents.idClub = club.id; adhérents.cotisation = 250; Statistiques stats = new Statistiques(); List <int> liste = new List <int>(); List <Adhérents> listeA = new List <Adhérents>(); liste.Add(adhérents.cotisation); listeA.Add(adhérents); int[] tab = stats.CotisationElevee(club, liste); Assert.False(tab[0] != 250, "Le test de la plus haute cotisation a échoué."); Assert.False(listeA[tab[1]] != adhérents, "Le test sur le compteur a échoué."); }
private void btnChoisir_Click(object sender, EventArgs e) { int positionA = listBox1.SelectedIndex; listeC = connexion.listeClubs(); Club club; adh = liste[positionA]; textBoxNom.Text = adh.Nom; textBoxNom.Enabled = true; textBoxPrenom.Text = adh.Prenom; textBoxPrenom.Enabled = true; dtp.Value = adh.Naissance; dtp.Enabled = true; textBoxAdresse.Text = adh.Adresse; textBoxAdresse.Enabled = true; textBoxVille.Text = adh.Ville; textBoxVille.Enabled = true; mskCP.Text = adh.Codepostal; mskCP.Enabled = true; btnModifier.Enabled = true; affectAd.Text = "Aucun"; foreach (var item in listeC) { if (item.id == adh.idClub) { club = item; affectAd.Text = item.nom; } } if (affectAd.Text == "Aucun") { cotAdh.Enabled = false; } else { cotAdh.Enabled = true; cotAdh.Text = adh.cotisation.ToString(); } }