示例#1
0
        private void saveStudent(object sender, RoutedEventArgs e)
        {
            string nomfil = filiereComboBox.SelectedItem.ToString();
            int    idfil  = (from f in cl.Filieres where nomfil.Equals(f.Nom_filiere) select f.Id_filiere).SingleOrDefault();
            int    cne    = Int32.Parse(studentCne.Text);
            string nom    = studentName.Text;
            string prenom = studentLastName.Text;
            string sexe   = sexeStudent.SelectedItem.ToString();
            char   sexeEt = 'F';

            if (sexe.Equals("F"))
            {
                sexeEt = 'F';
            }
            else if (sexe.Equals("M"))
            {
                sexeEt = 'M';
            }

            string   date     = date_naissStudent.SelectedDate.ToString();
            etudiant etudiant = new etudiant();

            etudiant.id_fil     = idfil;
            etudiant.cne        = cne;
            etudiant.nom        = nom;
            etudiant.prenom     = prenom;
            etudiant.sexe       = sexeEt;
            etudiant.date_naiss = DateTime.Parse(date);

            cl.etudiants.InsertOnSubmit(etudiant);
            cl.SubmitChanges();
            collectionStudents.Add(etudiant);
            studentsListView.ItemsSource = collectionStudents;
            addStudentForm.Visibility    = Visibility.Hidden;
        }
示例#2
0
        private void updateStudent(object sender, RoutedEventArgs e)
        {
            etudiant etd = studentsListView.SelectedItem as etudiant;

            if (etd != null)
            {
                updateStudentForm.Visibility     = Visibility.Visible;
                newstudentCne.Text               = etd.cne.ToString();
                newstudentName.Text              = etd.nom;
                newstudentLastName.Text          = etd.prenom;
                newdate_naissStudent.DisplayDate = etd.date_naiss.Value;
            }
            else
            {
                MessageBox.Show(this, "Veuillez selectionnez un étudiant");
            }
        }
示例#3
0
        private void deleteStudent(object sender, RoutedEventArgs e)
        {
            etudiant etd = studentsListView.SelectedItem as etudiant;

            if (etd != null)
            {
                cl.etudiants.DeleteOnSubmit(etd);
                collectionStudents.Remove(etd);
                cl.SubmitChanges();
                MessageBox.Show("Etudiant supprimé");
                collectionStudents.Remove(etd);
                studentsListView.ItemsSource = collectionStudents;
            }
            else
            {
                MessageBox.Show(this, "Veuillez selectionnez un étudiant");
            }
        }
示例#4
0
 private void detach_etudiants(etudiant entity)
 {
     this.SendPropertyChanging();
     entity.Filiere = null;
 }
示例#5
0
 private void attach_etudiants(etudiant entity)
 {
     this.SendPropertyChanging();
     entity.Filiere = this;
 }
示例#6
0
 partial void Deleteetudiant(etudiant instance);
示例#7
0
 partial void Updateetudiant(etudiant instance);
示例#8
0
 partial void Insertetudiant(etudiant instance);