Exemplo n.º 1
0
 public SimpleTaskWrapper(Task task)
 {
     ID = task.ID;
     Title = task.Title;
     Description = task.Description;
     Deadline = (ApiDateTime)task.Deadline;
 }
Exemplo n.º 2
0
        public Subtask ChangeStatus(Task task, Subtask subtask, TaskStatus newStatus)
        {
            if (subtask == null) throw new Exception("subtask.Task");
            if (task == null) throw new ArgumentNullException("task");
            if (task.Status == TaskStatus.Closed) throw new Exception("task can't be closed");

            if (subtask.Status == newStatus) return subtask;

            ProjectSecurity.DemandEdit(task, subtask);
           
            subtask.Status = newStatus;
            subtask.LastModifiedBy = SecurityContext.CurrentAccount.ID;
            subtask.LastModifiedOn = TenantUtil.DateTimeNow();
            subtask.StatusChangedOn = TenantUtil.DateTimeNow();

            if (subtask.Responsible.Equals(Guid.Empty))
                subtask.Responsible = SecurityContext.CurrentAccount.ID;

            var senders = GetSubscribers(task);

            if (task.Status != TaskStatus.Closed && newStatus == TaskStatus.Closed && !factory.DisableNotifications && senders.Count != 0)
                NotifyClient.Instance.SendAboutSubTaskClosing(senders, task, subtask);

            if (task.Status != TaskStatus.Closed && newStatus == TaskStatus.Open && !factory.DisableNotifications && senders.Count != 0)
                NotifyClient.Instance.SendAboutSubTaskResumed(senders, task, subtask);

            return subtaskDao.Save(subtask);
        }
Exemplo n.º 3
0
        public TaskWrapper(Task task)
        {
            if (task.SubTasks != null)
                Subtasks = task.SubTasks.Select(x => new SubtaskWrapper(x, task)).ToList();

            CreatedBy = EmployeeWraper.Get(task.CreateBy);
            if (task.CreateBy != task.LastModifiedBy)
                UpdatedBy = EmployeeWraper.Get(task.LastModifiedBy);

            if (task.Responsible!=Guid.Empty)
                Responsible = EmployeeWraper.Get(task.Responsible);

            Id = task.ID;

            Updated = (ApiDateTime)task.LastModifiedOn;
            Created = (ApiDateTime)task.CreateOn;
            Deadline = (task.Deadline == DateTime.MinValue ? null : (ApiDateTime)task.Deadline);
            Priority = task.Priority;
            
            Title = task.Title;
            Status = (int)task.Status;
            Description = task.Description;
            MilestoneId = task.Milestone;
            ProjectOwner = new SimpleProjectWrapper(task.Project);
            CanEdit = ProjectSecurity.CanEdit(task);
            CanWork = ProjectSecurity.CanWork(task);

            if (task.Milestone != 0 && task.MilestoneDesc != null)
                Milestone = new SimpleMilestoneWrapper(task.MilestoneDesc);

            if (task.Responsibles != null)
                Responsibles = task.Responsibles.Select(x => EmployeeWraper.Get(x)).ToList();
        }
Exemplo n.º 4
0
 public override Task Save(Task task)
 {
     if (task != null)
     {
         ResetCache(task.ID);
     }
     return base.Save(task);
 }
Exemplo n.º 5
0
 public static void TimeSpend(TimeSpend timeSpend, Project project, Task relativeTask, String actionText, int actionType, int businessValue)
 {
     UserActivityPublisher.Publish<TimeLinePublisher>(
      new TimeLineUserActivity(actionText, actionType, businessValue)
      {
          ContentID = relativeTask != null ? relativeTask.ToString() : String.Empty,
          ContainerID = timeSpend.Task.Project.ID.ToString(),
          Title = relativeTask != null ? relativeTask.Title : timeSpend.Hours.ToString(),
          URL = String.Concat(VirtualPathUtility.ToAbsolute(ConfigurationManager.BaseVirtualPath + "timeTracking.aspx"), String.Format("?prjID={0}", timeSpend.Task.Project.ID)),
          AdditionalData = String.Format(AdditionalDataPattern, EntityType.TimeSpend, relativeTask != null ? relativeTask.Title : string.Empty, project.Title),
          SecurityId = string.Format(SecurityDataPattern, EntityType.TimeSpend, relativeTask != null ? relativeTask.ID.ToString() : string.Empty, project.ID)
      });
 }
