예제 #1
0
        public static void afficherEnteteBulletin(int numIn)
        {
            Etudiant etudiant = DAL.GetEtudiant(numIn);

            Console.WriteLine("Num inscription : " + etudiant.NumIn);
            Console.WriteLine("Nom : " + etudiant.Nom);
            Console.WriteLine("Date de naissance : " + etudiant.DateNaiss);
            Console.WriteLine("\n");
        }
예제 #2
0
        public static Etudiant saisir()
        {
            Etudiant e = new Etudiant();

            Console.WriteLine("Numéro:");
            e.NumIn = int.Parse(Console.ReadLine());
            Console.WriteLine("Nom:");
            e.Nom = Console.ReadLine();
            Console.WriteLine("Date naissance:");
            e.DateNaiss = DateTime.Parse(Console.ReadLine());

            return(e);
        }
예제 #3
0
        public static void InsererEtudiant()
        {
            Etudiant        etudiant = PRL.saisir();
            MySqlConnection cnn      = DBConnection.GetConnection();

            cnn.Open();
            cmd = new MySqlCommand("insert into etudiant values (?,?,?) ", cnn);
            cmd.Parameters.Add(new MySqlParameter("NumIn", etudiant.NumIn));
            cmd.Parameters.Add(new MySqlParameter("Nom", etudiant.Nom));
            cmd.Parameters.Add(new MySqlParameter("DateNaiss", etudiant.DateNaiss));

            cmd.ExecuteNonQuery();
            cnn.Close();
        }
예제 #4
0
        public static Etudiant GetEtudiant(int numIn)
        {
            Etudiant        etudiant = new Etudiant();
            MySqlConnection cnn      = DBConnection.GetConnection();

            cnn.Open();
            cmd = new MySqlCommand("select * from etudiant where NumInscription=?", cnn);
            cmd.Parameters.Add(new MySqlParameter("NumInscription", numIn));

            MySqlDataReader read = cmd.ExecuteReader();

            while (read.Read())
            {
                etudiant.NumIn     = int.Parse(read["NumInscription"].ToString());
                etudiant.Nom       = read["Nom"].ToString();
                etudiant.DateNaiss = DateTime.Parse(read["DateNaiss"].ToString());
            }
            read.Close();
            cnn.Close();
            return(etudiant);
        }