Ejemplo n.º 1
0
        private void charger()
        {
            filtre.IsEnabled = true;

            if (t)
            {
                IQueryable <Employee> list = from rec in db.Employee
                                             select rec;
                IQueryable <info_comp> list5 = from rec2 in db.info_comp
                                               select rec2;
                foreach (Employee rec in list)
                {
                    var card = new UserControl2();



                    card.Margin   = new Thickness(10, 10, 10, 10);
                    card.nom.Text = rec.nom;

                    card.prenom.Text  = rec.prenom;
                    card.num.Text     = "0" + rec.Num_tel.ToString();
                    card.adrmail.Text = rec.Adr_mail;
                    foreach (info_comp rec2 in list5)
                    {
                        if (rec2.matricule == rec.matricule)
                        {
                            card.Poste.Text  = rec2.poste;
                            card.Projet.Text = rec2.projet;
                        }
                    }
                    list2.Add(card);

                    panel.Children.Add(card);
                }
                t = false;
            }
        }
Ejemplo n.º 2
0
        private void filtre_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            retour.IsEnabled = true;
            string pst = "";
            string prj = "";

            if (filtre.SelectedIndex >= 0)

            {
                Boolean trv3 = false;

                IQueryable <Employee> list = from rec in db.Employee
                                             select rec;
                IQueryable <info_comp> list5 = from rec2 in db.info_comp
                                               select rec2;
                string selectedcmb = (string)filtre.SelectedItem;

                panel.Children.Clear();

                foreach (Employee crd3 in list)
                {
                    foreach (info_comp rec2 in list5)
                    {
                        if (rec2.matricule == crd3.matricule)
                        {
                            pst = rec2.poste;
                            prj = rec2.projet;
                        }
                    }

                    if (pst.Equals(selectedcmb))
                    {
                        trv3 = true;
                        var card = new UserControl2();



                        card.Margin       = new Thickness(10, 10, 10, 10);
                        card.nom.Text     = crd3.nom;
                        card.prenom.Text  = crd3.prenom;
                        card.num.Text     = "0" + crd3.Num_tel.ToString();
                        card.adrmail.Text = crd3.Adr_mail;
                        card.Poste.Text   = pst;
                        card.Projet.Text  = prj;

                        panel.Children.Add(card);
                    }
                }
                if (trv3 == false)
                {
                    alert2.IsOpen = true;
                    foreach (Employee rec in list)
                    {
                        var card = new UserControl2();
                        card.Margin       = new Thickness(10, 10, 10, 10);
                        card.nom.Text     = rec.nom;
                        card.prenom.Text  = rec.prenom;
                        card.num.Text     = "0" + rec.Num_tel.ToString();
                        card.adrmail.Text = rec.Adr_mail;
                        foreach (info_comp rec2 in list5)
                        {
                            if (rec2.matricule == rec.matricule)
                            {
                                card.Poste.Text  = rec2.poste;
                                card.Projet.Text = rec2.projet;
                            }
                        }
                        panel.Children.Add(card);
                    }
                }
            }
        }