Exemplo n.º 6
0
        private void InitTaskPage(Task task)
        {
            var taskDescriptionView = (TaskDescriptionView)LoadControl(PathProvider.GetFileStaticRelativePath("Tasks/TaskDescriptionView.ascx"));
            taskDescriptionView.Task = task;
            _content.Controls.Add(taskDescriptionView);

            EssenceTitle = task.Title;
            IsSubcribed = Global.EngineFactory.GetTaskEngine().IsSubscribed(task);

            if ((int)task.Status == 2)
            {
                EssenceStatus = TaskResource.Closed.ToLower();
            }

            Title = HeaderStringHelper.GetPageTitle(task.Title);
        }
Exemplo n.º 7
0
        public static void Task(Task task, Milestone milestone, String actionText, int actionType, int businessValue, bool withPreview)
        {
            //DropProjectActivitiesCache(task.Project);

            UserActivityPublisher.Publish<TimeLinePublisher>(new TimeLineUserActivity(actionText, actionType, businessValue)
            {

                ContentID = (milestone != null) ? milestone.ToString() : String.Empty,
                ContainerID = task.Project.ID.ToString(),
                Title = task.Title,
                URL = String.Concat(VirtualPathUtility.ToAbsolute(ConfigurationManager.BaseVirtualPath + "tasks.aspx").Replace("api/", ""), String.Format("?prjID={0}&id={1}", task.Project.ID, task.ID)),
                AdditionalData = String.Format(AdditionalDataPattern, EntityType.Task, (milestone != null) ? milestone.Title : String.Empty, task.Project.Title),
                SecurityId = string.Format(SecurityDataPattern, EntityType.Task, task.ID, task.Project.ID),
                HtmlPreview = withPreview ? task.Description.HtmlEncode() : null
            });
        }
Exemplo n.º 8
0
        public static bool CanRead(Task task, Guid userId)
        {
            if (task == null || !CanRead(task.Project, userId)) return false;
            if (task.Responsible == userId) return true;

            if (task.Responsibles.Contains(userId)) return true;

            if (!GetTeamSecurity(task.Project, userId, ProjectTeamSecurity.Tasks)) return false;
            if (task.Milestone != 0 && !GetTeamSecurity(task.Project, userId, ProjectTeamSecurity.Milestone))
            {
                var m = GetFactory().GetMilestoneDao().GetById(task.Milestone);
                if (!CanRead(m, userId)) return false;
            }

            return true;
        }
Exemplo n.º 9
0
        public TaskWrapper(Task task)
        {
            Id = task.ID;
            Title = task.Title;
            Description = task.Description;
            Status = (int)task.Status;

            if (task.Responsibles != null)
            {
                Responsibles = task.Responsibles.Select(EmployeeWraper.Get).OrderBy(r=> r.DisplayName).ToList();
            }


            Deadline = (task.Deadline == DateTime.MinValue ? null : new ApiDateTime(task.Deadline, TimeZoneInfo.Local));
            Priority = task.Priority;
            ProjectOwner = new SimpleProjectWrapper(task.Project);
            MilestoneId = task.Milestone;
            Created = (ApiDateTime)task.CreateOn;
            CreatedBy = EmployeeWraper.Get(task.CreateBy);
            Updated = (ApiDateTime)task.LastModifiedOn;
            StartDate = task.StartDate.Equals(DateTime.MinValue) ? null : (ApiDateTime)task.StartDate;

            if (task.CreateBy != task.LastModifiedBy)
            {
                UpdatedBy = EmployeeWraper.Get(task.LastModifiedBy);
            }

            if (task.SubTasks != null)
            {
                Subtasks = task.SubTasks.Select(x => new SubtaskWrapper(x, task)).ToList();
            }

            CanEdit = ProjectSecurity.CanEdit(task);
            CanCreateSubtask = ProjectSecurity.CanCreateSubtask(task);
            CanCreateTimeSpend = ProjectSecurity.CanCreateTimeSpend(task);
            CanDelete = ProjectSecurity.CanDelete(task);

            if (task.Milestone != 0 && task.MilestoneDesc != null)
            {
                Milestone = new SimpleMilestoneWrapper(task.MilestoneDesc);
            }

            if (task.Links.Any())
            {
                Links = task.Links.Select(r=> new TaskLinkWrapper(r));
            }
        }
Exemplo n.º 10
0
 public SubtaskWrapper(Subtask subtask, Task task)
 {
     Id = subtask.ID;
     Title = subtask.Title;
     Status = (int)subtask.Status;
     if (subtask.Responsible != Guid.Empty)
     {
         Responsible = EmployeeWraper.Get(subtask.Responsible);
     }
     Created = (ApiDateTime)subtask.CreateOn;
     CreatedBy = EmployeeWraper.Get(subtask.CreateBy);
     Updated = (ApiDateTime)subtask.LastModifiedOn;
     if (subtask.CreateBy != subtask.LastModifiedBy)
     {
         UpdatedBy = EmployeeWraper.Get(subtask.LastModifiedBy);
     }
     CanEdit = ProjectSecurity.CanEdit(task, subtask);
 }
Exemplo n.º 11
0
        public Subtask ChangeStatus(Task task, Subtask subtask, TaskStatus newStatus)
        {
            if (subtask == null) throw new Exception("subtask.Task");
            if (task == null) throw new ArgumentNullException("task");
            if (task.Status == TaskStatus.Closed) throw new Exception("task can't be closed");

            if (subtask.Status == newStatus) return subtask;

            ProjectSecurity.DemandEdit(task, subtask);
           
            switch (newStatus)
            {
                case TaskStatus.Closed:
                    TimeLinePublisher.Subtask(subtask, task, EngineResource.ActionText_Closed, UserActivityConstants.ActivityActionType, UserActivityConstants.ImportantActivity);
                    break;

                case TaskStatus.Open:
                    TimeLinePublisher.Subtask(subtask, task, subtask.Status == TaskStatus.Closed ? EngineResource.ActionText_Reopen : EngineResource.ActionText_Accept, UserActivityConstants.ActivityActionType, UserActivityConstants.SmallActivity);
                    break;
            }

            subtask.Status = newStatus;
            subtask.LastModifiedBy = SecurityContext.CurrentAccount.ID;
            subtask.LastModifiedOn = TenantUtil.DateTimeNow();
            subtask.StatusChangedOn = TenantUtil.DateTimeNow();

            if (subtask.Responsible.Equals(Guid.Empty))
                subtask.Responsible = SecurityContext.CurrentAccount.ID;

            var objectID = task.UniqID + "_" + task.Project.ID;
            var senders = NotifySource.Instance.GetSubscriptionProvider().GetRecipients(NotifyConstants.Event_NewCommentForTask, objectID).ToList();
            senders.RemoveAll(r => r.ID == SecurityContext.CurrentAccount.ID.ToString());

            if (task.Status != TaskStatus.Closed && newStatus == TaskStatus.Closed && !_factory.DisableNotifications && senders.Count != 0)
                NotifyClient.Instance.SendAboutSubTaskClosing(senders, task, subtask);

            if (task.Status != TaskStatus.Closed && newStatus == TaskStatus.Open && !_factory.DisableNotifications && senders.Count != 0)
                NotifyClient.Instance.SendAboutSubTaskResumed(senders, task, subtask);

            return _subtaskDao.Save(subtask);
        }
