Esempio n. 1
0
        /// <summary>
        /// Edits the sub task.
        /// </summary>
        /// <param name="projectId">The project identifier.</param>
        /// <param name="taskId">The task identifier.</param>
        /// <param name="subTaskId">The sub task identifier.</param>
        /// <param name="includeInactive">The include inactive.</param>
        /// <param name="developerId">The developer identifier.</param>
        /// <param name="tabId">The tab identifier.</param>
        /// <param name="fromSubTaskDetailView">From sub task detail view.</param>
        /// <returns>edit sub task</returns>
        public ActionResult EditSubTask(int? projectId, int? taskId, int? subTaskId, string includeInactive, string developerId, string tabId, string fromSubTaskDetailView)
        {
            var taskPresenter = new TaskPresenter { TabId = tabId, TaskId = taskId };
            taskPresenter.FromSubTaskDetailView = Convert.ToBoolean(fromSubTaskDetailView, CultureInfo.CurrentCulture);
            if (subTaskId == null || taskId == null || (projectId == null && string.IsNullOrWhiteSpace(developerId)))
            {
                return this.Redirect(this.Url.AccountAction());
            }

            var mainTaskInfo = this.taskService.RetrieveTask(taskId).FirstOrDefault();
            var subTaskInfo = this.taskService.RetrieveTask(subTaskId).FirstOrDefault();

            if (subTaskInfo == null)
            {
                return this.Redirect(this.Url.AccountAction());
            }

            if (projectId != null)
            {
                if (!string.IsNullOrWhiteSpace(includeInactive))
                {
                    taskPresenter.IncludeInactive = Convert.ToBoolean(includeInactive, CultureInfo.CurrentCulture);
                }

                taskPresenter.SelectedProject = projectId.Value;
            }
            else if (!string.IsNullOrWhiteSpace(developerId))
            {
                taskPresenter.SelectedDeveloper = Convert.ToInt32(developerId);
            }

            taskPresenter.TaskId = subTaskId;
            this.AssignAttachmentList(taskPresenter);
            taskPresenter.IsEdit = true;
            this.AddBreadcrumbItem(Resources.TaskDetails, this.RetrieveTaskDetailsAddress(this.Url.TaskDetailsAction(), Convert.ToString(projectId), developerId, tabId, includeInactive, Convert.ToString(taskId)));
            this.AddBreadcrumbItem(Resources.EditSubTask, string.Empty);
            taskPresenter.PortalName = Resources.EditSubTask;
            taskPresenter.AssignTaskDetails(subTaskInfo);
            taskPresenter.DueDate = taskPresenter.TaskDetails.TaskDueDate;
            taskPresenter.StartDate = taskPresenter.TaskDetails.StartDate;
            taskPresenter.MainTaskStartDate = mainTaskInfo.StartDate;
            taskPresenter.MainTaskDueDate = mainTaskInfo.TaskDueDate;
            taskPresenter.PercentCompleted = taskPresenter.TaskDetails.CompletedPercent;

            this.AssignData(taskPresenter);
            return this.View(taskPresenter);
        }
