/// <summary> /// permet la création d'un comment /// </summary> /// <param name="comment">l'objet commentaire à crer</param> /// <returns>true si tout se passe bien sinon false</returns> public static bool CreateComment(T_Comment comment, long idUser, long idBug) { try { BugTrackEntities model = new BugTrackEntities(); comment.T_User = model.T_User.Where(x => x.id == idUser).FirstOrDefault(); comment.T_Bug = model.T_Bug.Where(x => x.id == idBug).FirstOrDefault(); model.AddToT_Comment(comment); model.SaveChanges(); return true; } catch (Exception ex) { return false; } }
/// <summary> /// permet de mettre à jour le commentaire /// </summary> /// <param name="comment">le commentaire a mettre a jour</param> /// <returns>true si ca c'est binen passé sinon false</returns> public static bool UpdateComment(T_Comment comment) { try { BugTrackEntities model = new BugTrackEntities(); T_Comment commentDB = model.T_Comment.Where(x => x.id == comment.id).FirstOrDefault(); if (commentDB != null) { commentDB.details = comment.details; 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> /// Create a new T_Comment object. /// </summary> /// <param name="id">Initial value of the id property.</param> /// <param name="details">Initial value of the details property.</param> public static T_Comment CreateT_Comment(global::System.Int64 id, global::System.String details) { T_Comment t_Comment = new T_Comment(); t_Comment.id = id; t_Comment.details = details; return t_Comment; }
/// <summary> /// Deprecated Method for adding a new object to the T_Comment EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToT_Comment(T_Comment t_Comment) { base.AddObject("T_Comment", t_Comment); }
/// <summary> /// permet de mettre à jour le commentaire /// </summary> /// <param name="comment">le commentaire a mettre a jour</param> /// <returns>true si ca c'est binen passé sinon false</returns> public static bool UpdateComment(T_Comment comment) { return DataAccess.Comment.UpdateComment(comment); }
/// <summary> /// permet la création d'un comment /// </summary> /// <param name="comment">l'objet commentaire à crer</param> /// <returns>true si tout se passe bien sinon false</returns> public static bool CreateComment(T_Comment comment, long idUser, long idBug) { return DataAccess.Comment.CreateComment(comment, idUser, idBug); }