예제 #1
0
        public static void Finish(int taskId)
        {
            if (taskId > 0)
            {
                ProjectsRepository     projectsRepository     = new ProjectsRepository(new DB.PmcsDbContext());
                ProjectTasksRepository projectTasksRepository = new ProjectTasksRepository(new DB.PmcsDbContext());

                var original = projectTasksRepository.GetById(t => t.TaskId == taskId);
                var newTask  = projectTasksRepository.GetById(t => t.TaskId == taskId);
                newTask.CompletionPercentage = 1.00;
                newTask.TaskStatus           = 2;
                newTask.TaskComplete         = true;
                newTask.ActualEndDate        = DateTime.Now;

                projectTasksRepository.Update(original, newTask);

                if (original.ParentTaskId != null)
                {
                    var childrenTasks = projectTasksRepository
                                        .SearchData(t => t.ParentTaskId == original.ParentTaskId)
                                        .ToList();

                    if (childrenTasks.Any() && childrenTasks.All(t => t.TaskComplete == true))
                    {
                        var originalParent = projectTasksRepository.GetById(t => t.TaskId == original.ParentTaskId);
                        var newParentTask  = projectTasksRepository.GetById(t => t.TaskId == original.ParentTaskId);
                        newParentTask.CompletionPercentage = 1.00;
                        newParentTask.TaskStatus           = 2;
                        newParentTask.TaskComplete         = true;
                        projectTasksRepository.Update(originalParent, newParentTask);
                    }
                }
            }
        }
예제 #2
0
        public static void UpdateTaskActualStartDate(int taskId)
        {
            ProjectTasksRepository projectTasksRepository = new ProjectTasksRepository(new DB.PmcsDbContext());
            var original = projectTasksRepository.GetById(j => j.TaskId == taskId);
            var updated  = projectTasksRepository.GetById(j => j.TaskId == taskId);

            updated.ActualStartDate = DateTime.Now;
            projectTasksRepository.Update(original, updated);
        }
예제 #3
0
        public void EditTask(ProjectTask task)
        {
            var original = projectTasksRepository.GetById(t => t.TaskId == task.TaskId);

            projectTasksRepository.Update(original, task.AutoMapObject <ProjectTask, DB.Task>());
        }