Exemplo n.º 1
0
        private void modifier_Click(object sender, EventArgs e)
        {
            var x = (from etd in db.etudiants
                     where etd.cne == Convert.ToInt32(listeCne.SelectedItem.ToString())
                     select etd).SingleOrDefault();
            etudiant etdd = x as etudiant;

            x.date_naiss = dateN.Text;
            x.adresse    = adresse.Text;
            char sex = ' ';

            if (male.Checked)
            {
                sex = 'M';
            }
            else
            {
                sex = 'F';
            }
            x.sexe      = sex;
            x.nom       = Nom.Text;
            x.prenom    = prenom.Text;
            x.telephone = telephone.Text;
            var id = from f in db.Filieres
                     where f.nom_Filiere.Equals(comboBox1.SelectedItem.ToString())
                     select f.id_Filiere;

            foreach (int y in id)
            {
                x.id_fil = y;
                break;
            }
            db.SubmitChanges();
        }
Exemplo n.º 2
0
        private void chargerDonnees_Click_1(object sender, EventArgs e)
        {
            var x = from etd in db.etudiants
                    join std in db.Filieres
                    on etd.id_fil equals std.id_Filiere
                    select new { etd.id_fil, etd.nom, etd.prenom, etd.sexe, etd.date_naiss, etd.adresse, etd.telephone, std.nom_Filiere };

            etudiant e1 = x as etudiant;

            dataGridView2.DataSource = x;
        }
Exemplo n.º 3
0
        public Etudiant selectedEtudiant()
        {
            int cneSelected = Convert.ToInt32(listeCne.SelectedItem.ToString());
            var etdSelected = (from etd in db.etudiants
                               where etd.cne == cneSelected
                               select etd).SingleOrDefault();
            etudiant e1      = etdSelected as etudiant;
            Etudiant student = new Etudiant(e1.nom, e1.prenom, e1.date_naiss, e1.adresse, e1.telephone, e1.cne, Convert.ToInt32(e1.id_fil), Convert.ToChar(e1.sexe));

            return(student);
        }
Exemplo n.º 4
0
        private void ajouter_Click_1(object sender, EventArgs e)
        {
            var x = (from etd in db.etudiants
                     where etd.cne == Convert.ToInt32(cne.Text)
                     select etd).SingleOrDefault();
            etudiant etdd = x as etudiant;

            if (etdd == null)
            {
                char sex = ' ';
                if (male.Checked)
                {
                    sex = 'M';
                }
                else
                {
                    sex = 'F';
                }
                etudiant etd = new etudiant();
                etd.cne        = Int32.Parse(cne.Text);
                etd.date_naiss = dateN.Text;
                etd.adresse    = adresse.Text;
                etd.sexe       = sex;
                etd.nom        = Nom.Text;
                etd.prenom     = prenom.Text;

                var id = from f in db.Filieres
                         where f.nom_Filiere.Equals(comboBox1.SelectedItem.ToString())
                         select f.id_Filiere;
                foreach (int y in id)
                {
                    etd.id_fil = y;
                    break;
                }

                etd.telephone = telephone.Text;
                db.etudiants.InsertOnSubmit(etd);
                db.SubmitChanges();
            }
            else
            {
                MessageBox.Show("Etudiant existe dèja");
            }
        }
Exemplo n.º 5
0
        private void charger_Click_1(object sender, EventArgs e)
        {
            if (textBox1.Text.Equals(""))
            {
                MessageBox.Show("Veuillez séléctionner un fichier");
            }
            else
            {
                DataTable listeFromTheFile = GetDataTabletFromCSVFile(textBox1.Text);
                foreach (DataRow dataRow in listeFromTheFile.Rows)
                {
                    int    cne     = Convert.ToInt32(dataRow.ItemArray.GetValue(0));
                    String nom     = dataRow.ItemArray.GetValue(1).ToString();
                    String prenom  = dataRow.ItemArray.GetValue(2).ToString();
                    Char   sexe    = Convert.ToChar(dataRow.ItemArray.GetValue(3));
                    String dateN   = dataRow.ItemArray.GetValue(4).ToString();
                    String adresse = dataRow.ItemArray.GetValue(5).ToString();
                    String tel     = dataRow.ItemArray.GetValue(6).ToString();
                    int    idFil   = Convert.ToInt32(dataRow.ItemArray.GetValue(7));

                    var x = (from etd in db.etudiants
                             where etd.cne == cne
                             select etd).SingleOrDefault();
                    etudiant etdd = x as etudiant;
                    if (etdd == null)
                    {
                        etudiant etd = new etudiant();
                        etd.cne        = cne;
                        etd.date_naiss = dateN;
                        etd.adresse    = adresse;
                        etd.sexe       = sexe;
                        etd.nom        = nom;
                        etd.prenom     = prenom;
                        etd.id_fil     = idFil;
                        etd.telephone  = tel;
                        db.etudiants.InsertOnSubmit(etd);
                        db.SubmitChanges();
                    }
                }
            }
        }
Exemplo n.º 6
0
 private void detach_etudiants(etudiant entity)
 {
     this.SendPropertyChanging();
     entity.Filiere = null;
 }
Exemplo n.º 7
0
 private void attach_etudiants(etudiant entity)
 {
     this.SendPropertyChanging();
     entity.Filiere = this;
 }
Exemplo n.º 8
0
 partial void Deleteetudiant(etudiant instance);
Exemplo n.º 9
0
 partial void Updateetudiant(etudiant instance);
Exemplo n.º 10
0
 partial void Insertetudiant(etudiant instance);