예제 #1
0
        public static void ajouter(Utilisateur u)
        {
            var db = new dbProjetE2TestEntities();
            var add = new tblUtilisateur();

            add.NomUtil = u.NomUtilisateur;
            add.MotPasUtil = u.MotDePasse;
            add.MotPasExpire = u.Expire;
            add.PremiereConex = u.Premiere;
            add.DateModifMotPas = u.DateModifMotPas;
            add.IdEmp = u.Emp;
            add.IdRole = u.Role;
            add.Actif = u.UtilActif;

            db.tblUtilisateur.Add(add);

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
예제 #2
0
        //          envoye une liste des types de test pour les relier au employe
        public static IQueryable<tblTypeTest> getTypeTest()
        {
            var bd = new dbProjetE2TestEntities();

            var t =
                from e in bd.tblTypeTest
                select e;

            return t;
        }
예제 #3
0
        public static int GetIdRole(string NomduRole)
        {
            var db = new dbProjetE2TestEntities();

            var r =
                (from c in db.tblRole
                where c.NomRole == NomduRole
                select c.IdRole).First();

            return r;
        }
예제 #4
0
        /// <summary>
        /// toutes les variables db vont etre a changé pour "dbProjetE2TestEntities"
        /// </summary>
        public static IQueryable<tblUtilisateur> getComptes(int id)
        {
            var db = new dbProjetE2TestEntities();

            var r =
                from c in db.tblUtilisateur
                where c.IdEmp == id
                select c;

            return r;
        }
예제 #5
0
        public static void addEmploye(Employe settings)
        {
            var bd = new dbProjetE2TestEntities();
            var ajout = new tblEmploye();
            var lstTypeTest = new List<tblTypeTest>();

            var tt =
                from e in bd.tblTypeTest
                select e;

            int i = 0;
            foreach (tblTypeTest item in tt)
            {
                foreach (TypeTest ty in settings.lstEmTypeTest)
                {
                    if (item.CodeTypeTest == ty.codeTypeTest)
                    {
                        ajout.tblTypeTest.Add(item);
                        i++;
                        break;
                    }
                }
                if (settings.lstEmTypeTest.Count == i)
                    break;
            }

            ajout.IdEmp = settings.idEmp;
            ajout.PrenomEmp = settings.prenomEmp;
            ajout.NomEmp = settings.nomEmp;
            ajout.CourrielEmp = settings.courrielEmp;
            ajout.NoTelPrincipal = settings.noTelPrincipal;
            ajout.NoTelSecondaire = settings.noTelSecondaire;
            ajout.AdressePostale = settings.adressePostale;
            ajout.DateEmbaucheEmp = settings.dateEmbaucheEmp;
            ajout.CompetenceParticuliere = settings.competenceParticuliere;
            ajout.Statut = settings.statut;
            ajout.CommentaireEmp = settings.commentaireEmp;

            bd.tblEmploye.Add(ajout);

            try
            {
                bd.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                MessageBox.Show("Une erreur est survenue lors de l'ajout du nouvel employe", "Erreur système", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #6
0
        public static string[] GetInfoEmploye(int Id)
        {
            var db = new dbProjetE2TestEntities();
            string[] tab = new string[2];

            var r =
                (from c in db.tblEmploye
                where c.IdEmp == Id
                select c.NomEmp).First();
            var b =
                (from c in db.tblEmploye
                 where c.IdEmp == Id
                 select c.PrenomEmp).First();
            tab[0] = r;
            tab[1] = b;

            return tab;
        }
예제 #7
0
        public static void deleteEmploye(int cle)
        {
            var bd = new dbProjetE2TestEntities();
            var i = cle;

            var r =
                (from e in bd.tblEmploye
                 where e.IdEmp == i
                 select e).First();

            r.Statut = "n";

            try
            {
                bd.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
예제 #8
0
        public static IQueryable<string> getRoles()
        {
            var db = new dbProjetE2TestEntities();

            var r =
                from c in db.tblRole
                select c.NomRole;

            return r;
        }
예제 #9
0
        public static void supprimer(string ID)
        {
            var db = new dbProjetE2TestEntities();

            var r =
                from the in db.tblUtilisateur
                where the.NomUtil == ID
                select the;

            foreach (var item in r)
            {
                item.Actif = "n";
            }

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
예제 #10
0
        public static void setCompte(Utilisateur u)
        {
            var db = new dbProjetE2TestEntities();
            var i = u.NomUtilisateur;

            var r =
                (from the in db.tblUtilisateur
                 where the.NomUtil == i
                 select the).First();

            r.NomUtil = u.NomUtilisateur;
            r.MotPasUtil = u.MotDePasse;
            r.MotPasExpire = u.Expire;
            r.PremiereConex = u.Premiere;
            r.IdEmp = u.Emp;
            r.IdRole = u.Role;
            r.Actif = u.UtilActif;

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
예제 #11
0
        public static IQueryable<tblUtilisateur> Recherche(string Recherche)
        {
            var db = new dbProjetE2TestEntities();

            var r = from the in db.tblUtilisateur
                    where (the.NomUtil.Contains(Recherche)) || (the.MotPasUtil.Contains(Recherche))
                    select the;

            return r;
        }
예제 #12
0
        public static IQueryable<tblEmploye> rechercheEmploye(string cle)
        {
            var bd = new dbProjetE2TestEntities();

            var d =
                from e in bd.tblEmploye
                where e.Statut == "A" && (e.IdEmp.ToString().Contains(cle) || e.NomEmp.Contains(cle) || e.PrenomEmp.Contains(cle) || (e.DateEmbaucheEmp.ToString()).Contains(cle) || e.CompetenceParticuliere.Contains(cle))
                select e;

            return d;
        }
예제 #13
0
        public static IQueryable<tblEmploye> getEmploye()
        {
            var bd = new dbProjetE2TestEntities();

            var r =
                from e in bd.tblEmploye
                where e.Statut == "A"
                select e;

            return r;
        }
예제 #14
0
        public static void setEmploye(Employe settings)
        {
            var bd = new dbProjetE2TestEntities();
            var lstTypeTest = new List<tblTypeTest>();

            var r =
                (from e in bd.tblEmploye
                 where e.IdEmp == settings.idEmp
                 select e).First();

            var tt =
                from e in bd.tblTypeTest
                select e;

            int i = 0;
            r.tblTypeTest.Clear();
            foreach (tblTypeTest item in tt)
            {
                foreach (TypeTest ty in settings.lstEmTypeTest)
                {
                    if (item.CodeTypeTest == ty.codeTypeTest)
                    {
                        r.tblTypeTest.Add(item);
                        i++;
                        break;
                    }
                }
                if (settings.lstEmTypeTest.Count == i)
                    break;
            }

            r.PrenomEmp = settings.prenomEmp;
            r.NomEmp = settings.nomEmp;
            r.CourrielEmp = settings.courrielEmp;
            r.NoTelPrincipal = settings.noTelPrincipal;
            r.NoTelSecondaire = settings.noTelSecondaire;
            r.AdressePostale = settings.adressePostale;
            r.DateEmbaucheEmp = settings.dateEmbaucheEmp;
            r.CompetenceParticuliere = settings.competenceParticuliere;
            r.CommentaireEmp = settings.commentaireEmp;

            try
            {
                bd.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                MessageBox.Show("Une erreur est survenue lors de l'enregistrement des modifications", "Erreur système", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }