public AjaxResponse AddComment(string parrentCommentID, int taskID, string text, string pid) { var taskEngine = Global.EngineFactory.GetTaskEngine(); ProjectSecurity.DemandCreateComment(); var comment = new Comment { Content = text, TargetUniqID = ProjectEntity.BuildUniqId <Task>(taskID) }; if (!String.IsNullOrEmpty(parrentCommentID)) { comment.Parent = new Guid(parrentCommentID); } Task = taskEngine.GetByID(taskID); if (Task == null) { return new AjaxResponse { status = "error", message = "Access denied." } } ; taskEngine.SaveOrUpdateComment(Task, comment); return(new AjaxResponse { rs1 = parrentCommentID, rs2 = GetHTMLComment(comment) }); }
public AjaxResponse AddComment(string parrentCommentID, string messageID, string text, string pid) { ProjectSecurity.DemandCreateComment(); var resp = new AjaxResponse(); var comment = new Comment { Content = text, TargetUniqID = ProjectEntity.BuildUniqId <Message>(Convert.ToInt32(messageID)) }; resp.rs1 = parrentCommentID; if (!String.IsNullOrEmpty(parrentCommentID)) { comment.Parent = new Guid(parrentCommentID); } var messageEngine = Global.EngineFactory.GetMessageEngine(); Discussion = messageEngine.GetByID(Convert.ToInt32(messageID)); if (Discussion == null) { return new AjaxResponse { status = "error", message = "Access denied." } } ; messageEngine.SaveOrUpdateComment(Discussion, comment); resp.rs2 = GetHTMLComment(comment); return(resp); }
public AjaxResponse AddComment(string parrentCommentID, int taskID, string text, string pid) { text = HtmlUtility.GetFull(text); var taskEngine = Global.EngineFactory.GetTaskEngine(); ProjectSecurity.DemandCreateComment(); var comment = new Comment { Content = text, TargetUniqID = ProjectEntity.BuildUniqId <Task>(taskID) }; if (!String.IsNullOrEmpty(parrentCommentID)) { comment.Parent = new Guid(parrentCommentID); } Task = taskEngine.GetByID(taskID); if (Task == null) { return new AjaxResponse { status = "error", message = "Access denied." } } ; comment = taskEngine.SaveOrUpdateComment(Task, comment); MessageService.Send(HttpContext.Current.Request, MessageAction.TaskCommentCreated, Task.Project.Title, Task.Title); return(new AjaxResponse { rs1 = parrentCommentID, rs2 = GetHTMLComment(comment) }); }
public AjaxResponse AddComment(string parrentCommentID, string messageID, string text, string pid) { text = HtmlUtility.GetFull(text); ProjectSecurity.DemandCreateComment(); var resp = new AjaxResponse(); var comment = new Comment { Content = text, TargetUniqID = ProjectEntity.BuildUniqId <Message>(Convert.ToInt32(messageID)) }; resp.rs1 = parrentCommentID; if (!string.IsNullOrEmpty(parrentCommentID)) { comment.Parent = new Guid(parrentCommentID); } var messageEngine = Global.EngineFactory.GetMessageEngine(); Discussion = messageEngine.GetByID(Convert.ToInt32(messageID)); if (Discussion == null) { return new AjaxResponse { status = "error", message = "Access denied." } } ; comment = messageEngine.SaveOrUpdateComment(Discussion, comment); MessageService.Send(HttpContext.Current.Request, MessageAction.DiscussionCommentCreated, Discussion.Project.Title, Discussion.Title); resp.rs2 = GetHTMLComment(comment); return(resp); }
public CommentInfo AddProjectComment(string parentcommentid, int entityid, string content, string type) { if (string.IsNullOrEmpty(type) || !(new List <string> { "message", "task" }).Contains(type.ToLower())) { throw new ArgumentException(); } var comment = type.ToLower().Equals("message") ? new Comment { Content = content, TargetUniqID = ProjectEntity.BuildUniqId <Message>(entityid) } : new Comment { Content = content, TargetUniqID = ProjectEntity.BuildUniqId <Task>(entityid) }; if (!string.IsNullOrEmpty(parentcommentid)) { comment.Parent = new Guid(parentcommentid); } var commentEngine = EngineFactory.CommentEngine; var entity = commentEngine.GetEntityByTargetUniqId(comment); if (entity == null) { throw new Exception("Access denied."); } ProjectSecurity.DemandCreateComment(entity); comment = commentEngine.SaveOrUpdateComment(entity, comment); MessageService.Send(Request, MessageAction.TaskCommentCreated, entity.Project.Title, entity.Title); return(GetCommentInfo(comment, entity)); }