Esempio n. 2
0
        /// <summary>
        /// Edits the task.
        /// </summary>
        /// <param name="taskPresenter">The task presenter.</param>
        /// <param name="taskId">The task id.</param>
        /// <param name="portalName">Name of the portal.</param>
        /// <param name="includeInactive">The include inactive.</param>
        /// <param name="tabId">The tab id.</param>
        /// <returns>
        /// returns Edit task view
        /// </returns>
        public ActionResult EditTask(TaskPresenter taskPresenter, string taskId, string portalName, string includeInactive, string tabId)
        {
            if (taskPresenter == null || string.IsNullOrWhiteSpace(taskId))
            {
                return this.Redirect(Url.AccountAction());
            }

            taskPresenter.TaskId = Convert.ToInt32(taskId, CultureInfo.CurrentCulture);
            var taskInfo = this.taskService.RetrieveTask(taskPresenter.TaskId).FirstOrDefault();

            this.AssignAttachmentList(taskPresenter);

            if (taskInfo == null)
            {
                return this.Redirect(this.Url.AccountAction());
            }

            var subTaskInfo = this.taskService.RetrieveSubtask(taskPresenter.TaskId);
            if (subTaskInfo != null && subTaskInfo.Count > 0)
            {
                taskPresenter.HasSubTask = true;
                taskPresenter.IsAllSubTaskCompleted = subTaskInfo.All(s => s.Status == DoneStatus);
                taskPresenter.SubTaskDueDate = subTaskInfo.Max(s => s.SubTaskDueDate);
            }

            taskPresenter.AssignTaskDetails(taskInfo);
            taskPresenter.IsEdit = true;
            string projectId = null;
            string developerId = null;

            if (!string.IsNullOrWhiteSpace(portalName))
            {
                if (portalName.Equals(Resources.TeamMemberDashboard))
                {
                    developerId = taskPresenter.TaskDetails.DeveloperIDs;
                }
                else if (portalName.Equals(Resources.ProjectDashboard))
                {
                    projectId = Convert.ToString(taskInfo.ProjectID, CultureInfo.CurrentCulture);
                }
            }

            this.AddBreadcrumbItem(Resources.TaskDetails, this.RetrieveTaskDetailsAddress(this.Url.TaskDetailsAction(), projectId, developerId, tabId, includeInactive, taskId));
            this.AddBreadcrumbItem(Resources.EditTask, string.Empty);
            this.AssignData(taskPresenter);

            return this.View(taskPresenter);
        }
Esempio n. 3
0
        /// <summary>
        /// Subs the task details.
        /// </summary>
        /// <param name="subTaskId">The sub task identifier.</param>
        /// <returns>sub task partial view</returns>
        public ActionResult SubTaskDetails(int? subTaskId)
        {
            var taskPresenter = new TaskPresenter { TaskId = subTaskId };
            var taskInfo = this.taskService.RetrieveTask(subTaskId).FirstOrDefault();
            if (taskInfo != null)
            {
                this.AssignBasicData(taskPresenter);
                taskPresenter.AssignTaskDetails(taskInfo);

                taskPresenter.TaskId = taskInfo.TaskID;
                this.AssignAttachmentList(taskPresenter);
            }

            return this.PartialView("_SubTaskDetail", taskPresenter);
        }
Esempio n. 4
0
        /// <summary>
        /// Adds the sub task.
        /// </summary>
        /// <param name="projectId">The project identifier.</param>
        /// <param name="taskId">The task identifier.</param>
        /// <param name="includeInactive">The include inactive.</param>
        /// <param name="developerId">The developer identifier.</param>
        /// <param name="tabId">The tab identifier.</param>
        /// <returns>returns sub task view</returns>
        public ActionResult AddSubTask(int? projectId, int? taskId, string includeInactive, string developerId, string tabId)
        {
            var taskPresenter = new TaskPresenter { TabId = tabId };
            if (taskId == null || (projectId == null && string.IsNullOrWhiteSpace(developerId)))
            {
                return this.Redirect(Url.AccountAction());
            }

            var taskInfo = this.taskService.RetrieveTask(taskId).FirstOrDefault();
            if (taskInfo == null)
            {
                return this.Redirect(this.Url.AccountAction());
            }

            if (projectId != null)
            {
                if (!string.IsNullOrWhiteSpace(includeInactive))
                {
                    taskPresenter.IncludeInactive = Convert.ToBoolean(includeInactive, CultureInfo.CurrentCulture);
                }

                taskPresenter.SelectedProject = projectId.Value;
            }
            else if (!string.IsNullOrWhiteSpace(developerId))
            {
                taskPresenter.SelectedDeveloper = Convert.ToInt32(developerId);
            }

            this.AddBreadcrumbItem(Resources.TaskDetails, this.RetrieveTaskDetailsAddress(this.Url.TaskDetailsAction(), Convert.ToString(projectId), developerId, tabId, includeInactive, Convert.ToString(taskId)));
            this.AddBreadcrumbItem(Resources.AddSubTask, string.Empty);
            taskPresenter.PortalName = Resources.AddSubTask;
            this.AssignData(taskPresenter);
            taskPresenter.AssignTaskDetails(taskInfo);
            taskPresenter.MainTaskStartDate = taskInfo.StartDate;
            taskPresenter.MainTaskDueDate = taskInfo.TaskDueDate;

            taskPresenter.StartDate = DateTimeHelper.RetrieveCurrentDate();

            return this.View(taskPresenter);
        }
