コード例 #1
0
        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;
                }
            }
        }
コード例 #2
0
ファイル: Groupe.xaml.cs プロジェクト: EddyCheval/ProjetB2
        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);
                };
            }
        }
コード例 #3
0
        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));
                }
            }
        }
コード例 #4
0
        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));
            }
        }
コード例 #5
0
        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);
                };
            }
        }