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; }
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"); } }
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"); } }
private void detach_etudiants(etudiant entity) { this.SendPropertyChanging(); entity.Filiere = null; }
private void attach_etudiants(etudiant entity) { this.SendPropertyChanging(); entity.Filiere = this; }
partial void Deleteetudiant(etudiant instance);
partial void Updateetudiant(etudiant instance);
partial void Insertetudiant(etudiant instance);