public ListViewCompetence() { InitializeComponent(); using (BBD_projetEntities db = new BBD_projetEntities()) { var l = db.LangueParDefaut(); var req = from c in db.Competences join b in db.IntituleCompetences on c.Id_Competence equals b.Id_Competence where b.Id_Langue == l select c; listCompetences = new List <BO.Competence>(); foreach (Competence c in req.ToList()) { listCompetences.Add ( new BO.Competence() { Actuel = c.Actuel, Actif = c.Actif, Annee = c.Annee, Id_Competence = c.Id_Competence, Id_CompetenceActuel = c.Id_CompetenceActuel, IntituleCompetence = c.IntituleCompetences.FirstOrDefault().intitule.ToString() } ); } list.ItemsSource = listCompetences; list.SelectionChanged += (sender, e) => { System.Diagnostics.Debug.WriteLine(list.SelectedItem); }; } }
public CreateCompetence() { InitializeComponent(); this.DataContext = this; using (var db = new BBD_projetEntities()) { var val = db.LangueParDefaut(); var req = from c in db.OffrantParCompetenceAvecLangueEtIntituleActu(8, 3) select c; foreach (var v in req) { this.DataContext = v.Description; } var req2 = from c in db.Langues select c; var List = BO.Langue.ListDALtoBO(req2.ToList()); list.ItemsSource = List; list.SelectedValuePath = "Id_Langue"; var req3 = from c in db.Competences where c.Actuel == true && c.Actif == true select new BO.Competence { Actuel = c.Actuel, IntituleCompetence = c.IntituleCompetences.Where(b => b.Id_Langue == val).Select(b => b.intitule).FirstOrDefault(), Annee = c.Annee, Id_Competence = c.Id_Competence, Id_CompetenceActuel = c.Id_CompetenceActuel }; list.SelectedIndex = List.IndexOf(List.Where(c => c.Id_Langue == val).Select(c => c).FirstOrDefault()); list2.ItemsSource = req3.ToList(); C3.SelectedDate = DateTime.Now; } }
public ModificationCompetence(BO.Competence competence) { InitializeComponent(); Competence = competence; using (var db = new BBD_projetEntities()) { var val = db.LangueParDefaut(); var req = from c in db.OffrantParCompetenceAvecLangueEtIntituleActu(8, 3) select c; foreach (var v in req) { this.DataContext = v.Description; } var req2 = from c in db.Langues select c; var List = BO.Langue.ListDALtoBO(req2.ToList()); list.ItemsSource = List; list.SelectedValuePath = "Id_Langue"; var req3 = from c in db.Competences where c.Actuel == true && c.Actif == true select new BO.Competence { Actuel = c.Actuel, IntituleCompetence = c.IntituleCompetences.Where(b => b.Id_Langue == val).Select(b => b.intitule).FirstOrDefault(), Annee = c.Annee, Id_Competence = c.Id_Competence, Id_CompetenceActuel = c.Id_CompetenceActuel }; list2.ItemsSource = req3.ToList(); //Actif this.Actif = Competence.Actif; if (this.Actif == true) { B_Actif.IsChecked = true; } //Actuel this.Actuel = Competence.Actuel; if (this.Actuel == true) { B_Actuel.IsChecked = true; } } }
public override string ToString() { using (var db = new BBD_projetEntities()) { var l = db.LangueParDefaut(); var req = from i in db.IntituleCompetences where i.Id_Langue == l && i.Id_Competence == this.Id_Competence select i; if (req.ToList().Count() > 0) { return(req.ToList().First().intitule); } else { return("Id de la compétence : " + this.Id_Competence); } } }
public Menu() { InitializeComponent(); using (var db = new BBD_projetEntities()) { languedef = db.LangueParDefaut(); var Competence = from c in db.Competences select new BO.Competence { Actuel = c.Actuel, IntituleCompetence = c.IntituleCompetences.Where(b => b.Id_Langue == languedef).Select(b => b.intitule).FirstOrDefault(), Annee = c.Annee, Id_Competence = c.Id_Competence, Id_CompetenceActuel = c.Id_CompetenceActuel }; var Groupe = from g in db.Groupes select g; var Employe = from e in db.Employes select e; var Categorie = from c in db.Categories select c; var langue = from c in db.Langues select c; ListEmploye = BO.Employe.ListDalToBO(Employe.ToList()); ListCompetence = Competence.ToList(); ListGroupe = BO.Groupe.ListDalToBO(Groupe.ToList()); listCategorie = Categorie.ToList(); listLangue = langue.ToList(); listDalLangue.ItemsSource = listLangue; listViewCompetence.ItemsSource = ListCompetence; listViewEmploye.ItemsSource = ListEmploye; listViewGroupe.ItemsSource = ListGroupe; listDal.ItemsSource = listCategorie; ComboPicker.SelectedIndex = 4; } }
public Groupe() { InitializeComponent(); Date.BlackoutDates.Add(new CalendarDateRange(new DateTime(1990, 1, 1), DateTime.Now.AddDays(-1))); using (var db = new BBD_projetEntities()) { var val = db.LangueParDefaut(); var participant = from employe in db.Employes select new BO.Employe { Nom = employe.Nom, Prenom = employe.Prenom, Service = employe.Service, Id_Employe = employe.Id_Employe }; var competence = from c in db.Competences where c.Actif == true && c.Actuel == true select new BO.Competence { Actuel = c.Actuel, IntituleCompetence = c.IntituleCompetences.Where(b => b.Id_Langue == val).Select(b => b.intitule).FirstOrDefault(), Annee = c.Annee, Id_Competence = c.Id_Competence, Id_CompetenceActuel = c.Id_CompetenceActuel }; //Particpant ListViewParticipant.ItemsSource = participant.ToList(); ListViewParticipant.MouseDoubleClick += (sender, e) => { var Nouveauparticipant = ((BO.Employe)ListViewParticipant.SelectedItem); var verifdoublons = 0; foreach (var x in ListParticipant) { if (x.Id_Employe == Nouveauparticipant.Id_Employe) { verifdoublons = 1; } } if (verifdoublons == 0) { ListParticipant.Add(Nouveauparticipant); foreach (var x in ListBoxTuteur.ItemsSource) { System.Diagnostics.Debug.WriteLine(((BO.Employe)x).Nom); } ListBoxTuteur.Items.Refresh(); } }; //Tuteur ListBoxTuteur.ItemsSource = ListParticipant; ListBoxTuteur.SelectionChanged += (sender, e) => { Tuteur = ((BO.Employe)ListBoxTuteur.SelectedItem); }; //Competence ListViewCompetence.ItemsSource = competence.ToList(); ListViewCompetence.SelectionChanged += (sender, e) => { Competence = ((BO.Competence)ListViewCompetence.SelectedItem); }; } }
public CreationEmploye() { InitializeComponent(); using (var db = new BBD_projetEntities()) { var val = db.LangueParDefaut(); var competence = from c in db.Competences where c.Actif == true && c.Actuel == true select new BO.Competence { Actuel = c.Actuel, IntituleCompetence = c.IntituleCompetences.Where(b => b.Id_Langue == val).Select(b => b.intitule).FirstOrDefault(), Annee = c.Annee, Id_Competence = c.Id_Competence, Id_CompetenceActuel = c.Id_CompetenceActuel }; var ListDesCompetences = competence.ToList(); var langue = from l in db.Langues select l; var ListDeLangue = BO.Langue.ListDALtoBO(langue.ToList());; ListViewCompetence.ItemsSource = ListDesCompetences; ListViewCompetence.MouseDoubleClick += (sender, e) => { var NouvelleCompetence = ((BO.Competence)ListViewCompetence.SelectedItem); var verifdoublons = 0; foreach (var x in ListBoC) { if (x.Id_Competence == NouvelleCompetence.Id_Competence) { verifdoublons = 1; } } if (verifdoublons == 0) { ListBoC.Add(NouvelleCompetence); ListBoxCompetence.Items.Refresh(); } }; ListBoxCompetence.ItemsSource = ListBoC; ListBoxLangue.ItemsSource = ListDeLangue; ListBoxLangue.MouseDoubleClick += (sender, e) => { var NouvelleLangue = ((BO.Langue)ListBoxLangue.SelectedItem); var verifdoublons = 0; foreach (var x in ListBoL) { if (x.Id_Langue == NouvelleLangue.Id_Langue) { verifdoublons = 1; } } if (verifdoublons == 0) { ListBoL.Add(NouvelleLangue); ListBoxLangueSelection.Items.Refresh(); } }; ListBoxLangueSelection.ItemsSource = ListBoL; } }
private void b_Click(object sender, RoutedEventArgs e) { using (var db = new BBD_projetEntities()) { BO.Competence t = (BO.Competence)list2.SelectedItem; DAL.Competence objet = null; var objet2 = new DAL.IntituleCompetence(); test2.Content = Actif.ToString(); IEnumerable <IntituleCompetence> req = null; if (((int?)list.SelectedValue) != null) { req = (from c in db.IntituleCompetences where c.Id_Competence == Competence.Id_Competence && c.Id_Langue == ((int)list.SelectedValue) select new { Competence = c.Competence, Id_Langue = c.Id_Langue, Id_Competence = c.Id_Competence, Description = c.Description, intitule = c.intitule, Langue = c.Langue }).ToList().Select(c => new DAL.IntituleCompetence { Competence = c.Competence, Id_Langue = c.Id_Langue, Id_Competence = c.Id_Competence, Description = c.Description, intitule = c.intitule, Langue = c.Langue }); } if (!(req == null) || (req != null && req.ToList().Count > 0)) { var o = new BO.IntituleCompetence(req.ToList()[0]); var IcObjet = db.IntituleCompetences.Find(o.Id_Competence, o.Id_Langue); IcObjet.intitule = C1.Text; IcObjet.Description = C2.Text; if (list.SelectedItem == null) { IcObjet.Id_Langue = db.LangueParDefaut(); } else { IcObjet.Id_Langue = ((int)list.SelectedValue); } } else { if (list.SelectedItem == null) { var LangueParDef = db.LangueParDefaut(); if ((from c in db.IntituleCompetences where c.Id_Competence == Competence.Id_Competence && c.Id_Langue == LangueParDef select new { }).Count() > 1) { objet2 = new DAL.IntituleCompetence() { intitule = C1.Text, Description = C2.Text, Id_Langue = db.LangueParDefaut(), Id_Competence = Competence.Id_Competence, Competence = db.Competences.Find(Competence.Id_Competence), Langue = db.Langues.Find(db.LangueParDefaut()) }; System.Diagnostics.Debug.WriteLine(objet2.intitule); System.Diagnostics.Debug.WriteLine(objet2.Description); System.Diagnostics.Debug.WriteLine(objet2.Id_Langue); System.Diagnostics.Debug.WriteLine(objet2.Id_Competence); db.IntituleCompetences.Add(objet2); } else { //work var IcObjet = db.IntituleCompetences.Find(Competence.Id_Competence, db.LangueParDefaut()); IcObjet.intitule = C1.Text; IcObjet.Description = C2.Text; } } else { objet2 = new DAL.IntituleCompetence() { intitule = C1.Text, Description = C2.Text, Id_Langue = ((int)list.SelectedValue), Id_Competence = Competence.Id_Competence }; db.IntituleCompetences.Add(objet2); } } var DALCompetence = db.Competences.Find(Competence.Id_Competence); if (list2.SelectedValue != null) { DALCompetence.Id_CompetenceActuel = t.Id_Competence; } /* System.Diagnostics.Debug.WriteLine(C3.SelectedDate == null); * System.Diagnostics.Debug.WriteLine(C3.SelectedDate != null); * System.Diagnostics.Debug.WriteLine(!(C3.SelectedDate == null));*/ if (C3.SelectedDate != null) { DALCompetence.Annee = C3.SelectedDate.ToString(); } if (DALCompetence.Actif == this.Actif) { DALCompetence.Actif = this.Actif; } System.Diagnostics.Debug.WriteLine(C3.SelectedDate.ToString()); System.Diagnostics.Debug.WriteLine(DALCompetence.Annee); System.Diagnostics.Debug.WriteLine(!(C3.SelectedDate == null)); db.SaveChanges(); ListViewCompetence l = new ListViewCompetence(); this.NavigationService.Navigate(new Uri("ListViewCompetence.xaml", UriKind.Relative)); } }
public ModificationGroupe(BO.Groupe groupe) { InitializeComponent(); Date.BlackoutDates.Add(new CalendarDateRange(new DateTime(1990, 1, 1), DateTime.Now.AddDays(-1))); System.Diagnostics.Debug.WriteLine(groupe.Id_Groupe); using (var db = new BBD_projetEntities()) { Groupe = groupe; Titre.Text = groupe.Titre; ListBoxTuteur.ItemsSource = groupe.Participant; Tuteur = groupe.Tuteur; var val = db.LangueParDefaut(); var participant = from employe in db.Employes select new BO.Employe { Nom = employe.Nom, Prenom = employe.Prenom, Service = employe.Service, Id_Employe = employe.Id_Employe }; var competence = from c in db.Competences where c.Actif == true && c.Actuel == true select new BO.Competence { Actuel = c.Actuel, IntituleCompetence = c.IntituleCompetences.Where(b => b.Id_Langue == val).Select(b => b.intitule).FirstOrDefault(), Annee = c.Annee, Id_Competence = c.Id_Competence, Id_CompetenceActuel = c.Id_CompetenceActuel }; var wow = competence.ToList(); var ListDeParticipant = participant.ToList(); System.Diagnostics.Debug.WriteLine(groupe.DateReunion); if (DateTime.Now < groupe.DateReunion) { Date.SelectedDate = groupe.DateReunion; } //Competence ListViewCompetence.ItemsSource = competence.ToList(); ListViewCompetence.SelectedIndex = wow.IndexOf(wow.Where(c => c.Id_Competence == groupe.Id_Competence).Select(c => c).FirstOrDefault()); Competence = wow.Where(c => c.Id_Competence == groupe.Id_Competence).Select(c => c).FirstOrDefault(); ListViewCompetence.SelectionChanged += (sender, e) => { Competence = ((BO.Competence)ListViewCompetence.SelectedItem); }; ///Comment afficher correctement ce qui est dans al base de données //Particpant ListViewParticipant.ItemsSource = participant.ToList(); ListViewParticipant.MouseDoubleClick += (sender, e) => { if (ListViewParticipant.SelectedItem is BO.Employe) { var Nouveauparticipant = ((BO.Employe)ListViewParticipant.SelectedItem); var verifdoublons = 0; foreach (var x in groupe.Participant) { if (x.Id_Employe == Nouveauparticipant.Id_Employe) { verifdoublons = 1; } } if (verifdoublons == 0) { groupe.Participant.Add(Nouveauparticipant); foreach (var x in ListBoxTuteur.ItemsSource) { System.Diagnostics.Debug.WriteLine(((BO.Employe)x).Nom); } ListBoxTuteur.Items.Refresh(); } } }; //Tuteur System.Diagnostics.Debug.WriteLine(Groupe.Participant.IndexOf(Groupe.Participant.Where(c => c.Id_Employe == Tuteur.Id_Employe).FirstOrDefault())); if (Tuteur != null) { ListBoxTuteur.SelectedIndex = Groupe.Participant.IndexOf(Groupe.Participant.Where(c => c.Id_Employe == Tuteur.Id_Employe).FirstOrDefault()); } ListBoxTuteur.SelectionChanged += (sender, e) => { Tuteur = ((BO.Employe)ListBoxTuteur.SelectedItem); }; } }