/// <summary> /// permet la création d'une transaction /// </summary> /// <param name="Transaction">l'objet Transaction à crer</param> /// <returns>true si tout se passe bien sinon false</returns> public static bool CreateTransaction(T_Transaction Transaction, long idBug, long idUser) { try { BugTrackEntities model = new BugTrackEntities(); Transaction.T_User = model.T_User.Where(x => x.id == idUser).FirstOrDefault(); Transaction.T_Bug = model.T_Bug.Where(x => x.id == idBug).FirstOrDefault(); model.AddToT_Transaction(Transaction); model.SaveChanges(); return true; } catch (Exception ex) { return false; } }
/// <summary> /// permet de mettre à jour la transaction /// </summary> /// <param name="Transaction">la transaction a mettre a jour</param> /// <returns>true si ca c'est binen passé sinon false</returns> public static bool UpdateTransaction(T_Transaction Transaction) { try { BugTrackEntities model = new BugTrackEntities(); T_Transaction TransactionDB = model.T_Transaction.Where(x => x.id == Transaction.id).FirstOrDefault(); if (TransactionDB != null) { TransactionDB.statut = Transaction.statut; 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> /// Deprecated Method for adding a new object to the T_Transaction EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToT_Transaction(T_Transaction t_Transaction) { base.AddObject("T_Transaction", t_Transaction); }
/// <summary> /// Create a new T_Transaction object. /// </summary> /// <param name="id">Initial value of the id property.</param> /// <param name="statut">Initial value of the statut property.</param> public static T_Transaction CreateT_Transaction(global::System.Int64 id, global::System.Int32 statut) { T_Transaction t_Transaction = new T_Transaction(); t_Transaction.id = id; t_Transaction.statut = statut; return t_Transaction; }
/// <summary> /// permet de mettre à jour la transaction /// </summary> /// <param name="Transaction">la transaction a mettre a jour</param> /// <returns>true si ca c'est binen passé sinon false</returns> public static bool UpdateTransaction(T_Transaction Transaction) { return DataAccess.Transaction.UpdateTransaction(Transaction); }
/// <summary> /// permet la création d'une transaction /// </summary> /// <param name="Transaction">l'objet Transaction à crer</param> /// <returns>true si tout se passe bien sinon false</returns> public static bool CreateTransaction(T_Transaction Transaction, long idBug, long idUser) { return DataAccess.Transaction.CreateTransaction(Transaction, idBug, idUser); }