public MessageWrapper UpdateProjectMessage(int messageid, MessageStatus status) { var messageEngine = EngineFactory.MessageEngine; var discussion = messageEngine.GetByID(messageid).NotFoundIfNull(); ProjectSecurity.DemandEdit(discussion); discussion.Status = status; messageEngine.ChangeStatus(discussion); MessageService.Send(Request, MessageAction.DiscussionUpdated, MessageTarget.Create(discussion.ID), discussion.Project.Title, discussion.Title); return(new MessageWrapper(discussion)); }
public MessageWrapper DeleteProjectMessage(int messageid) { var discussionEngine = EngineFactory.GetMessageEngine(); var discussion = discussionEngine.GetByID(messageid).NotFoundIfNull(); ProjectSecurity.DemandEdit(discussion); discussionEngine.Delete(discussion); MessageService.Send(_context, MessageAction.DiscussionDeleted, discussion.Project.Title, discussion.Title); return(new MessageWrapper(discussion)); }
public MessageWrapper DeleteProjectMessage(int messageid) { var discussionEngine = EngineFactory.MessageEngine; var discussion = discussionEngine.GetByID(messageid).NotFoundIfNull(); ProjectSecurity.DemandEdit(discussion); discussionEngine.Delete(discussion); MessageService.Send(Request, MessageAction.DiscussionDeleted, MessageTarget.Create(discussion.ID), discussion.Project.Title, discussion.Title); return(MessageWrapperSelector(discussion)); }
public MessageWrapper UpdateProjectMessage(int messageid, int projectid, string title, string content, string participants, bool?notify) { var messageEngine = EngineFactory.GetMessageEngine(); var message = messageEngine.GetByID(messageid).NotFoundIfNull(); var project = EngineFactory.GetProjectEngine().GetByID(projectid).NotFoundIfNull(); ProjectSecurity.DemandEdit(message); message.Project = Update.IfNotEmptyAndNotEquals(message.Project, project); message.Content = Update.IfNotEmptyAndNotEquals(message.Content, content); message.Title = Update.IfNotEmptyAndNotEquals(message.Title, title); messageEngine.SaveOrUpdate(message, notify ?? true, ToGuidList(participants), null); return(new MessageWrapper(message)); }
public TaskWrapper UpdateTask(int taskid, int milestoneid) { if (milestoneid < 0) { throw new ArgumentNullException("milestoneid"); } var taskEngine = EngineFactory.GetTaskEngine(); var task = taskEngine.GetByID(taskid).NotFoundIfNull(); ProjectSecurity.DemandEdit(task); taskEngine.MoveToMilestone(task, milestoneid); return(GetTask(taskid)); }
public MessageWrapperFull UpdateProjectMessage(int messageid, int projectid, string title, string content, string participants, bool?notify) { var messageEngine = EngineFactory.MessageEngine; var discussion = messageEngine.GetByID(messageid).NotFoundIfNull(); var project = EngineFactory.ProjectEngine.GetByID(projectid).NotFoundIfNull(); ProjectSecurity.DemandEdit(discussion); discussion.Project = Update.IfNotEmptyAndNotEquals(discussion.Project, project); discussion.Description = Update.IfNotEmptyAndNotEquals(discussion.Description, content); discussion.Title = Update.IfNotEmptyAndNotEquals(discussion.Title, title); messageEngine.SaveOrUpdate(discussion, notify.HasValue ? notify.Value : true, ToGuidList(participants)); MessageService.Send(Request, MessageAction.DiscussionUpdated, discussion.Project.Title, discussion.Title); return(new MessageWrapperFull(discussion, new ProjectWrapperFull(discussion.Project, EngineFactory.FileEngine.GetRoot(discussion.Project.ID)), GetProjectMessageSubscribers(messageid))); }
public MessageWrapper UpdateProjectMessage(int messageid, int projectid, string title, string content, string participants, bool?notify) { var messageEngine = EngineFactory.GetMessageEngine(); var discussion = messageEngine.GetByID(messageid).NotFoundIfNull(); var project = EngineFactory.GetProjectEngine().GetByID(projectid).NotFoundIfNull(); ProjectSecurity.DemandEdit(discussion); discussion.Project = Update.IfNotEmptyAndNotEquals(discussion.Project, project); discussion.Content = Update.IfNotEmptyAndNotEquals(discussion.Content, content); discussion.Title = Update.IfNotEmptyAndNotEquals(discussion.Title, title); discussion = messageEngine.SaveOrUpdate(discussion, notify ?? true, ToGuidList(participants), null); MessageService.Send(Request, MessageAction.DiscussionUpdated, discussion.Project.Title, discussion.Title); return(new MessageWrapper(discussion)); }
public TaskWrapper UpdateProjectTask(int taskid, string description, ApiDateTime deadline, ApiDateTime startDate, TaskPriority priority, string title, int milestoneid, IEnumerable <Guid> responsibles, int?projectID, bool notify, TaskStatus?status) { var taskEngine = EngineFactory.GetTaskEngine(); var task = taskEngine.GetByID(taskid).NotFoundIfNull(); ProjectSecurity.DemandEdit(task); if (string.IsNullOrEmpty(title)) { throw new ArgumentException(@"title can't be empty", "title"); } if (!EngineFactory.GetMilestoneEngine().IsExists(milestoneid) && milestoneid > 0) { throw new ItemNotFoundException("Milestone not found"); } task.Responsibles = new HashSet <Guid>(responsibles); task.Deadline = Update.IfNotEquals(task.Deadline, deadline); task.Description = Update.IfNotEquals(task.Description, description); task.Priority = Update.IfNotEquals(task.Priority, priority); task.Title = Update.IfNotEmptyAndNotEquals(task.Title, title); task.Milestone = Update.IfNotEquals(task.Milestone, milestoneid); task.StartDate = Update.IfNotEquals(task.StartDate, startDate); if (projectID.HasValue) { var project = EngineFactory.GetProjectEngine().GetByID((int)projectID).NotFoundIfNull(); task.Project = project; } EngineFactory.GetTaskEngine().SaveOrUpdate(task, null, notify); if (status.HasValue) { taskEngine.ChangeStatus(task, status.Value); } return(GetTask(taskid)); }