/// <summary> /// permet la création d'un utilisateur /// </summary> /// <param name="user">l'objet utilisateur à crer</param> /// <returns>true si tout se passe bien sinon false</returns> public static bool CreateUser(T_User user) { try { BugTrackEntities model = new BugTrackEntities(); model.AddToT_User(user); model.SaveChanges(); return true; } catch (Exception ex) { return false; } }
/// <summary> /// permet de mettre à jour l'utilisateur /// </summary> /// <param name="user">l'utilisateur a mettre a jour</param> /// <returns>true si ca c'est binen passé sinon false</returns> public static bool UpdateUser(T_User user) { try { BugTrackEntities model = new BugTrackEntities(); T_User userDB = model.T_User.Where(x => x.id == user.id).FirstOrDefault(); if (userDB != null) { userDB.email = user.email; userDB.firstname = user.firstname; userDB.name = user.name; userDB.password = user.password; userDB.phone = user.phone; model.SaveChanges(); return true; } else { return false; } } catch (Exception ex) { return false; } }
protected void Page_Load(object sender, EventArgs e) { DataAccess.T_User user = new lemett_aBugTrack.DataAccess.T_User() { email = "*****@*****.**", firstname = "toto", name = "titi", password = "******", phone = "023565", }; BusinessManagement.User.CreateUser(user); user = BusinessManagement.User.GetUser(1); user.password = "******"; BusinessManagement.User.UpdateUser(user); T_Project project = new T_Project() { name = "APM", startDate = DateTime.Now, version = "0.0.1" }; BusinessManagement.Project.CreateProject(project); project = BusinessManagement.Project.GetProject(1); project.version = "0.0.2"; BusinessManagement.Project.UpdateProject(project); T_BugCritic bugCritic = new T_BugCritic() { CreateDate = DateTime.Now, Description = "bug critic", title = "plantage grave", }; BusinessManagement.Bug.CreateBugCritic(bugCritic, project.id); T_Bug bug = BusinessManagement.Bug.GetBug(1); T_Transaction trans = new T_Transaction() { statut = (int)DBO.EnumStatut.Accepted, }; BusinessManagement.Transaction.CreateTransaction(trans, bug.id, user.id); T_Comment comment = new T_Comment() { details = "voir msdn", }; BusinessManagement.Comment.CreateComment(comment, user.id, bug.id); comment = BusinessManagement.Comment.GetComment(1); comment.details = "ou microsoft"; BusinessManagement.Comment.UpdateComment(comment); BusinessManagement.GenerateDocx.GenerateReportBug(1); BusinessManagement.Comment.DeleteComment(comment.id); BusinessManagement.Transaction.DeleteTransaction(trans.id); BusinessManagement.Bug.DeleteBug(bug.id); BusinessManagement.Project.DeleteProject(project.id); BusinessManagement.User.DeleteUser(user.id); }
/// <summary> /// permet de mettre à jour l'utilisateur /// </summary> /// <param name="user">l'utilisateur a mettre a jour</param> /// <returns>true si ca c'est binen passé sinon false</returns> public static bool UpdateUser(T_User user) { return DataAccess.User.UpdateUser(user); }
/// <summary> /// permet la création d'un utilisateur /// </summary> /// <param name="user">l'objet utilisateur à crer</param> /// <returns>true si tout se passe bien sinon false</returns> public static bool CreateUser(T_User user) { return DataAccess.User.CreateUser(user); }
/// <summary> /// Deprecated Method for adding a new object to the T_User EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToT_User(T_User t_User) { base.AddObject("T_User", t_User); }
/// <summary> /// Create a new T_User object. /// </summary> /// <param name="id">Initial value of the id property.</param> /// <param name="name">Initial value of the name property.</param> /// <param name="firstname">Initial value of the firstname property.</param> /// <param name="email">Initial value of the email property.</param> /// <param name="phone">Initial value of the phone property.</param> /// <param name="password">Initial value of the password property.</param> public static T_User CreateT_User(global::System.Int64 id, global::System.String name, global::System.String firstname, global::System.String email, global::System.String phone, global::System.String password) { T_User t_User = new T_User(); t_User.id = id; t_User.name = name; t_User.firstname = firstname; t_User.email = email; t_User.phone = phone; t_User.password = password; return t_User; }