/// <summary> /// permet de supprimer un commentaire /// </summary> /// <param name="id">id du commentaire</param> /// <returns>true si bien supprimer sinon false</returns> public static bool DeleteComment(long id) { try { BugTrackEntities model = new BugTrackEntities(); model.DeleteObject(model.T_Comment.Where(x => x.id == id).FirstOrDefault()); model.SaveChanges(); return true; } catch (Exception ex) { return false; } }
/// <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 la création d'un projet /// </summary> /// <param name="project">l'objet project à crer</param> /// <returns>true si tout se passe bien sinon false</returns> public static bool CreateProject(T_Project project) { try { BugTrackEntities model = new BugTrackEntities(); model.AddToT_Project(project); model.SaveChanges(); return true; } catch (Exception ex) { return false; } }
/// <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 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 la création d'un bug /// </summary> /// <param name="bug">l'objet bug à crer</param> /// <returns>true si tout se passe bien sinon false</returns> public static bool CreateBug(T_Bug bug, long idProject) { try { BugTrackEntities model = new BugTrackEntities(); bug.T_Project = model.T_Project.Where(x => x.id == idProject).FirstOrDefault(); //model.Attach(bug.T_Project); model.AddToT_Bug(bug); 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; } }
/// <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; } }
/// <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; } }
/// <summary> /// permet de mettre à jour le projet /// </summary> /// <param name="project">le projet a mettre a jour</param> /// <returns>true si ca c'est binen passé sinon false</returns> public static bool UpdateProject(T_Project project) { try { BugTrackEntities model = new BugTrackEntities(); T_Project projectDB = model.T_Project.Where(x => x.id == project.id).FirstOrDefault(); if (projectDB != null) { projectDB.name = project.name; projectDB.startDate = project.startDate; projectDB.version = project.version; model.SaveChanges(); return true; } else { return false; } } catch (Exception ex) { return false; } }
/// <summary> /// permet de mettre à jour le bug /// </summary> /// <param name="bug">le bug a mettre a jour</param> /// <returns>true si ca c'est binen passé sinon false</returns> public static bool UpdateBug(T_Bug bug) { try { BugTrackEntities model = new BugTrackEntities(); T_Bug bugDB = model.T_Bug.Where(x => x.id == bug.id).FirstOrDefault(); if (bugDB != null) { bugDB.title = bug.title; model.SaveChanges(); return true; } else { return false; } } catch (Exception ex) { return false; } }