Exemplo n.º 1
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            Eleve    eleve    = new Eleve();
            EleveBLO eleveBLO = new EleveBLO();


            MessageBox.Show
            (
                "Save done!",
                "Confirmation",
                MessageBoxButtons.OK,
                MessageBoxIcon.Information
            );
            txtNom.Clear();
            txtPrenom.Clear();
            txtTelephone.Clear();
            txtMatricule.Clear();
            txtVille.Clear();
            txtNaissance.Clear();
            txtEcole.Clear();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            string choice = "y";

            do
            {
                Console.Clear();
                Console.WriteLine("--------------------Creation d'une carte---------------------");
                Console.Write("entrer le nom:\t");
                String Nom = Console.ReadLine();
                Console.Write("entrer le prenom:\t");
                String Prenom = Console.ReadLine();
                Console.Write("entrer le Matricule:\t");
                String Matricule = Console.ReadLine();
                Console.Write("entrer le Ecole:\t");
                String Ecole = Console.ReadLine();
                Console.Write("entrer le Date de naissance:\t");
                String Datedenaissance = Console.ReadLine();
                Console.Write("entrer le Ville:\t");
                String Ville = Console.ReadLine();
                Console.Write("entrer le Numero de Telephone:\t");
                String Numerodetelephone = Console.ReadLine();

                Eleve    eleve    = new Eleve(Nom, Prenom, Matricule, Ecole, Datedenaissance, Ville, Numerodetelephone);
                EleveBLO eleveBLO = new EleveBLO();


                IEnumerable <Eleve> eleves = eleveBLO.ListeDesEleves();

                foreach (Eleve p in eleves)
                {
                    Console.WriteLine($"{p.Nom}\t{p.Prenom}");
                }

                Console.WriteLine("Creer une nouvelle carte?[y/n]:");
                choice = Console.ReadLine();
            }while (choice.ToLower() != "n");

            Console.ReadKey();
        }
Exemplo n.º 3
0
 public EnreEleve()
 {
     InitializeComponent();
     dataGridView1.AutoGenerateColumns = false;
     eleveBLO = new EleveBLO();
 }
Exemplo n.º 4
0
 public ListeEleves()
 {
     InitializeComponent();
     dataGridView1.AutoGenerateColumns = false;
     eleveBLO = new EleveBLO(ConfigurationManager.AppSettings["DbFolder"]);
 }
Exemplo n.º 5
0
        private void btnValider_Click(object sender, EventArgs e)
        {
            try
            {
                Eleve newEleve = new Eleve
                                 (
                    txtMatricule.Text.ToUpper(),
                    txtNom.Text,
                    txtPrenom.Text,
                    txtEcole.Text,
                    txtNaissance.Text,
                    txtVille.Text,
                    !string.IsNullOrEmpty(pictureBox1.ImageLocation) ? File.ReadAllBytes(pictureBox1.ImageLocation) : this.oldEleve?.Photo
                                 );

                EleveBLO eleveBLo = new EleveBLO(ConfigurationManager.AppSettings["DbFolder"]);

                if (this.oldEleve == null)
                {
                    eleveBLo.CreateEleve(newEleve);
                }
                else
                {
                    eleveBLo.EditEtudiant(oldEleve, newEleve);
                }

                MessageBox.Show
                (
                    "Save done !",
                    "Confirmation",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information
                );

                if (callBack != null)
                {
                    callBack();
                }

                if (oldEleve != null)
                {
                    Close();
                }

                txtMatricule.Clear();
                txtNom.Clear();
                txtPrenom.Clear();
                txtNaissance.Clear();
                txtVille.Clear();
                txtEcole.Clear();
            }
            catch (TypingException ex)
            {
                MessageBox.Show
                (
                    ex.Message,
                    "Typing error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning
                );
            }
            catch (DuplicateNameException ex)
            {
                MessageBox.Show
                (
                    ex.Message,
                    "Duplicate error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning
                );
            }
            catch (KeyNotFoundException ex)
            {
                MessageBox.Show
                (
                    ex.Message,
                    "Not found error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning
                );
            }
            catch (Exception ex)
            {
                ex.WriteToFile();
                MessageBox.Show
                (
                    "An error occurred! Please try again later.",
                    "Erreur",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                );
            }
        }