Exemplo n.º 12
0
 public Task SaveOrUpdate(Task task, IEnumerable<int> attachedFileIds, bool notifyResponsible)
 {
     return SaveOrUpdate(task, attachedFileIds, notifyResponsible, false);
 }
Exemplo n.º 13
0
 private static bool CanRead(Task task)
 {
     return ProjectSecurity.CanRead(task);
 }
Exemplo n.º 14
0
        public Task ChangeStatus(Task task, TaskStatus newStatus)
        {
            ProjectSecurity.DemandEdit(task);

            if (task == null) throw new ArgumentNullException("task");
            if (task.Project == null) throw new Exception("Project can't be null.");
            if (task.Project.Status == ProjectStatus.Closed) throw new Exception(EngineResource.ProjectClosedError);

            if (task.Status == newStatus) return task;

            var senders = GetSubscribers(task);

            if (newStatus == TaskStatus.Closed && !factory.DisableNotifications && senders.Count != 0)
                NotifyClient.Instance.SendAboutTaskClosing(senders, task);

            if (newStatus == TaskStatus.Open && !factory.DisableNotifications && senders.Count != 0)
                NotifyClient.Instance.SendAboutTaskResumed(senders, task);

            task.Status = newStatus;
            task.LastModifiedBy = SecurityContext.CurrentAccount.ID;
            task.LastModifiedOn = TenantUtil.DateTimeNow();
            task.StatusChangedOn = TenantUtil.DateTimeNow();

            //subtask
            if (newStatus == TaskStatus.Closed)
            {
                if (!task.Responsibles.Any())
                    task.Responsibles.Add(SecurityContext.CurrentAccount.ID);

                subtaskDao.CloseAllSubtasks(task);
            }

            return taskDao.Save(task);
        }
Exemplo n.º 15
0
        private static void CheckLink(Task parentTask, Task dependentTask)
        {
            if (parentTask == null) throw new ArgumentNullException("parentTask");
            if (dependentTask == null) throw new ArgumentNullException("dependentTask");

            if (parentTask.ID == dependentTask.ID)
            {
                throw new Exception("it is impossible to create a link between one and the same task");
            }

/*            if (parentTask.Status == TaskStatus.Closed || dependentTask.Status == TaskStatus.Closed)
            {
                throw new Exception("Such link don't be created. Task closed.");
            }*/

            if (parentTask.Milestone != dependentTask.Milestone)
            {
                throw new Exception("Such link don't be created. Different Milestones");
            }

        }
Exemplo n.º 16
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);
        }
Exemplo n.º 17
0
        public void SendReminder(Task task)
        {
            //Don't send anything if notifications are disabled
            if (factory.DisableNotifications || task.Responsibles == null || !task.Responsibles.Any()) return;

            NotifyClient.Instance.SendReminderAboutTask(task.Responsibles.Distinct(), task);
        }
Exemplo n.º 18
0
        public void NotifyTask(Task task, IEnumerable<Guid> inviteToResponsibles, IEnumerable<Guid> removeResponsibles, bool isNew, bool notifyResponsible)
        {
            if (factory.DisableNotifications) return;

            var senders = GetSubscribers(task);
            senders = senders.FindAll(r => !inviteToResponsibles.Contains(new Guid(r.ID)) && !removeResponsibles.Contains(new Guid(r.ID)));

            if (senders.Any())
            {
                if (isNew)
                {
                    NotifyClient.Instance.SendAboutTaskCreating(senders, task);
                }
                else
                {
                    NotifyClient.Instance.SendAboutTaskEditing(senders, task);
                }
            }

            if (notifyResponsible)
                NotifyResponsible(task, inviteToResponsibles.ToList(), removeResponsibles.ToList());
        }
Exemplo n.º 19
0
        public Task SaveOrUpdate(Task task, IEnumerable<int> attachedFileIds, bool notifyResponsible, bool isImport)
        {
            if (task == null) throw new ArgumentNullException("task");
            if (task.Project == null) throw new Exception("task.Project");

            // check guests responsibles
            foreach (var responsible in task.Responsibles)
            {
                if (ProjectSecurity.IsVisitor(responsible))
                {
                    ProjectSecurity.CreateGuestSecurityException();
                }
            }

            var milestone = task.Milestone != 0 ? milestoneDao.GetById(task.Milestone) : null;
            var milestoneResponsible = milestone != null ? milestone.Responsible : Guid.Empty;

            var removeResponsibles = new List<Guid>();
            var inviteToResponsibles = new List<Guid>();

            task.LastModifiedBy = SecurityContext.CurrentAccount.ID;
            task.LastModifiedOn = TenantUtil.DateTimeNow();

            var isNew = task.ID == default(int); //Task is new

            if (isNew)
            {
                if (task.CreateBy == default(Guid)) task.CreateBy = SecurityContext.CurrentAccount.ID;
                if (task.CreateOn == default(DateTime)) task.CreateOn = TenantUtil.DateTimeNow();

                ProjectSecurity.DemandCreateTask(task.Project);

                task = taskDao.Save(task);

                inviteToResponsibles.AddRange(task.Responsibles.Distinct());
            }
            else
            {
                var oldTask = GetByID(new[] {task.ID}).FirstOrDefault();

                if (oldTask == null) throw new ArgumentNullException("task");

                var newResponsibles = task.Responsibles.Distinct().ToList();
                var oldResponsibles = oldTask.Responsibles.Distinct().ToList();

                removeResponsibles.AddRange(oldResponsibles.Where(p => !newResponsibles.Contains(p)));
                inviteToResponsibles.AddRange(newResponsibles.Where(participant => !oldResponsibles.Contains(participant)));

                //changed task
                ProjectSecurity.DemandEdit(oldTask);

                task = taskDao.Save(task);
            }

            if (attachedFileIds != null && attachedFileIds.Any())
            {
                foreach (var attachedFileId in attachedFileIds)
                {
                    AttachFile(task, attachedFileId, false);
                }
            }

            var senders = new HashSet<Guid>(task.Responsibles) { task.Project.Responsible, milestoneResponsible, task.CreateBy };
            senders.Remove(Guid.Empty);

            foreach (var subscriber in senders)
            {
                Subscribe(task, subscriber);
            }

            inviteToResponsibles.RemoveAll(r => r.Equals(Guid.Empty));
            removeResponsibles.RemoveAll(r => r.Equals(Guid.Empty));

            NotifyTask(task, inviteToResponsibles, removeResponsibles, isNew, notifyResponsible);

            return task;
        }
Exemplo n.º 20
0
 public void SendAboutResponsibleBySubTask(Subtask subtask, Task task)
 {
     var recipient = ToRecipient(subtask.Responsible);
     if (recipient != null)
     {
         client.SendNoticeToAsync(
             NotifyConstants.Event_ResponsibleForSubTask,
             task.NotifyId,
             new[] { recipient },
             GetDefaultSenders(recipient),
             null,
             new TagValue(NotifyConstants.Tag_ProjectID, task.Project.ID),
             new TagValue(NotifyConstants.Tag_ProjectTitle, task.Project.Title),
             new TagValue(NotifyConstants.Tag_EntityTitle, task.Title),
             new TagValue(NotifyConstants.Tag_SubEntityTitle, subtask.Title),
             new TagValue(NotifyConstants.Tag_EntityID, task.ID),
             new TagValue(NotifyConstants.Tag_AdditionalData, new Hashtable { { "TaskDescription", HttpUtility.HtmlEncode(task.Description) } }),
             ReplyToTagProvider.Comment("project.task", task.ID.ToString()));
     }
 }
