Ejemplo n.º 1
0
        public static void ajouter(Utilisateur u)
        {
            var db = new dbProjetE2ProdEntities();
            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);
            }
        }
Ejemplo n.º 2
0
        public static void setCompte(Utilisateur u)
        {
            var db = new dbProjetE2ProdEntities();
            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);
            }
        }
Ejemplo n.º 3
0
        public static void addEmploye(Employe settings)
        {
            var bd = new dbProjetE2ProdEntities();
            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;

            //ajout.tblTypeTest = lstTypeTest;

            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);
            }
        }
Ejemplo n.º 4
0
        public void ajouter(object o)
        {
            var ajout = new tblPlateforme();
            tblSysExp systemp;
            //List<tblPlateforme> lstPlat = new List<tblPlateforme>();
            //lstPlat.Add(ajout);
            //systemp.tblPlateforme = lstPlat;
            ICollection<tblSysExp> lstSysExp = new List<tblSysExp>();

            ajout.CodePlateforme = ((plateforme)o).codePlate;
            ajout.NomPlateforme = ((plateforme)o).nomPlate;
            ajout.CodeCategorie = ((plateforme)o).codeCateg;
            ajout.CPU = ((plateforme)o).cpuPlate;
            ajout.CarteMere = ((plateforme)o).carteMerePlate;
            ajout.RAM = ((plateforme)o).ramPlate;
            ajout.Stockage=((plateforme)o).stockage;
            ajout.DescPlateforme = ((plateforme)o).descPlate;
            ajout.InfoSupPlateforme = ((plateforme)o).infoSupPlate;

            var db = new dbProjetE2ProdEntities();

            foreach (SystemeExploitation item in ((plateforme)o).lstSysExpPlate)
            {
                systemp = new tblSysExp();
                systemp.CodeSysExp = item.CodeSysExp;
                systemp.EditionSysExp = item.editSysExp;
                systemp.IdSysExp = item.idSysExp;
                systemp.InfoSupSysExp = item.infoSysExp;
                systemp.NomSysExp = item.nomSysExp;
                systemp.Tag = item.tagSysExp;
                systemp.VersionSysExp = item.versionSysExp;
                systemp.IdSysExp = item.idSysExp;
               ajout.tblSysExp.Add(systemp);
               // lstSysExp.Add(systemp);
            }
            //ajout.tblSysExp = lstSysExp;
            db.tblPlateforme.Add(ajout);

            //ajout.tblSysExp = lstSysExp;
            //RequeteSql.addPlateforme(ajout);

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 5
0
        public static void addEmploye(Employe settings)
        {
            var bd = new dbProjetE2ProdEntities();
            var add = 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)
                    {
                        lstTypeTest.Add(item);
                        i++;
                        break;
                    }
                }
                if (settings.lstEmTypeTest.Count == i)
                    break;
            }

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

            bd.tblEmploye.Add(add);

            try
            {
                bd.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 6
0
        public static void addPlateforme(tblPlateforme p)
        {
            var db = new dbProjetE2ProdEntities();

            foreach (tblSysExp tblSysExpTemp in p.tblSysExp)
            {
                db.tblPlateforme.Add(p);
                try
                {
                    db.SaveChanges();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
        }
Ejemplo n.º 7
0
        //static public void setJeu(Jeu jeu)
        //{
        //    var db = new dbProjetE2ProdEntities();
        //    var r =
        //        (from j in db.tblJeu
        //         where j.IdJeu == jeu.idJeu
        //         select j).First();
        //    r.NomJeu = jeu.nomJeu;
        //    r.DescJeu = jeu.descJeu;
        //    r.Actif = jeu.actif;
        //    r.InfoSupJeu = jeu.infoSupJeu;
        //    r.CoteESRB = jeu.coteESRB;
        //    r.IdGenre = jeu.idGenre;
        //    r.IdMode = jeu.idMode;
        //    //Manque le lien aux thèmes
        //    try
        //    {
        //        db.SaveChanges();
        //    }
        //    catch (Exception e)
        //    {
        //        Console.WriteLine(e);
        //    }
        //}
        public static void addJeu(tblJeu p)
        {
            var db = new dbProjetE2ProdEntities();

            foreach (tblTheme tblThemeTemp in p.tblTheme)
            {
                db.tblJeu.Add(p);
                try
                {
                    db.SaveChanges();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
        }
Ejemplo n.º 8
0
        public static void addGenre(Genre genre)
        {
            var db = new dbProjetE2ProdEntities();
            var add = new tblGenre();

            add.NomGenre = genre.nomGenre;
            add.ComGenre = genre.comGenre;

            db.tblGenre.Add(add);

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 9
0
        public static void addMode(Mode mode)
        {
            var db = new dbProjetE2ProdEntities();
            var add = new tblMode();

            add.NomMode = mode.nomMode;
            add.DescMode = mode.descMode;

            db.tblMode.Add(add);

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 10
0
        public static void addClassification(Classification classification)
        {
            var db = new dbProjetE2ProdEntities();
            var add = new tblClassification();

            add.CoteESRB = classification.coteESRB;
            add.NomESRB = classification.nomESRB;
            add.DescESRB = classification.descESRB;

            db.tblClassification.Add(add);

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 11
0
        public static void addCateg(Categorie settings)
        {
            var db = new dbProjetE2ProdEntities();
            var add = new tblCategorie();

            add.CodeCategorie = settings.codeCateg;
            add.ComCategorie = settings.comCateg;
            add.DescCategorie = settings.descCateg;

            db.tblCategorie.Add(add);

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 12
0
        public static void setClassification(Classification classification)
        {
            var db = new dbProjetE2ProdEntities();

            var r =
                (from classif in db.tblClassification
                 where classif.CoteESRB == classification.coteESRB
                 select classif).First();

            r.NomESRB = classification.nomESRB;
            r.DescESRB = classification.descESRB;

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 13
0
        public static void deleteEmploye(int cle)
        {
            var bd = new dbProjetE2ProdEntities();
            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);
            }
        }
Ejemplo n.º 14
0
        public static bool ChangerMDP(Utilisateur u,string NouvMDP)
        {
            var db = new dbProjetE2ProdEntities();

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

            r.MotPasUtil = NouvMDP;
            r.PremiereConex = "n";
            r.MotPasExpire = "n";
            r.DateModifMotPas = DateTime.Now;

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                return false;
            }
            return true;
        }
Ejemplo n.º 15
0
        public static void deleteClassification(string coteESRB)
        {
            var db = new dbProjetE2ProdEntities();

            var r =
                from classif in db.tblClassification
                where classif.CoteESRB == coteESRB
                select classif;

            foreach (var item in r)
            {
                db.tblClassification.Remove(item);
            }

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 16
0
        public static void deleteTheme(int idTheme)
        {
            var db = new dbProjetE2ProdEntities();

            var r =
                from the in db.tblTheme
                where the.IdTheme == idTheme
                select the;

            foreach (var item in r)
            {
                db.tblTheme.Remove(item);
            }

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 17
0
        public static void setTheme(Theme theme)
        {
            var db = new dbProjetE2ProdEntities();

            var r =
                (from the in db.tblTheme
                 where the.IdTheme == theme.idTheme
                 select the).First();

            r.NomTheme = theme.nomTheme;
            r.ComTheme = theme.comTheme;

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 18
0
        public static void setSysExp(SystemeExploitation settings)
        {
            var db = new dbProjetE2ProdEntities();
            var i = Convert.ToInt32(settings.idSysExp);

            var r =
                (from sysExp in db.tblSysExp
                where sysExp.IdSysExp == i
                select sysExp).First();

            r.CodeSysExp = settings.CodeSysExp;
            r.NomSysExp = settings.nomSysExp;
            r.EditionSysExp = settings.editSysExp;
            r.VersionSysExp = settings.versionSysExp;
            r.InfoSupSysExp = settings.infoSysExp;

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 19
0
        public static void setMode(Mode mode)
        {
            var db = new dbProjetE2ProdEntities();

            var r =
                (from mod in db.tblMode
                 where mod.IdMode == mode.idMode
                 select mod).First();

            r.NomMode = mode.nomMode;
            r.DescMode = mode.descMode;

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 20
0
        public static void setGenre(Genre genre)
        {
            var db = new dbProjetE2ProdEntities();

            var r =
                (from gen in db.tblGenre
                 where gen.IdGenre == genre.idGenre
                 select gen).First();

            r.NomGenre = genre.nomGenre;
            r.ComGenre = genre.comGenre;

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 21
0
        public static void setCateg(Categorie settings)
        {
            var db = new dbProjetE2ProdEntities();

            var r =
                (from categ in db.tblCategorie
                 where categ.CodeCategorie == settings.codeCateg
                 select categ).First();

            r.CodeCategorie = settings.codeCateg;
            r.ComCategorie = settings.comCateg;
            r.DescCategorie = settings.descCateg;

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 22
0
        public static void setVersion(version vers)
        {
            var db = new dbProjetE2ProdEntities();

            var r =
                (from v in db.tblVersion
                 where v.CodeVersion == vers.codeVersion
                 select v).First();

            r.DateSortiePrevue = vers.dateSortie;
            r.DateVersion = vers.dateVersion;
            r.DescVersion = vers.descVersion;
            r.IdJeu = vers.idJeu;
            r.NomVersion = vers.nomVersion;
            r.StadeDeveloppement = vers.stadeVersion;

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 23
0
        public static void addTheme(Theme theme)
        {
            var db = new dbProjetE2ProdEntities();
            var add = new tblTheme();

            add.NomTheme = theme.nomTheme;
            add.ComTheme = theme.comTheme;

            db.tblTheme.Add(add);

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 24
0
        public static void deleteSysExp(int ID)
        {
            var db = new dbProjetE2ProdEntities();
            var i = Convert.ToInt32(ID);

            var r =
                from sysExp in db.tblSysExp
                where sysExp.IdSysExp == i
                select sysExp;

            foreach (var item in r)
            {
                db.tblSysExp.Remove(item);
            }

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 25
0
        public static void deleteMode(int idMode)
        {
            var db = new dbProjetE2ProdEntities();

            var r =
                from mod in db.tblMode
                where mod.IdMode == idMode
                select mod;

            foreach (var item in r)
            {
                db.tblMode.Remove(item);
            }

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 26
0
        public static void deleteGenre(int idGenre)
        {
            var db = new dbProjetE2ProdEntities();

            var r =
                from gen in db.tblGenre
                where gen.IdGenre == idGenre
                select gen;

            foreach (var item in r)
            {
                db.tblGenre.Remove(item);
            }

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 27
0
        public static void addVersion(tblVersion v)
        {
            var db = new dbProjetE2ProdEntities();

            db.tblVersion.Add(v);

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 28
0
        public static void deleteCateg(string code)
        {
            var db = new dbProjetE2ProdEntities();

            var r =
                from categ in db.tblCategorie
                where categ.CodeCategorie == code
                select categ;

            foreach (var item in r)
            {
                db.tblCategorie.Remove(item);
            }

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Ajouter un nouveau systeme d'exploitation.
        /// </summary>
        /// <param name="settings">code,nom,edition,version,info supplementaire</param>
        public static void addSysExp(SystemeExploitation settings)
        {
            var db = new dbProjetE2ProdEntities();
            var add = new tblSysExp();

            add.CodeSysExp = settings.CodeSysExp;
            add.NomSysExp = settings.nomSysExp;
            add.EditionSysExp = settings.editSysExp;
            add.VersionSysExp = settings.versionSysExp;
            add.InfoSupSysExp = settings.infoSysExp;

            db.tblSysExp.Add(add);

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 30
0
        public static void deleteVersion(string code)
        {
            var db = new dbProjetE2ProdEntities();

            var r =
                from v in db.tblVersion
                where v.CodeVersion == code
                select v;

            foreach (var item in r)
            {
                db.tblVersion.Remove(item);
            }

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                throw e;
            }
        }