Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Collections;
- namespace nbr_enfant
- {
- class enfanat
- {
- public static ArrayList E = new ArrayList();
- private int matricuel;
- private string nom;
- private string prenom;
- private DateTime date_naiss;
- private string sexe;
- public int GetMatricule()
- {
- return this.matricuel;
- }
- public string GetNom()
- {
- return this.nom;
- }
- public string Getprenom()
- {
- return this.prenom;
- }
- public string GetSexe()
- {
- return this.sexe;
- }
- public DateTime GetDate_naiss()
- {
- return this.date_naiss;
- }
- //les methode d'acces en ecriture
- public void SetNom(string nom)
- {
- this.nom = nom.ToUpper();
- }
- public void SetPrenom(string prenom)
- {
- this.prenom = prenom.Substring(0, 1).ToUpper() + prenom.Substring(1).ToLower();
- }
- public void SetMat(int mat)
- {
- this.matricuel = mat;
- }
- public void SetSexe(string sexe)
- {
- this.sexe = sexe;
- }
- public void SetDate(DateTime date)
- {
- this.date_naiss = date;
- }
- // les constructeur
- public enfanat()
- {
- }
- public enfanat(int mat, string nom, string prenom, DateTime date,string sexe ){
- this.SetMat(mat);
- this.SetNom(nom);
- this.SetPrenom(prenom);
- this.sexe = sexe;
- this.SetDate(date);
- }
- public void afficher()
- {
- Console.WriteLine("Matricule " + this.GetMatricule() + "nom" + this.GetNom() + "prenom" + this.Getprenom() + "la date de naissance " + this.GetDate_naiss());
- }
- public static void ajoutenfant(enfanat r)
- {
- E.Add(r);
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace nbr_enfant
- {
- public partial class da : Form
- {
- public da()
- {
- InitializeComponent();
- }
- public bool verifier()
- {
- if (textBoxMatricule.Text == "" || textBoxNom.Text == "" || textBoxPrenom.Text == "")
- {
- return true;
- }
- return false;
- }
- private void btnAjouter_Click(object sender, EventArgs e)
- {
- if (verifier() == true)
- {
- MessageBox.Show("veuillez remplir tout les champs ");
- }
- else
- {
- string r;
- if (radioButtonFille.Checked == true)
- {
- r= "fille";
- }
- else
- {
- r = "garçans";
- }
- enfanat l = new enfanat(int.Parse(textBoxMatricule.Text), textBoxNom.Text, textBoxPrenom.Text, dateTimePicker1.Value,r);
- enfanat.E.Add(l);
- textBoxMatricule.Text = "";
- textBoxNom.Text = "";
- textBoxPrenom.Text = "";
- dataGridView1.Rows.Add(l.GetMatricule(), l.GetNom(), l.Getprenom(), l.GetDate_naiss(), l.GetSexe());
- }
- }
- private void btnModifier_Click(object sender, EventArgs e)
- {
- for (int i=0;i<enfanat.E.Count;i++){
- if (int.Parse(textBoxMatricule.Text)==enfanat.E[i].
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment