private void Browse_Click(object sender, MouseButtonEventArgs e) { OpenFileDialog open = new OpenFileDialog(); String filepath; open.Multiselect = false; if (open.ShowDialog() == true) { filepath = open.FileName; string name = System.IO.Path.GetFileName(filepath); string appStartPathModified = String.Format(path + "\\{0}\\" + name, "photos"); try { File.Copy(filepath, appStartPathModified, true); } catch (Exception ex) { } etudiant etudiant = getEtudiant(); etudiant.image = name; db.SubmitChanges(); photo.Source = new BitmapImage(new Uri(etudiant.myImage, UriKind.Absolute)); } }
public ClasseEtudiant convertEtudiant(etudiant e) { ClasseEtudiant etu = new ClasseEtudiant(); etu.Cne = e.cne; etu.Nom = e.nom; etu.Prenom = e.prenom; etu.Filiere = e.Filiere.Nom_filiere; try { etu.Date_naiss = (DateTime)e.date_naiss; } catch (Exception ex) { etu.Date_naiss = new DateTime(); } if (e.sexe.Equals('H')) { etu.Sexe = Gender.Homme; } else { etu.Sexe = Gender.Femme; } return(etu); }
private void Click_btn_modifier(object sender, RoutedEventArgs e) { etudiant etu = gridView.SelectedItem as etudiant; if (etu == null) { MessageBox.Show("Selectionner un étudiant Svp !"); } else { this.NavigationService.Navigate(new PageGestionEt(etu)); } }
public PageGestionEt(etudiant et) { InitializeComponent(); this.DataContext = this; model = new FromLinq(); list = model.EtudiantList.ToList(); radDataForm1.ItemsSource = list; if (et != null) { etudiant = model.convertEtudiant(et); radDataForm1.CurrentIndex = getIndex(); string url = et.prenom.ToString(); } path = Directory.GetParent(Environment.CurrentDirectory).Parent.FullName; }
partial void Deleteetudiant(etudiant instance);
partial void Updateetudiant(etudiant instance);
partial void Insertetudiant(etudiant instance);
private void detach_etudiant(etudiant entity) { this.SendPropertyChanging(); entity.Filiere = null; }
private void attach_etudiant(etudiant entity) { this.SendPropertyChanging(); entity.Filiere = this; }
private void Data_EditEnding(object sender, Telerik.Windows.Controls.Data.DataForm.EditEndingEventArgs e) { ClasseEtudiant student = radDataForm1.CurrentItem as ClasseEtudiant; var x = (from etudiant in db.etudiant join filiere in db.Filiere on etudiant.id_fil equals filiere.Id_filiere where etudiant.cne == student.Cne select etudiant).SingleOrDefault(); if (x != null) { x.nom = student.Nom; x.prenom = student.Prenom; x.date_naiss = student.Date_naiss; if (student.Sexe == Gender.Femme) { x.sexe = 'F'; } else if (student.Sexe == Gender.Homme) { x.sexe = 'H'; } else { x.sexe = 'X'; } db.SubmitChanges(); } else { bool erreur = false; ClasseEtudiant item = radDataForm1.CurrentItem as ClasseEtudiant; etudiant et = new etudiant(); et.cne = item.Cne; et.nom = item.Nom; et.prenom = item.Prenom; et.date_naiss = item.Date_naiss; if (et.image == null) { et.image = "default.png"; } if (student.Sexe == Gender.Femme) { et.sexe = 'F'; } else if (student.Sexe == Gender.Homme) { et.sexe = 'H'; } else { et.sexe = 'X'; } bool find = false; int id = 0; var fil = from f in db.Filiere select f; foreach (Filiere f in fil) { if (f.Nom_filiere.Equals(item.Filiere)) { find = true; id = f.Id_filiere; } } if (find) { et.id_fil = id; } else { MessageBox.Show("Veuillez Entrer une filiere valide !"); erreur = true; } if (!erreur) { db.etudiant.InsertOnSubmit(et); db.SubmitChanges(); } } }