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); } }
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); } }
//tblClassification public static IQueryable<tblClassification> getAllClassification() { var db = new dbProjetE2ProdEntities(); var r = from c in db.tblClassification select c; return r; }
//tblJeu public static IQueryable<tblJeu> getAllJeu() { var db = new dbProjetE2ProdEntities(); var r = from c in db.tblJeu select c; return r; }
public static IQueryable<tblUtilisateur> Recherche(string Recherche) { var db = new dbProjetE2ProdEntities(); var r = from the in db.tblUtilisateur where (the.NomUtil.Contains(Recherche)) || (the.MotPasUtil.Contains(Recherche)) select the; return r; }
// envoye une liste des types de test pour les relier au employe public static IQueryable<tblTypeTest> getTypeTest() { var bd = new dbProjetE2ProdEntities(); var t = from e in bd.tblTypeTest select e; return t; }
public static string PremiereCon(string Username) { var db = new dbProjetE2ProdEntities(); var r = (from the in db.tblUtilisateur where the.NomUtil == Username select the.PremiereConex).First(); return r; }
public static string MotDePasseExpire(string Username) { var db = new dbProjetE2ProdEntities(); var r = (from the in db.tblUtilisateur where the.NomUtil == Username select the.MotPasExpire).First(); return r; }
public static string GetRole(int IdRole) { var db = new dbProjetE2ProdEntities(); var r = (from the in db.tblRole where the.IdRole == IdRole select the.NomRole).First(); return r; }
/// <summary> /// toutes les variables db vont etre a changé pour "dbProjetE2ProdEntities" /// </summary> public static IQueryable<tblUtilisateur> getComptes() { var db = new dbProjetE2ProdEntities(); var r = from c in db.tblUtilisateur select c; return r; }
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); } }
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); } }
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); } }
public static Utilisateur SetAttributes(Utilisateur u) { Utilisateur User = u; var db = new dbProjetE2ProdEntities(); var r = from the in db.tblUtilisateur where the.NomUtil == User.NomUtilisateur select the; foreach (var item in r) { User = new Utilisateur(item); } return User; }
//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); } } }
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); } } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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; }
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); } }
/// <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); } }
public static IQueryable<tblVersion> srchVersion(string c, int id) { var db = new dbProjetE2ProdEntities(); var r = from v in db.tblVersion where v.Tag.Contains(c) && v.IdJeu == id select v; return r; }
public static IQueryable<tblTheme> srchTheme(string code) { var db = new dbProjetE2ProdEntities(); var r = from theme in db.tblTheme where theme.NomTheme == code select theme; return r; }
public static IQueryable<tblSysExp> srchSysExp(string chaine) { var db = new dbProjetE2ProdEntities(); var r = from sysexp in db.tblSysExp where sysexp.Tag.Contains(chaine) select sysexp; return r; }
public static IQueryable<tblPlateforme> srchPlateforme(string chaine) { var db = new dbProjetE2ProdEntities(); var r = from plate in db.tblPlateforme where plate.Tag.Contains(chaine) select plate; return r; }
public static IQueryable<tblVersion> srchCodeVersion(string code) { var db = new dbProjetE2ProdEntities(); var r = from v in db.tblVersion where v.CodeVersion == code select v; return r; }