private TaskLink(TaskId predecessorId, TaskId successorId, TaskLinkType type, TimeSpan lag)
 {
     _predecessorId = predecessorId;
     _successorId   = successorId;
     _type          = type;
     _lag           = lag;
 }
示例#2
0
        public Project AddTaskLink(TaskId predecessorId,
                                   TaskId successorId,
                                   TaskLinkType type = TaskLinkType.FinishToStart,
                                   TimeSpan lag      = default)
        {
            var taskLink = TaskLink.Create(predecessorId, successorId, type, lag);

            return(AddTaskLink(taskLink));
        }
示例#3
0
        public TaskWrapper AddLink(int parentTaskId, int dependenceTaskId, TaskLinkType linkType)
        {
            var taskEngine = EngineFactory.GetTaskEngine();

            var dependentTask = taskEngine.GetByID(dependenceTaskId).NotFoundIfNull();
            var parentTask    = taskEngine.GetByID(parentTaskId).NotFoundIfNull();

            taskEngine.AddLink(parentTask, dependentTask, linkType);

            return(new TaskWrapper(dependentTask));
        }
        public TaskWrapper AddLink(int parentTaskId, int dependenceTaskId, TaskLinkType linkType)
        {
            var taskEngine = EngineFactory.TaskEngine;

            var dependentTask = taskEngine.GetByID(dependenceTaskId).NotFoundIfNull();
            var parentTask    = taskEngine.GetByID(parentTaskId).NotFoundIfNull();

            taskEngine.AddLink(parentTask, dependentTask, linkType);
            MessageService.Send(Request, MessageAction.TasksLinked, MessageTarget.Create(new[] { parentTask.ID, dependentTask.ID }), parentTask.Project.Title, parentTask.Title, dependentTask.Title);

            return(TaskWrapperSelector(dependentTask));
        }
        public TaskWrapper AddLink(int parentTaskId, int dependenceTaskId, TaskLinkType linkType)
        {
            var taskEngine = EngineFactory.GetTaskEngine();

            var dependentTask = taskEngine.GetByID(dependenceTaskId).NotFoundIfNull();
            var parentTask    = taskEngine.GetByID(parentTaskId).NotFoundIfNull();

            taskEngine.AddLink(parentTask, dependentTask, linkType);
            MessageService.Send(_context, MessageAction.TasksLinked, parentTask.Project.Title, parentTask.Title, dependentTask.Title);

            return(new TaskWrapper(dependentTask));
        }
        public static TaskLink Create(TaskId predecessorId,
                                      TaskId successorId,
                                      TaskLinkType type = TaskLinkType.FinishToStart,
                                      TimeSpan lag      = default)
        {
            if (predecessorId.IsDefault)
            {
                throw new ArgumentOutOfRangeException(nameof(predecessorId));
            }

            if (successorId.IsDefault)
            {
                throw new ArgumentOutOfRangeException(nameof(successorId));
            }

            return(new TaskLink(predecessorId, successorId, type, lag));
        }
示例#7
0
        private static void CheckLink(Task parentTask, Task dependentTask, TaskLinkType linkType)
        {
            CheckLink(parentTask, dependentTask);

            switch (linkType)
            {
            case TaskLinkType.End:
                if ((parentTask.Deadline.Equals(DateTime.MinValue) && parentTask.Milestone == 0) || (dependentTask.Deadline.Equals(DateTime.MinValue) && dependentTask.Milestone == 0))
                {
                    throw new Exception("Such link don't be created. Incorrect task link type.");
                }
                break;

            case TaskLinkType.EndStart:
                if ((parentTask.Deadline.Equals(DateTime.MinValue) && parentTask.Milestone == 0))
                {
                    throw new Exception("Such link don't be created. Incorrect task link type.");
                }
                break;
            }
        }
示例#8
0
        public void AddLink(Task parentTask, Task dependentTask, TaskLinkType linkType)
        {
            CheckLink(parentTask, dependentTask, linkType);

            var link = new TaskLink
            {
                ParentTaskId     = parentTask.ID,
                DependenceTaskId = dependentTask.ID,
                LinkType         = linkType
            };

            if (taskDao.IsExistLink(link))
            {
                throw new Exception("link already exist");
            }

            ProjectSecurity.DemandEdit(dependentTask);
            ProjectSecurity.DemandEdit(parentTask);

            taskDao.AddLink(link);
        }
示例#9
0
        private static void CheckLink(Task parentTask, Task dependentTask, TaskLinkType linkType)
        {
            CheckLink(parentTask, dependentTask);

            switch (linkType)
            {
                case TaskLinkType.End:
                    if ((parentTask.Deadline.Equals(DateTime.MinValue) && parentTask.Milestone == 0) || (dependentTask.Deadline.Equals(DateTime.MinValue) && dependentTask.Milestone == 0))
                    {
                        throw new Exception("Such link don't be created. Incorrect task link type.");
                    }
                    break;

                case TaskLinkType.EndStart:
                    if ((parentTask.Deadline.Equals(DateTime.MinValue) && parentTask.Milestone == 0))
                    {
                        throw new Exception("Such link don't be created. Incorrect task link type.");
                    }
                    break;
            }
        }
示例#10
0
        public void AddLink(Task parentTask, Task dependentTask, TaskLinkType linkType)
        {
            CheckLink(parentTask, dependentTask, linkType);

            var link = new TaskLink
            {
                ParentTaskId = parentTask.ID,
                DependenceTaskId = dependentTask.ID,
                LinkType = linkType
            };

            if (taskDao.IsExistLink(link))
                throw new Exception("link already exist");

            ProjectSecurity.DemandEdit(dependentTask);
            ProjectSecurity.DemandEdit(parentTask);

            taskDao.AddLink(link);
        }
示例#11
0
        public TaskWrapper AddLink(int parentTaskId, int dependenceTaskId, TaskLinkType linkType)
        {
            var taskEngine = EngineFactory.GetTaskEngine();

            var dependentTask = taskEngine.GetByID(dependenceTaskId).NotFoundIfNull();
            var parentTask = taskEngine.GetByID(parentTaskId).NotFoundIfNull();

            taskEngine.AddLink(parentTask, dependentTask, linkType);
            MessageService.Send(Request, MessageAction.TasksLinked, parentTask.Project.Title, parentTask.Title, dependentTask.Title);

            return new TaskWrapper(dependentTask);
        }
示例#12
0
 public TaskLinkWrapper(TaskLink link)
 {
     DependenceTaskId = link.DependenceTaskId;
     ParentTaskId     = link.ParentTaskId;
     LinkType         = link.LinkType;
 }
 public TaskLinkWrapper(TaskLink link)
 {
     DependenceTaskId = link.DependenceTaskId;
     ParentTaskId = link.ParentTaskId;
     LinkType = link.LinkType;
 }
示例#14
0
 public Task AddSuccessorLink(TaskId successorId,
                              TaskLinkType type = TaskLinkType.FinishToStart,
                              TimeSpan lag      = default)
 {
     return(Project.AddTaskLink(Id, successorId, type, lag).GetTask(Id));
 }
        public TaskWrapper AddLink(int parentTaskId, int dependenceTaskId, TaskLinkType linkType)
        {
            var taskEngine = EngineFactory.GetTaskEngine();

            var dependentTask = taskEngine.GetByID(dependenceTaskId).NotFoundIfNull();
            var parentTask = taskEngine.GetByID(parentTaskId).NotFoundIfNull();

            taskEngine.AddLink(parentTask, dependentTask, linkType);

            return new TaskWrapper(dependentTask);
        }