Example #1
0
        public ActionResult TaskDetails(string Id, string Comment, string Reply, Int64 TaskCommentId = 0)
        {
            TaskMaster task   = new TaskMaster();
            string     UserId = User.Identity.GetUserId();

            task = userContext.TaskMaster.Find(Id);
            var    user             = generic.GetUserDetail(UserId);
            string body             = " has commented for the Task: ";
            bool   Status           = false;
            string CommentOrReplyBy = UserId;
            var    result           = false;

            if (!string.IsNullOrEmpty(Id) && !string.IsNullOrEmpty(Comment))
            {
                result = emsMgr.AddTaskComments(Id, Comment, DateTime.Now, UserId);
                if (user.Role == "Admin")
                {
                    admin.AddNotification(task.AssignedTo, CommentOrReplyBy, body + task.TaskId, "Task", task.TaskId, Status, DateTime.Now);
                }
                else
                {
                    admin.AddNotification(task.CreatedBy, CommentOrReplyBy, body + task.TaskId, "Task", task.TaskId, Status, DateTime.Now);
                }
            }

            if (TaskCommentId != 0 && !string.IsNullOrEmpty(Reply))
            {
                body   = " has replied  for the comment of Task: ";
                result = emsMgr.AddTaskReplies(TaskCommentId, Reply, DateTime.Now, UserId);
                if (user.Role == "Admin")
                {
                    admin.AddNotification(task.AssignedTo, CommentOrReplyBy, body + task.TaskId, "Task", task.TaskId, Status, DateTime.Now);
                }
                else
                {
                    admin.AddNotification(task.CreatedBy, CommentOrReplyBy, body + task.TaskId, "Task", task.TaskId, Status, DateTime.Now);
                }
            }

            return(RedirectToAction("TaskDetails", "Task", new { area = "CMS", Id = Id, AssignedTo = "", TaskStatus = 0 }));
        }