public ListViewGroup() { InitializeComponent(); using (var db = new BBD_projetEntities()) { var req = (from g in db.Groupes select new { DateReunion = g.DateReunion, Id_Competence = g.Id_Competence, Id_Groupe = g.Id_Groupe, Titre = g.Titre }).ToList().Select(g => new DAL.Groupe { DateReunion = g.DateReunion, Id_Competence = g.Id_Competence, Id_Groupe = g.Id_Groupe, Titre = g.Titre }); listGroupes = BO.Groupe.ListDalToBO(req.ToList()); foreach (var x in listGroupes) { System.Diagnostics.Debug.WriteLine(x.Id_Groupe); } List.ItemsSource = listGroupes; } }
private void ButtonRecherche_Click(object sender, RoutedEventArgs e) { using (var db = new BBD_projetEntities()) { var participant = from employe in db.Employes where //employe.Nom == TextRecherche.Text || employe.Prenom == TextRecherche.Text || employe.Service == TextRecherche.Text SqlFunctions.PatIndex("%" + TextRecherche.Text + "%", employe.Nom) > 0 || SqlFunctions.PatIndex("%" + TextRecherche.Text + "%", employe.Prenom) > 0 || SqlFunctions.PatIndex("%" + TextRecherche.Text + "%", employe.Service) > 0 select new BO.Employe { Nom = employe.Nom, Prenom = employe.Prenom, Service = employe.Service, Id_Employe = employe.Id_Employe }; foreach (var x in participant.ToList()) { System.Diagnostics.Debug.WriteLine(x.Id_Employe); } ListViewParticipant.ItemsSource = participant.ToList(); ListViewParticipant.Items.Refresh(); } }
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); }; } }
private void Suppression_Click(object sender, RoutedEventArgs e) { using (var db = new BBD_projetEntities()) { var ObjSupp = (from g in db.Groupes where g.Id_Groupe == ((BO.Groupe)List.SelectedItem).Id_Groupe select g).ToList(); if (ObjSupp.Count != 0) { var ObjSupp2 = (from m in db.Membres where m.Id_Groupe == ((BO.Groupe)List.SelectedItem).Id_Groupe select m).ToList(); foreach (var x in ObjSupp2) { db.Membres.Remove(x); } var ObjSupp3 = (from x in db.Messageries where x.Id_Groupe == ((BO.Groupe)List.SelectedItem).Id_Groupe select x).ToList(); foreach (var w in ObjSupp3) { db.Messageries.Remove(w); } db.Groupes.Remove(ObjSupp.First()); db.SaveChanges(); listGroupes.Remove((BO.Groupe)List.SelectedItem); List.Items.Refresh(); } } }
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 ModificationCategorie(DAL.Categorie categorie) { InitializeComponent(); Categorie = categorie; var id = Categorie.Id_Categorie; var nom = Categorie.Intitule; var lastSuperId = Categorie.Id_Super_Categorie; CategorieName.Text = nom; List <DAL.Langue> listLangue = new List <DAL.Langue>(); List <DAL.Categorie> listCategorie = new List <DAL.Categorie>(); using (var db = new BBD_projetEntities()) { // partie pour récupérer la liste var req = (from c in db.Categories select new { IdCategorie = c.Id_Categorie, intitule = c.Intitule, superID = c.Id_Super_Categorie }).ToList().Select(l => new DAL.Categorie { Id_Categorie = l.IdCategorie, Intitule = l.intitule, Id_Super_Categorie = l.superID }); listCategorie = req.ToList(); listCategorieDal.ItemsSource = listCategorie; listCategorieDal.SelectedIndex = listCategorie.IndexOf(listCategorie.Where(c => c.Id_Categorie == categorie.Id_Super_Categorie).Select(c => c).FirstOrDefault()); var req2 = from c in db.Langues join b in db.IntituleCategories on c.Id_Langue equals b.Id_Langue where b.Id_Categorie == categorie.Id_Categorie & b.intitule == categorie.Intitule select new BO.Langue { Id_Langue = c.Id_Langue, Nom = c.Nom }; var langue = req2.ToList(); try { Langue.Text = langue.FirstOrDefault().Nom; } catch (Exception) { Langue.Text = "Warning : Pas de langue attribué"; } } }
private void ToggleButton_Click(object sender, RoutedEventArgs e) { using (var db = new BBD_projetEntities()) { var Item = db.Langues.Find(Langue.Id_Langue); //MessageBoxResult result = MessageBox.Show(Langue.Nom); Item.Nom = NewLangue.Text; Item.Default = NewDefault.IsChecked.Value; db.SaveChanges(); } NavigationService.Navigate(new ListViewLangue()); }
public ListViewEmploye() { InitializeComponent(); using (var db = new BBD_projetEntities()) { var req = from e in db.Employes select e; listemploye = BO.Employe.ListDalToBO(req.ToList()); System.Diagnostics.Debug.WriteLine(listemploye[0].Metier); list.ItemsSource = listemploye; } }
private void DeleteLangue_Click(object sender, RoutedEventArgs e) { var Item = (DAL.Langue)listDal.SelectedItem; MessageBoxResult result = MessageBox.Show("Warning : Vous allez supprimer " + Item.Nom); using (var db = new BBD_projetEntities()) { db.Langues.Attach(Item); db.Langues.Remove(Item); db.SaveChanges(); } NavigationService.Navigate(new ListViewLangue()); }
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; } } }
private void Suppression_Click(object sender, RoutedEventArgs e) { using (var db = new BBD_projetEntities()) { var ObjSupp5 = (from c in db.Competences where c.Id_Competence == ((BO.Competence)list.SelectedItem).Id_Competence select c).ToList(); if (ObjSupp5.Count != 0) { var ObjSupp = (from ic in db.IntituleCompetences where ic.Id_Competence == ((BO.Competence)list.SelectedItem).Id_Competence select ic).ToList(); foreach (var x in ObjSupp) { db.IntituleCompetences.Remove(x); } var ObjSupp2 = (from lc in db.LiaisonCompetences where lc.Id_Competence == ((BO.Competence)list.SelectedItem).Id_Competence select lc).ToList(); foreach (var x in ObjSupp2) { db.LiaisonCompetences.Remove(x); } var ObjSupp3 = (from d in db.Demandes where d.Id_Competence == ((BO.Competence)list.SelectedItem).Id_Competence select d).ToList(); foreach (var z in ObjSupp3) { db.Demandes.Remove(z); } var ObjSupp4 = (from n in db.Notes where n.Id_Competence == ((BO.Competence)list.SelectedItem).Id_Competence select n).ToList(); foreach (var m in ObjSupp4) { db.Notes.Remove(m); } db.Competences.Remove(ObjSupp5.First()); db.SaveChanges(); listCompetences.Remove(((BO.Competence)list.SelectedItem)); list.Items.Refresh(); } } }
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); } } }
private void Connexion_Click(object sender, RoutedEventArgs e) { using (var db = new BBD_projetEntities()) { var Mot = ComputeSha256Hash(MDP.Text); var id = ComputeSha256Hash(Id.Text); var req = (from em in db.Employes where em.Identifiant == id && em.MotDePasse == Mot && (em.EstAdmin == true || em.EstChefDeService == true) select em).ToList(); if (req.Count == 1) { NavigationService.Navigate(new Menu()); } else { MessageBoxResult result = MessageBox.Show("Aucun Correspondance trouvée !"); } } }
private void ToggleButton_Click(object sender, RoutedEventArgs e) { var newCategorie = (DAL.Categorie)listCategorieDal.SelectedItem; try { using (var db = new BBD_projetEntities()) { var Item = db.Categories.Find(Categorie.Id_Categorie); Item.Intitule = CategorieName.Text; Item.Id_Super_Categorie = newCategorie.Id_Categorie; db.SaveChanges(); } NavigationService.Navigate(new ListViewCategorie()); } catch (Exception) { MessageBoxResult result = MessageBox.Show("Warning : vous n'avez pas saisie d'id_super_categorie"); } }
public CreateCategorie() { InitializeComponent(); List <DAL.Langue> listLangue = new List <DAL.Langue>(); using (var db = new BBD_projetEntities()) { // partie pour récupérer la liste var req = (from c in db.Categories select new { IdCategorie = c.Id_Categorie, intitule = c.Intitule, superID = c.Id_Super_Categorie }).ToList().Select(l => new DAL.Categorie { Id_Categorie = l.IdCategorie, Intitule = l.intitule, Id_Super_Categorie = l.superID }); listCategorie = req.ToList(); listCategorieDal.ItemsSource = listCategorie; var req2 = (from l in db.Langues select new { IdLangue = l.Id_Langue, Nom = l.Nom, defaut = l.Default }).ToList().Select(l => new DAL.Langue { Id_Langue = l.IdLangue, Nom = l.Nom, Default = l.defaut }); listLangue = req2.ToList(); listLangueDal.ItemsSource = listLangue; } }
private void ToggleButton_Click(object sender, RoutedEventArgs e) { var checkError = 0; foreach (var item in langue) { if (NewLangue.Text == item.Nom) { checkError = 1; } } if (NewLangue.Text == "") { checkError = 2; } if (checkError == 0) { using (var db = new BBD_projetEntities()) { var newLangue = NewLangue.Text; var dalLangue = new DAL.Langue(); dalLangue.Nom = newLangue; dalLangue.Default = defaultLangue.IsChecked.Value; db.Langues.Add(dalLangue); db.SaveChanges(); NavigationService.Navigate(new ListViewLangue()); } } else if (checkError == 1) { MessageBoxResult resultDelta = MessageBox.Show("Warning : Nom de langue deja créer"); } else { MessageBoxResult resultDelta = MessageBox.Show("Warning : Vous n'avez pas mis de nom"); } }
public CreateLangue() { InitializeComponent(); using (var db = new BBD_projetEntities()) { // partie pour récupérer la liste var req = (from l in db.Langues select new { IdLangue = l.Id_Langue, Nom = l.Nom, defaut = l.Default }).ToList().Select(l => new DAL.Langue { Id_Langue = l.IdLangue, Nom = l.Nom, Default = l.defaut }); langue = req.ToList(); } }
public Groupe(DAL.Groupe groupe) { using (var db = new BBD_projetEntities()) { var reqTuteur = from employe in db.Employes join membre in db.Membres on employe.Id_Employe equals membre.Id_Employe where membre.Id_Groupe == groupe.Id_Groupe && membre.EstTutorant == true select new BO.Employe { Id_Employe = employe.Id_Employe, Nom = employe.Nom, Prenom = employe.Prenom, Service = employe.Service }; var reqNbParticipant = from employe in db.Employes join membre in db.Membres on employe.Id_Employe equals membre.Id_Employe where membre.Id_Groupe == groupe.Id_Groupe select new BO.Employe { Id_Employe = employe.Id_Employe, Nom = employe.Nom, Prenom = employe.Prenom, Service = employe.Service }; Titre = groupe.Titre; DateReunion = groupe.DateReunion; Id_Groupe = groupe.Id_Groupe; if (groupe.Id_Competence != null) { Id_Competence = groupe.Id_Competence.Value; } NbParticipant = reqNbParticipant.ToList().Count; Participant = reqNbParticipant.ToList(); Tuteur = reqTuteur.FirstOrDefault(); } }
private void Suppression_Click(object sender, RoutedEventArgs e) { using (var db = new BBD_projetEntities()) { if (list.SelectedItem != null) { var DALObject4 = (from m in db.Membres where m.Id_Employe == ((BO.Employe)list.SelectedItem).Id_Employe select m).ToList(); foreach (var w in DALObject4) { db.Membres.Remove(w); } var DALObject3 = (from lc in db.LiaisonCompetences where lc.Id_Employe == ((BO.Employe)list.SelectedItem).Id_Employe select lc).ToList(); foreach (var y in DALObject3) { db.LiaisonCompetences.Remove(y); } var DALObject2 = (from lp in db.LanguePossedes where lp.Id_Employe == ((BO.Employe)list.SelectedItem).Id_Employe select lp).ToList(); foreach (var x in DALObject2) { db.LanguePossedes.Remove(x); } var DALObject = (from e2 in db.Employes where e2.Id_Employe == ((BO.Employe)list.SelectedItem).Id_Employe select e2).First(); db.Employes.Remove(DALObject); listemploye.Remove((BO.Employe)list.SelectedItem); list.Items.Refresh(); } db.SaveChanges(); } }
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 ListViewCategorie() { InitializeComponent(); /// Ici on génère la liste des Catégorie /// using (var db = new BBD_projetEntities()) { // partie pour récupérer la liste var req = (from c in db.Categories select new { IdCategorie = c.Id_Categorie, intitule = c.Intitule, superID = c.Id_Super_Categorie }).ToList().Select(l => new DAL.Categorie { Id_Categorie = l.IdCategorie, Intitule = l.intitule, Id_Super_Categorie = l.superID }); listCategorie = req.ToList(); listDal.ItemsSource = listCategorie; } }
public ModificationEmploye(BO.Employe employe) { InitializeComponent(); Employe = employe; Service.Text = Employe.Service; Entreprise.Text = Employe.Entreprise; Metier.Text = Employe.Metier; Nom.Text = Employe.Nom; Prenom.Text = Employe.Prenom; DateArrivee.SelectedDate = Employe.DateArrive; LinkedIn.Text = Employe.LinkedIn; if (Employe.DateDepart != null) { DateDepart.SelectedDate = Employe.DateDepart; } else { DateDepart.SelectedDate = null; DateDepart.DisplayDate = DateTime.Now; } ChefDeService.IsChecked = Employe.EstChefDeService; Admin.IsChecked = Employe.EstAdmin; Actif.IsChecked = Employe.Actif; Interne.IsChecked = Employe.EstInterne; AdresseMail.Text = Employe.AdresseMail; using (var db = new BBD_projetEntities()) { var langue = from l in db.Langues select new BO.Langue { Id_Langue = l.Id_Langue, Default = l.Default, Nom = l.Nom }; var languePossede = from l in db.Langues join lp in db.LanguePossedes on l.Id_Langue equals lp.Id_Langue where lp.Id_Employe == Employe.Id_Employe select new BO.Langue { Id_Langue = l.Id_Langue, Default = l.Default, Nom = l.Nom }; var Competence = from c in db.Competences select new BO.Competence { Id_Competence = c.Id_Competence, Actif = c.Actif, Annee = c.Annee, Actuel = c.Actuel, Id_CompetenceActuel = c.Id_CompetenceActuel }; foreach (var v in Competence) { v.IntituleCompetences = BO.IntituleCompetence.ListDALtoBO((from c in db.IntituleCompetences where c.Id_Competence == v.Id_Competence select c).ToList()); System.Diagnostics.Debug.WriteLine(v.IntituleCompetences.ToList().First().Intitule); } var CompetencePossede = from c in db.Competences join ic in db.LiaisonCompetences on c.Id_Competence equals ic.Id_Competence where ic.Id_Employe == Employe.Id_Employe select new BO.Competence { Id_Competence = c.Id_Competence, Actif = c.Actif, Annee = c.Annee, Actuel = c.Actuel, Id_CompetenceActuel = c.Id_CompetenceActuel }; ListLangue = languePossede.ToList(); ListCompetence = CompetencePossede.ToList(); ListLangueOrigin = languePossede.ToList(); ListCompetenceOrigin = CompetencePossede.ToList(); ListViewCompetence.ItemsSource = Competence.ToList(); ListViewCompetence.MouseDoubleClick += (sender, e) => { if (ListViewCompetence.SelectedItem is BO.Competence) { var NouvelleCompetence = ((BO.Competence)ListViewCompetence.SelectedItem); var verifdoublons = 0; foreach (var x in ListCompetence) { if (NouvelleCompetence != null) { if (x.Id_Competence == NouvelleCompetence.Id_Competence) { verifdoublons = 1; } } } if (verifdoublons == 0) { ListCompetence.Add(NouvelleCompetence); ListBoxCompetence.Items.Refresh(); } } }; ListBoxLangue.ItemsSource = langue.ToList(); ListBoxLangue.MouseDoubleClick += (sender, e) => { if (ListBoxLangue.SelectedItem is BO.Langue) { var NouvelleLangue = ((BO.Langue)ListBoxLangue.SelectedItem); var verifdoublons = 0; foreach (var x in ListLangue) { if (x.Id_Langue == NouvelleLangue.Id_Langue) { verifdoublons = 1; } } if (verifdoublons == 0) { ListLangue.Add(NouvelleLangue); ListBoxLangueSelection.Items.Refresh(); } } ; ListBoxCompetence.ItemsSource = ListCompetence; ListBoxLangueSelection.ItemsSource = ListLangue; }; } }
private void Confirmer_Click(object sender, RoutedEventArgs e) { if (DateArrivee.SelectedDate == null) { MessageBoxResult result = MessageBox.Show("Error : Aucune date sélectionnée"); } else if (StringCheck(Nom.Text) || StringCheck(Prenom.Text)) { MessageBoxResult result = MessageBox.Show("Error : veuillez saisir votre nom complet"); } else if (StringCheck(AdresseMail.Text) || StringCheck(Service.Text) || StringCheck(Metier.Text) || StringCheck(LinkedIn.Text) || StringCheck(Entreprise.Text)) { MessageBoxResult result = MessageBox.Show("Error : Veuillez remplir tous les champs"); } else if (DateDepart.SelectedDate < DateArrivee.SelectedDate) { MessageBoxResult result = MessageBox.Show("Error : Incohérence dans les dates"); } else if ((!(Interne.IsChecked.Value) && ChefDeService.IsChecked.Value)) { MessageBoxResult result = MessageBox.Show("Error : Incohérence des rôles (Impossible d'être externe et chef de service"); } else { using (var db = new BBD_projetEntities()) { foreach (var x in ListLangue) { System.Diagnostics.Debug.WriteLine((ListLangueOrigin.Where(l => l.Id_Langue == x.Id_Langue).Count())); System.Diagnostics.Debug.WriteLine(x.Id_Langue); if ((ListLangueOrigin.Where(l => l.Id_Langue == x.Id_Langue).Count() > 0)) { System.Diagnostics.Debug.WriteLine((ListLangueOrigin.Where(l => l.Id_Langue == x.Id_Langue).First()).Id_Langue); } if (ListLangueOrigin.Where(l => l.Id_Langue == x.Id_Langue).Count() == 0) { DAL.LanguePossede languePossede = new DAL.LanguePossede { Default = false, Id_Employe = Employe.Id_Employe, Id_Langue = x.Id_Langue }; db.LanguePossedes.Add(languePossede); } } foreach (var y in ListLangueOrigin) { if (ListLangue.Where(l => l.Id_Langue == y.Id_Langue).Count() == 0) { var languePossede = new DAL.LanguePossede { Default = false, Id_Employe = Employe.Id_Employe, Id_Langue = y.Id_Langue }; db.LanguePossedes.Attach(languePossede); db.LanguePossedes.Remove(languePossede); } } foreach (var w in ListCompetence) { if (ListCompetenceOrigin.Where(c => c.Id_Competence == w.Id_Competence).Count() == 0) { var competencePossede = new DAL.LiaisonCompetence { Id_Competence = w.Id_Competence, Id_Employe = Employe.Id_Employe, EstTutorant = false }; db.LiaisonCompetences.Add(competencePossede); } } foreach (var z in ListCompetenceOrigin) { if (ListCompetence.Where(c => c.Id_Competence == z.Id_Competence).Count() == 0) { var competencePossede = new DAL.LiaisonCompetence { Id_Competence = z.Id_Competence, Id_Employe = Employe.Id_Employe, EstTutorant = false }; db.LiaisonCompetences.Attach(competencePossede); db.LiaisonCompetences.Remove(competencePossede); } } var DALEmploye = db.Employes.Find(Employe.Id_Employe); if (Service.Text != DALEmploye.Service) { DALEmploye.Service = Service.Text; } if (Entreprise.Text != DALEmploye.Entreprise) { DALEmploye.Entreprise = Entreprise.Text; } if (Metier.Text != Employe.Metier) { DALEmploye.Metier = Metier.Text; } if (Nom.Text != DALEmploye.Nom) { DALEmploye.Nom = Nom.Text; } if (Prenom.Text != DALEmploye.Prenom) { DALEmploye.Prenom = Prenom.Text; } if (DateArrivee.SelectedDate != DALEmploye.DateArrive) { DALEmploye.DateArrive = DateArrivee.SelectedDate.Value; } if (Employe.DateDepart != null) { if (DateDepart.SelectedDate != DALEmploye.DateDepart) { DALEmploye.DateDepart = DateDepart.SelectedDate.Value; } } if (ChefDeService.IsChecked != DALEmploye.EstChefDeService) { DALEmploye.EstChefDeService = ChefDeService.IsChecked.Value; } if (Admin.IsChecked != DALEmploye.EstAdmin) { DALEmploye.EstAdmin = Admin.IsChecked.Value; } if (Actif.IsChecked != DALEmploye.Actif) { DALEmploye.Actif = Actif.IsChecked.Value; } if (Interne.IsChecked != DALEmploye.EstInterne) { DALEmploye.EstInterne = Interne.IsChecked.Value; } if (AdresseMail.Text != Employe.AdresseMail) { DALEmploye.AdresseMail = AdresseMail.Text; } if (LinkedIn.Text != Employe.LinkedIn) { DALEmploye.LienLinkedin = LinkedIn.Text; } db.SaveChanges(); this.NavigationService.Navigate(new Uri("ListViewEmploye.xaml", UriKind.Relative)); } } }
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); }; } }
private void Enregistrement_Click(object sender, RoutedEventArgs e) { using (var db = new BBD_projetEntities()) { if (Date.SelectedDate == null) { MessageBoxResult result = MessageBox.Show("Error : Aucune date sélectionnée"); } else if (Titre.Text.Count() <= 0) { MessageBoxResult result = MessageBox.Show("Error : Aucun Titre sélectionné"); } else if (Competence == null) { MessageBoxResult result = MessageBox.Show("Error : Veuillez indiqué la compétence enseigné"); } else { System.Diagnostics.Debug.WriteLine(Competence.Id_Competence); //Groupe var groupe = new DAL.Groupe { Id_Competence = Competence.Id_Competence, DateReunion = Date.SelectedDate.Value, DateCreation = DateTime.Now, Titre = Titre.Text, EstValider = true }; db.Groupes.Add(groupe); System.Diagnostics.Debug.WriteLine(groupe.Id_Competence); System.Diagnostics.Debug.WriteLine(groupe.DateReunion); System.Diagnostics.Debug.WriteLine(groupe.Titre); //Membre et tuteur var tuteur = false; if (ListParticipant.Count <= 0) { MessageBoxResult result = MessageBox.Show("Warning : Vous n'avez pas de participants"); } foreach (var x in ListParticipant) { var membre = new DAL.Membre(); if (x.Id_Employe == Tuteur.Id_Employe) { tuteur = true; membre = new DAL.Membre { EstTutorant = true, Id_Employe = x.Id_Employe, //Groupe = groupe }; } else { membre = new DAL.Membre { EstTutorant = false, Id_Employe = x.Id_Employe, //Groupe = groupe }; } System.Diagnostics.Debug.WriteLine(membre.EstTutorant); System.Diagnostics.Debug.WriteLine(membre.Id_Employe); System.Diagnostics.Debug.WriteLine(membre.Groupe); db.Membres.Add(membre); } if (tuteur == false) { MessageBoxResult result = MessageBox.Show("Warning : Vous n'avez pas selectionné de tuteur"); } db.SaveChanges(); ListViewCompetence l = new ListViewCompetence(); this.NavigationService.Navigate(new Uri("ListViewGroup.xaml", UriKind.Relative)); } } }
private void Confirmer_Click(object sender, RoutedEventArgs e) { if (DateArrivee.SelectedDate == null) { MessageBoxResult result = MessageBox.Show("Error : Aucune date sélectionnée"); } else if (StringCheck(Nom.Text) || StringCheck(Prenom.Text)) { MessageBoxResult result = MessageBox.Show("Error : veuillez saisir votre nom complet"); } else if (StringCheck(AdresseMail.Text) || StringCheck(Service.Text) || StringCheck(Metier.Text) || StringCheck(LinkedIn.Text) || StringCheck(Entreprise.Text)) { MessageBoxResult result = MessageBox.Show("Error : Veuillez remplir tous les champs"); } else if (DateDepart.SelectedDate < DateArrivee.SelectedDate) { MessageBoxResult result = MessageBox.Show("Error : Incohérence dans les dates"); } else { using (var db = new BBD_projetEntities()) { DAL.Employe employe = new DAL.Employe { Actif = Actif.IsChecked.Value, EstAdmin = Admin.IsChecked.Value, EstChefDeService = ChefDeService.IsChecked.Value, EstInterne = Interne.IsChecked.Value, AdresseMail = AdresseMail.Text, Metier = Metier.Text, Service = Service.Text, Nom = Nom.Text, Prenom = Prenom.Text, DateArrive = DateArrivee.SelectedDate.Value, Entreprise = Entreprise.Text, LienLinkedin = LinkedIn.Text, Identifiant = ComputeSha256Hash(Nom + "." + Prenom), MotDePasse = ComputeSha256Hash("Epsi2018!") }; if (DateDepart.SelectedDate != null) { employe.DateDepart = DateDepart.SelectedDate.Value; } System.Diagnostics.Debug.Write(employe.DateDepart); db.Employes.Add(employe); foreach (var x in ListBoC) { DAL.LiaisonCompetence competence = new DAL.LiaisonCompetence { EstTutorant = false, Id_Competence = x.Id_Competence, Employe = employe }; db.LiaisonCompetences.Add(competence); } foreach (var y in ListBoL) { DAL.LanguePossede langue = new DAL.LanguePossede { Employe = employe, Id_Langue = y.Id_Langue, Default = false }; db.LanguePossedes.Add(langue); } db.SaveChanges(); this.NavigationService.Navigate(new Uri("ListViewEmploye.xaml", UriKind.Relative)); } } }
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 ToggleButton_Click(object sender, RoutedEventArgs e) { try { var checkError = 0; foreach (var item in listCategorie) { if (NewCategorie.Text == item.Intitule) { checkError = 1; } if (NewCategorie.Text == "") { checkError = 2; } } if (checkError == 0) { using (var db = new BBD_projetEntities()) { var Categorie = NewCategorie.Text; var Langue = ((DAL.Langue)listLangueDal.SelectedItem); var SuperCategorie = ((DAL.Categorie)listCategorieDal.SelectedItem); var idLangue = Langue.Id_Langue; var idSuperCategorie = SuperCategorie.Id_Categorie; var dalCategorie = new DAL.Categorie(); dalCategorie.Id_Super_Categorie = idSuperCategorie; dalCategorie.Intitule = Categorie; db.Categories.Add(dalCategorie); db.SaveChanges(); var req = from c in db.Categories where c.Intitule == Categorie select c; var dalIntituleCategorie = new DAL.IntituleCategorie(); dalIntituleCategorie.Id_Categorie = req.FirstOrDefault().Id_Categorie; dalIntituleCategorie.Id_Langue = idLangue; dalIntituleCategorie.intitule = Categorie; db.IntituleCategories.Add(dalIntituleCategorie); db.SaveChanges(); NavigationService.Navigate(new ListViewCategorie()); } } else if (checkError == 1) { MessageBoxResult resultBeta = MessageBox.Show("Warning : Cette categorie existe deja"); } else { MessageBoxResult resultDelta = MessageBox.Show("Warning : Vous n'avez pas mis de nom"); } } catch (Exception) { MessageBoxResult resultAlpha = MessageBox.Show("Warning : Veuillez saisir des categories ET langues"); } }
private void DeleteCategorie_Click(object sender, RoutedEventArgs e) { if (listDal.SelectedItem != null) { var Item = (DAL.Categorie)listDal.SelectedItem; MessageBoxResult result = MessageBox.Show("Warning : Vous allez supprimer " + Item.Intitule); using (var db = new BBD_projetEntities()) { List <DAL.IntituleCategorie> listIntitule = new List <DAL.IntituleCategorie>(); List <DAL.Categorie> listEnfant = new List <DAL.Categorie>(); //partie liaison var req = (from c in db.IntituleCategories where c.Id_Categorie == Item.Id_Categorie select new { IdCategorie = c.Id_Categorie, intitule = c.intitule, Id_Langue = c.Id_Langue }).ToList().Select(l => new DAL.IntituleCategorie { Id_Categorie = l.IdCategorie, intitule = l.intitule, Id_Langue = l.Id_Langue }); listIntitule = req.ToList(); foreach (var itemIntitule in listIntitule) { db.IntituleCategories.Attach(itemIntitule); db.IntituleCategories.Remove(itemIntitule); db.SaveChanges(); //MessageBoxResult unAutreTruc = MessageBox.Show(itemIntitule.intitule); } var IdParent = Item.Id_Super_Categorie; var reqEnfant = (from c in db.Categories where c.Id_Super_Categorie == Item.Id_Categorie select new { IdCategorie = c.Id_Categorie, Intitule = c.Intitule, Id_Super_Categorie = c.Id_Super_Categorie }).ToList().Select(l => new DAL.Categorie { Id_Categorie = l.IdCategorie, Id_Super_Categorie = l.Id_Super_Categorie, Intitule = l.Intitule }); listEnfant = reqEnfant.ToList(); foreach (var itemEnfant in listEnfant) { var ItemEnfant = db.Categories.Find(itemEnfant.Id_Categorie); ItemEnfant.Id_Super_Categorie = IdParent; db.SaveChanges(); } db.Categories.Attach(Item); db.Categories.Remove(Item); db.SaveChanges(); } NavigationService.Navigate(new ListViewCategorie()); } else { MessageBoxResult result = MessageBox.Show("Warning : Vous allez n'avez rien selectionné"); } }
private void b_Click(object sender, RoutedEventArgs e) { if (C3.SelectedDate == null) { MessageBoxResult result = MessageBox.Show("Error : Aucune date sélectionnée"); } else if (StringCheck(C1.Text) && StringCheck(C2.Text)) { MessageBoxResult result = MessageBox.Show("Error : Aucun Titre sélectionné"); } else { //lier les eux objets using (var db = new BBD_projetEntities()) { BO.Competence t = (BO.Competence)list2.SelectedItem; DAL.Competence objet = null; test2.Content = Actif.ToString(); var objet2 = new DAL.IntituleCompetence(); if (list2.SelectedItem != null) { objet = new DAL.Competence() { Actuel = this.Actuel, Id_CompetenceActuel = t.Id_CompetenceActuel, Annee = C3.SelectedDate.ToString(), Actif = this.Actif }; } else { objet = new DAL.Competence() { Actuel = this.Actuel, Id_CompetenceActuel = null, Annee = C3.SelectedDate.ToString(), Actif = this.Actif }; } if (list.SelectedItem == null) { objet2 = new DAL.IntituleCompetence() { intitule = C1.Text, Description = C2.Text, Id_Langue = 3, Competence = objet }; } else { objet2 = new DAL.IntituleCompetence() { intitule = C1.Text, Description = C2.Text, Id_Langue = ((int)list.SelectedValue), Competence = objet }; } objet.IntituleCompetences.Add(objet2); db.Competences.Add(objet); db.SaveChanges(); ListViewCompetence l = new ListViewCompetence(); this.NavigationService.Navigate(new Uri("ListViewCompetence.xaml", UriKind.Relative)); } } }