Exemplo n.º 21
0
        public Task MoveToMilestone(Task task, int milestoneID)
        {
            ProjectSecurity.DemandEdit(task);

            if (task == null) throw new ArgumentNullException("task");
            if (task.Project == null) throw new Exception("Project can be null.");

            var newMilestone = milestoneID != 0;
            var milestone = milestoneDao.GetById(newMilestone ? milestoneID : task.Milestone);

            var senders = GetSubscribers(task);

            if (!factory.DisableNotifications && senders.Count != 0)
                NotifyClient.Instance.SendAboutTaskRemoved(senders, task, milestone, newMilestone);

            task.Milestone = milestoneID;
            task.LastModifiedBy = SecurityContext.CurrentAccount.ID;
            task.LastModifiedOn = TenantUtil.DateTimeNow();

            return taskDao.Save(task);
        }
Exemplo n.º 22
0
 public void SendAboutTaskClosing(List<IRecipient> recipients, Task task)
 {
     client.BeginSingleRecipientEvent("task closed");
     var interceptor = new InitiatorInterceptor(new DirectRecipient(SecurityContext.CurrentAccount.ID.ToString(), ""));
     client.AddInterceptor(interceptor);
     try
     {
         client.SendNoticeToAsync(
             NotifyConstants.Event_TaskClosed,
             task.NotifyId,
             recipients.ToArray(),
             GetDefaultSenders(recipients.FirstOrDefault()),
             null,
             new TagValue(NotifyConstants.Tag_ProjectID, task.Project.ID),
             new TagValue(NotifyConstants.Tag_ProjectTitle, task.Project.Title),
             new TagValue(NotifyConstants.Tag_EntityTitle, task.Title),
             new TagValue(NotifyConstants.Tag_EntityID, task.ID),
             new TagValue(NotifyConstants.Tag_AdditionalData, HttpUtility.HtmlEncode(task.Description)),
             ReplyToTagProvider.Comment("project.task", task.ID.ToString()));
     }
     finally
     {
         client.RemoveInterceptor(interceptor.Name);
         client.EndSingleRecipientEvent("task closed");
     }
 }
Exemplo n.º 23
0
        private void NotifyResponsible(Task task, List<Guid> inviteToResponsibles, List<Guid> removeResponsibles)
        {
            if (factory.DisableNotifications) return;

            if (inviteToResponsibles.Any())
                NotifyClient.Instance.SendAboutResponsibleByTask(inviteToResponsibles, task);

            if (removeResponsibles.Any())
                NotifyClient.Instance.SendAboutRemoveResponsibleByTask(removeResponsibles, task);
        }
Exemplo n.º 24
0
        public void SendAboutTaskCreating(List<IRecipient> recipients, Task task)
        {
            var resp = "Nobody";

            if (task.Responsibles.Count != 0)
            {
                var recip = task.Responsibles.Select(r => ToRecipient(r)).Where(r => r != null);
                resp = recip.Select(r => r.Name).Aggregate((a, b) => a + ", " + b);
            }

            client.SendNoticeToAsync(
                NotifyConstants.Event_TaskCreated,
                task.NotifyId,
                recipients.ToArray(),
                GetDefaultSenders(recipients.FirstOrDefault()),
                null,
                new TagValue(NotifyConstants.Tag_ProjectID, task.Project.ID),
                new TagValue(NotifyConstants.Tag_ProjectTitle, task.Project.Title),
                new TagValue(NotifyConstants.Tag_EntityTitle, task.Title),
                new TagValue(NotifyConstants.Tag_EntityID, task.ID),
                new TagValue(NotifyConstants.Tag_Responsible, resp),
                new TagValue(NotifyConstants.Tag_AdditionalData, new Hashtable { { "TaskDescription", HttpUtility.HtmlEncode(task.Description) } }),
                ReplyToTagProvider.Comment("project.task", task.ID.ToString())
                );

        }
Exemplo n.º 25
0
        public void Delete(Task task)
        {
            if (task == null) throw new ArgumentNullException("task");

            ProjectSecurity.DemandDelete(task);
            task.Links.ForEach(link => taskDao.RemoveLink(link));
            task.SubTasks.ForEach(subTask => subtaskDao.Delete(subTask.ID));
            taskDao.Delete(task.ID);

            var recipients = GetSubscribers(task);

            if (recipients.Count != 0)
            {
                NotifyClient.Instance.SendAboutTaskDeleting(recipients, task);
            }
        }
Exemplo n.º 26
0
        public void SendAboutSubTaskCreating(List<IRecipient> recipients, Task task, Subtask subtask)
        {
            client.SendNoticeToAsync(
                NotifyConstants.Event_SubTaskCreated,
                task.NotifyId,
                recipients.ToArray(),
                GetDefaultSenders(recipients.FirstOrDefault()),
                null,
                new TagValue(NotifyConstants.Tag_ProjectID, task.Project.ID),
                new TagValue(NotifyConstants.Tag_ProjectTitle, task.Project.Title),
                new TagValue(NotifyConstants.Tag_EntityTitle, task.Title),
                new TagValue(NotifyConstants.Tag_SubEntityTitle, subtask.Title),
                new TagValue(NotifyConstants.Tag_EntityID, task.ID),
                new TagValue(NotifyConstants.Tag_Responsible, !subtask.Responsible.Equals(Guid.Empty) ? ToRecipient(subtask.Responsible).Name : "Nobody"),
                ReplyToTagProvider.Comment("project.task", task.ID.ToString())
                );

        }
Exemplo n.º 27
0
        public void RemoveLink(Task dependentTask, Task parentTask)
        {
            ProjectSecurity.DemandEdit(dependentTask);

            taskDao.RemoveLink(new TaskLink {DependenceTaskId = dependentTask.ID, ParentTaskId = parentTask.ID});
        }
Exemplo n.º 28
0
 public void SendAboutTaskResumed(List<IRecipient> recipients, Task task)
 {
     client.SendNoticeToAsync(
         NotifyConstants.Event_TaskResumed,
         task.NotifyId,
         recipients.ToArray(),
         GetDefaultSenders(recipients.FirstOrDefault()),
         null,
         new TagValue(NotifyConstants.Tag_ProjectID, task.Project.ID),
         new TagValue(NotifyConstants.Tag_ProjectTitle, task.Project.Title),
         new TagValue(NotifyConstants.Tag_EntityTitle, task.Title),
         new TagValue(NotifyConstants.Tag_EntityID, task.ID),
         new TagValue(NotifyConstants.Tag_AdditionalData, HttpUtility.HtmlEncode(task.Description)),
         ReplyToTagProvider.Comment("project.task", task.ID.ToString()));
 }
Exemplo n.º 29
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;
            }
        }
Exemplo n.º 30
0
 public void SendAboutSubTaskResumed(List<IRecipient> recipients, Task task, Subtask subtask)
 {
     client.SendNoticeToAsync(
         NotifyConstants.Event_SubTaskResumed,
         task.NotifyId,
         recipients.ToArray(),
         GetDefaultSenders(recipients.FirstOrDefault()),
         null,
         new TagValue(NotifyConstants.Tag_ProjectID, task.Project.ID),
         new TagValue(NotifyConstants.Tag_ProjectTitle, task.Project.Title),
         new TagValue(NotifyConstants.Tag_EntityTitle, task.Title),
         new TagValue(NotifyConstants.Tag_SubEntityTitle, subtask.Title),
         new TagValue(NotifyConstants.Tag_EntityID, task.ID),
         ReplyToTagProvider.Comment("project.task", task.ID.ToString()));
 }