Esempio n. 5
0
        /// <summary>
        /// Tasks the details.
        /// </summary>
        /// <param name="projectId">The project id.</param>
        /// <param name="taskId">The task id.</param>
        /// <param name="includeInactive">The include inactive.</param>
        /// <param name="developerId">The developer id.</param>
        /// <param name="tabId">The tab id.</param>
        /// <param name="parentTaskId">The parent task identifier.</param>
        /// <returns>
        /// returns Task Details view
        /// </returns>
        public ActionResult TaskDetails(int? projectId, int? taskId, string includeInactive, string developerId, string tabId, int? parentTaskId)
        {
            var taskPresenter = new TaskPresenter { TabId = tabId, TaskId = taskId };
            if (taskId == null)
            {
                return this.Redirect(Url.AccountAction());
            }

            var taskInfos = this.taskService.RetrieveTask(taskId);

            List<string> features = new List<string>();
            foreach (var item in taskInfos)
            {
                features.Add(item.FeatureID.ToString());
            }

            taskPresenter.FeatureIds = string.Join(", ", features.ToArray());
            var taskInfo = taskInfos.FirstOrDefault();
            if (taskInfo == null)
            {
                return this.Redirect(this.Url.AccountAction());
            }

            if (parentTaskId != null)
            {
                taskInfo.ParentTaskID = parentTaskId;
            }

            if (projectId != null)
            {
                taskPresenter.PortalName = Resources.ProjectDashboard;
                if (!string.IsNullOrWhiteSpace(includeInactive))
                {
                    taskPresenter.IncludeInactive = Convert.ToBoolean(includeInactive, CultureInfo.CurrentCulture);
                }

                this.AddBreadcrumbItem(Resources.ProjectDashboard, this.RetrieveProjectDashboardAddress(this.Url.ProjectDashboardAction(), projectId, includeInactive, taskPresenter.TabId));
            }
            else if (!string.IsNullOrWhiteSpace(developerId))
            {
                taskPresenter.SelectedDeveloper = int.Parse(developerId);
                this.AddBreadcrumbItem(Resources.TeamMemberDashboard, this.RetrieveTeamMemberDashboardAddress(this.Url.TeamDashboardAction(), developerId));
                taskPresenter.SelectedDeveloper = Convert.ToInt32(developerId, CultureInfo.CurrentCulture);
                taskPresenter.PortalName = Resources.TeamMemberDashboard;
            }

            if (taskInfo.ParentTaskID != null)
            {
                taskPresenter.FromSubTaskDetailView = true;
                this.AddBreadcrumbItem(Resources.SubTaskDetail, string.Empty);
            }
            else
            {
                this.AddBreadcrumbItem(Resources.TaskDetails, string.Empty);
            }

            this.AssignBasicData(taskPresenter);
            taskPresenter.AssignTaskDetails(taskInfo);
            taskPresenter.AssignTaskComments(this.taskService.RetrieveTaskComment(taskId));

            this.AssignTaskCommentAttachments(taskPresenter);

            taskPresenter.IsExpiredDueDate = taskInfo.TaskDueDate == null ? (bool?)null : taskInfo.TaskDueDate < DateTimeHelper.RetrieveCurrentDate();
            taskPresenter.AssignSubTask(this.taskService.RetrieveSubtask(taskId));
            taskPresenter.Offset = DefaultValue;
            taskPresenter.AssignTaskHistory(this.taskService.RetrieveTaskHistory(taskId, taskPresenter.Offset, TaskPresenter.NumberOfRecord));

            this.AssignAttachmentList(taskPresenter);
            return this.View(taskPresenter);
        }