예제 #1
0
        public void SendAboutSubTaskEditing(List <IRecipient> recipients, Task task, Subtask subtask)
        {
            var interceptor = new InitiatorInterceptor(new DirectRecipient(SecurityContext.CurrentAccount.ID.ToString(), ""));

            client.AddInterceptor(interceptor);

            try
            {
                client.SendNoticeToAsync(
                    NotifyConstants.Event_SubTaskEdited,
                    task.NotifyId,
                    recipients.ToArray(),
                    true,
                    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
                                     : PatternResource.subtaskWithoutResponsible),
                    ReplyToTagProvider.Comment("project.task", task.ID.ToString(CultureInfo.InvariantCulture)));
            }
            finally
            {
                client.RemoveInterceptor(interceptor.Name);
            }
        }
예제 #2
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");
            }
        }
예제 #3
0
        public void SendAboutResponsibleByMilestone(Milestone milestone)
        {
            var recipient = ToRecipient(milestone.Responsible);

            if (recipient != null)
            {
                client.SendNoticeToAsync(
                    NotifyConstants.Event_ResponsibleForMilestone,
                    milestone.NotifyId,
                    new[] { recipient },
                    true,
                    new TagValue(NotifyConstants.Tag_ProjectID, milestone.Project.ID),
                    new TagValue(NotifyConstants.Tag_ProjectTitle, milestone.Project.Title),
                    new TagValue(NotifyConstants.Tag_EntityTitle, milestone.Title),
                    new TagValue(NotifyConstants.Tag_EntityID, milestone.ID),
                    new TagValue(NotifyConstants.Tag_AdditionalData, new Hashtable {
                    { "MilestoneDescription", HttpUtility.HtmlEncode(milestone.Description) }
                }),
                    ReplyToTagProvider.Comment("project.milestone", milestone.ID.ToString(CultureInfo.InvariantCulture)),
                    new AdditionalSenderTag("push.sender"),
                    new TagValue(PushConstants.PushItemTagName, new PushItem(PushItemType.Milestone, milestone.ID.ToString(), milestone.Title)),
                    new TagValue(PushConstants.PushParentItemTagName, new PushItem(PushItemType.Project, milestone.Project.ID.ToString(), milestone.Project.Title)),
                    new TagValue(PushConstants.PushModuleTagName, PushModule.Projects),
                    new TagValue(PushConstants.PushActionTagName, PushAction.Assigned));
            }
        }
예제 #4
0
        public void SendAboutTaskClosing(IEnumerable <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(),
                    true,
                    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(CultureInfo.InvariantCulture)),
                    new AdditionalSenderTag("push.sender"),
                    new TagValue(PushConstants.PushItemTagName, new PushItem(PushItemType.Task, task.ID.ToString(), task.Title)),
                    new TagValue(PushConstants.PushParentItemTagName, new PushItem(PushItemType.Project, task.Project.ID.ToString(), task.Project.Title)),
                    new TagValue(PushConstants.PushModuleTagName, PushModule.Projects),
                    new TagValue(PushConstants.PushActionTagName, PushAction.Closed));
            }
            finally
            {
                client.RemoveInterceptor(interceptor.Name);
                client.EndSingleRecipientEvent("task closed");
            }
        }
예제 #5
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())
                );
        }
예제 #6
0
        private ITagValue[] GetCategoryNotifyTags(string objectId, string pageName)
        {
            var page = GetPage(pageName);

            if (page == null)
            {
                return(null);
            }

            var user        = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
            var defPageHref = VirtualPathUtility.ToAbsolute(WikiManager.ViewVirtualPath);

            var tags = new List <ITagValue>
            {
                new TagValue(Constants.TagPageName, page.PageName),
                new TagValue(Constants.TagURL, CommonLinkUtility.GetFullAbsolutePath(ActionHelper.GetViewPagePath(defPageHref, page.PageName))),
                new TagValue(Constants.TagUserName, user.DisplayUserName()),
                new TagValue(Constants.TagUserURL, CommonLinkUtility.GetFullAbsolutePath(CommonLinkUtility.GetUserProfile(user.ID))),
                new TagValue(Constants.TagDate, TenantUtil.DateTimeNow()),
                new TagValue(Constants.TagPostPreview, HtmlUtil.GetText(EditPage.ConvertWikiToHtml(page.PageName, page.Body, defPageHref, WikiSection.Section.ImageHangler.UrlFormat, CoreContext.TenantManager.GetCurrentTenant().TenantId), 120)),
                new TagValue(Constants.TagCatName, objectId),
                ReplyToTagProvider.Comment("wiki", pageName)
            };

            return(tags.ToArray());
        }
예제 #7
0
        public void SendAboutRemoveResponsibleByTask(IEnumerable <Guid> recipients, Task task)
        {
            var interceptor = new InitiatorInterceptor(new DirectRecipient(SecurityContext.CurrentAccount.ID.ToString(), ""));

            client.AddInterceptor(interceptor);
            try
            {
                client.SendNoticeToAsync(
                    NotifyConstants.Event_RemoveResponsibleForTask,
                    task.NotifyId,
                    recipients.Select(ToRecipient).Where(r => r != null).ToArray(),
                    true,
                    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, new Hashtable {
                    { "TaskDescription", HttpUtility.HtmlEncode(task.Description) }
                }),
                    ReplyToTagProvider.Comment("project.task", task.ID.ToString(CultureInfo.InvariantCulture)));
            }
            finally
            {
                client.RemoveInterceptor(interceptor.Name);
            }
        }
예제 #8
0
        public void SendAboutSubTaskResumed(List <IRecipient> recipients, Task task, Subtask subtask)
        {
            var interceptor = new InitiatorInterceptor(new DirectRecipient(SecurityContext.CurrentAccount.ID.ToString(), ""));

            client.AddInterceptor(interceptor);

            try
            {
                client.SendNoticeToAsync(
                    NotifyConstants.Event_SubTaskResumed,
                    task.NotifyId,
                    recipients.ToArray(),
                    true,
                    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(CultureInfo.InvariantCulture)),
                    new AdditionalSenderTag("push.sender"),
                    new TagValue(PushConstants.PushItemTagName, new PushItem(PushItemType.Subtask, subtask.ID.ToString(), subtask.Title)),
                    new TagValue(PushConstants.PushParentItemTagName, new PushItem(PushItemType.Task, task.ID.ToString(), task.Title)),
                    new TagValue(PushConstants.PushModuleTagName, PushModule.Projects),
                    new TagValue(PushConstants.PushActionTagName, PushAction.Resumed));
            }
            finally
            {
                client.RemoveInterceptor(interceptor.Name);
            }
        }
예제 #9
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()));
 }
예제 #10
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()));
 }
예제 #11
0
        public void SendRemovingFromProjectTeam(Guid userId, Project project)
        {
            var recipient = ToRecipient(userId);

            if (recipient != null)
            {
                client.SendNoticeToAsync(
                    NotifyConstants.Event_RemoveFromProject,
                    project.UniqID,
                    new[] { recipient },
                    true,
                    new TagValue(NotifyConstants.Tag_ProjectID, project.ID),
                    new TagValue(NotifyConstants.Tag_ProjectTitle, project.Title),
                    ReplyToTagProvider.Message(project.ID));
            }
        }
예제 #12
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())
         );
 }
예제 #13
0
 public void SendReminderAboutTask(IEnumerable <Guid> recipients, Task task)
 {
     client.SendNoticeToAsync(
         NotifyConstants.Event_ReminderAboutTask,
         task.NotifyId,
         recipients.Select(ToRecipient).Where(r => r != null).ToArray(),
         true,
         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, new Hashtable {
         { "TaskDescription", HttpUtility.HtmlEncode(task.Description) }
     }),
         new TagValue(NotifyConstants.Tag_Priority, 1),
         ReplyToTagProvider.Comment("project.task", task.ID.ToString(CultureInfo.InvariantCulture)));
 }
예제 #14
0
        public void SendInvaiteToProjectTeam(Guid userId, Project project)
        {
            var recipient = ToRecipient(userId);

            if (recipient != null)
            {
                client.SendNoticeToAsync(
                    NotifyConstants.Event_InviteToProject,
                    project.UniqID,
                    new[] { recipient },
                    GetDefaultSenders(recipient),
                    null,
                    new TagValue(NotifyConstants.Tag_ProjectID, project.ID),
                    new TagValue(NotifyConstants.Tag_ProjectTitle, project.Title),
                    ReplyToTagProvider.Message(project.ID));
            }
        }
예제 #15
0
 public void SendAboutMilestoneCreating(List <IRecipient> recipients, Milestone milestone)
 {
     client.SendNoticeToAsync(
         NotifyConstants.Event_MilestoneCreated,
         milestone.NotifyId,
         recipients.ToArray(),
         GetDefaultSenders(recipients.FirstOrDefault()),
         null,
         new TagValue(NotifyConstants.Tag_ProjectID, milestone.Project.ID),
         new TagValue(NotifyConstants.Tag_ProjectTitle, milestone.Project.Title),
         new TagValue(NotifyConstants.Tag_EntityTitle, milestone.Title),
         new TagValue(NotifyConstants.Tag_EntityID, milestone.ID),
         new TagValue(NotifyConstants.Tag_AdditionalData, new Hashtable {
         { "MilestoneDescription", HttpUtility.HtmlEncode(milestone.Description) }
     }),
         ReplyToTagProvider.Comment("project.milestone", milestone.ID.ToString())
         );
 }
예제 #16
0
        public void SendAboutResponsibleByProject(Guid responsible, Project project)
        {
            var recipient = ToRecipient(responsible);

            if (recipient != null)
            {
                client.SendNoticeToAsync(
                    NotifyConstants.Event_ResponsibleForProject,
                    project.UniqID,
                    new[] { recipient },
                    GetDefaultSenders(recipient),
                    null,
                    new TagValue(NotifyConstants.Tag_ProjectID, project.ID),
                    new TagValue(NotifyConstants.Tag_ProjectTitle, project.Title),
                    new TagValue(NotifyConstants.Tag_AdditionalData, project.Description),
                    ReplyToTagProvider.Message(project.ID));
            }
        }
예제 #17
0
 public void SendAboutMessageAction(List <IRecipient> recipients, Message message, bool isNew, Hashtable fileListInfoHashtable)
 {
     client.SendNoticeToAsync(
         isNew ? NotifyConstants.Event_MessageCreated : NotifyConstants.Event_MessageEdited,
         message.NotifyId,
         recipients.ToArray(),
         GetDefaultSenders(recipients.FirstOrDefault()),
         null,
         new TagValue(NotifyConstants.Tag_ProjectID, message.Project.ID),
         new TagValue(NotifyConstants.Tag_ProjectTitle, message.Project.Title),
         new TagValue(NotifyConstants.Tag_EntityTitle, message.Title),
         new TagValue(NotifyConstants.Tag_EntityID, message.ID),
         new TagValue(NotifyConstants.Tag_EventType, isNew ? "NewMessage" : "EditMessage"),
         new TagValue(NotifyConstants.Tag_AdditionalData, new Hashtable {
         { "MessagePreview", message.Content }, { "Files", fileListInfoHashtable }
     }),
         ReplyToTagProvider.Comment("project.message", message.ID.ToString()));
 }
예제 #18
0
        public void SendMilestoneDeadline(Guid userID, Milestone milestone)
        {
            var recipient = ToRecipient(userID);

            if (recipient != null)
            {
                client.SendNoticeToAsync(
                    NotifyConstants.Event_MilestoneDeadline,
                    milestone.NotifyId,
                    new[] { recipient },
                    GetDefaultSenders(recipient),
                    null,
                    new TagValue(NotifyConstants.Tag_ProjectID, milestone.Project.ID),
                    new TagValue(NotifyConstants.Tag_ProjectTitle, milestone.Project.Title),
                    new TagValue(NotifyConstants.Tag_EntityTitle, milestone.Title),
                    new TagValue(NotifyConstants.Tag_EntityID, milestone.ID),
                    ReplyToTagProvider.Comment("project.milestone", milestone.ID.ToString()));
            }
        }
예제 #19
0
        public void SendInvaiteToProjectTeam(Guid userId, Project project)
        {
            var recipient = ToRecipient(userId);

            if (recipient != null)
            {
                client.SendNoticeToAsync(
                    NotifyConstants.Event_InviteToProject,
                    project.UniqID,
                    new[] { recipient },
                    true,
                    new TagValue(NotifyConstants.Tag_ProjectID, project.ID),
                    new TagValue(NotifyConstants.Tag_ProjectTitle, project.Title),
                    ReplyToTagProvider.Message(project.ID),
                    new AdditionalSenderTag("push.sender"),
                    new TagValue(PushConstants.PushItemTagName, new PushItem(PushItemType.Project, project.ID.ToString(), project.Title)),
                    new TagValue(PushConstants.PushModuleTagName, PushModule.Projects),
                    new TagValue(PushConstants.PushActionTagName, PushAction.InvitedTo));
            }
        }
예제 #20
0
        public void SendAboutMessageAction(List <IRecipient> recipients, Message message, bool isNew, Hashtable fileListInfoHashtable)
        {
            var tags = new List <ITagValue>
            {
                new TagValue(NotifyConstants.Tag_ProjectID, message.Project.ID),
                new TagValue(NotifyConstants.Tag_ProjectTitle, message.Project.Title),
                new TagValue(NotifyConstants.Tag_EntityTitle, message.Title),
                new TagValue(NotifyConstants.Tag_EntityID, message.ID),
                new TagValue(NotifyConstants.Tag_EventType, isNew ? NotifyConstants.Event_MessageCreated.ID : NotifyConstants.Event_MessageEdited.ID),
                new TagValue(NotifyConstants.Tag_AdditionalData, new Hashtable {
                    { "MessagePreview", message.Content }, { "Files", fileListInfoHashtable }
                }),
                ReplyToTagProvider.Comment("project.message", message.ID.ToString(CultureInfo.InvariantCulture))
            };

            if (isNew) //don't send push about edited message!
            {
                tags.Add(new AdditionalSenderTag("push.sender"));
                tags.Add(new TagValue(PushConstants.PushItemTagName, new PushItem(PushItemType.Message, message.ID.ToString(), message.Title)));
                tags.Add(new TagValue(PushConstants.PushParentItemTagName, new PushItem(PushItemType.Project, message.Project.ID.ToString(), message.Project.Title)));
                tags.Add(new TagValue(PushConstants.PushModuleTagName, PushModule.Projects));
                tags.Add(new TagValue(PushConstants.PushActionTagName, PushAction.Created));
            }

            var interceptor = new InitiatorInterceptor(new DirectRecipient(SecurityContext.CurrentAccount.ID.ToString(), ""));

            try
            {
                client.AddInterceptor(interceptor);
                client.SendNoticeToAsync(
                    isNew ? NotifyConstants.Event_MessageCreated : NotifyConstants.Event_MessageEdited,
                    message.NotifyId,
                    recipients.ToArray(),
                    true,
                    tags.ToArray());
            }
            finally
            {
                client.RemoveInterceptor(interceptor.Name);
            }
        }
예제 #21
0
        public void SendAboutResponsibleByProject(Guid responsible, Project project)
        {
            var recipient = ToRecipient(responsible);

            if (recipient != null)
            {
                client.SendNoticeToAsync(
                    NotifyConstants.Event_ResponsibleForProject,
                    project.UniqID,
                    new[] { recipient },
                    true,
                    new TagValue(NotifyConstants.Tag_ProjectID, project.ID),
                    new TagValue(NotifyConstants.Tag_ProjectTitle, project.Title),
                    new TagValue(NotifyConstants.Tag_AdditionalData, project.Description),
                    ReplyToTagProvider.Message(project.ID),
                    new AdditionalSenderTag("push.sender"),
                    new TagValue(PushConstants.PushItemTagName, new PushItem(PushItemType.Project, project.ID.ToString(), project.Title)),
                    new TagValue(PushConstants.PushModuleTagName, PushModule.Projects),
                    new TagValue(PushConstants.PushActionTagName, PushAction.Assigned));
            }
        }
예제 #22
0
        public void SendAboutTaskCreating(List <IRecipient> recipients, Task task)
        {
            var resp = "Nobody";

            if (task.Responsibles.Count != 0)
            {
                var recip = task.Responsibles.Select(ToRecipient).Where(r => r != null);
                resp = recip.Select(r => r.Name).Aggregate(string.Empty, (a, b) => a + ", " + b);
            }
            var interceptor = new InitiatorInterceptor(new DirectRecipient(SecurityContext.CurrentAccount.ID.ToString(), ""));

            client.AddInterceptor(interceptor);

            try
            {
                client.SendNoticeToAsync(
                    NotifyConstants.Event_TaskCreated,
                    task.NotifyId,
                    recipients.ToArray(),
                    true,
                    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(CultureInfo.InvariantCulture)),
                    new AdditionalSenderTag("push.sender"),
                    new TagValue(PushConstants.PushItemTagName, new PushItem(PushItemType.Task, task.ID.ToString(), task.Title)),
                    new TagValue(PushConstants.PushParentItemTagName, new PushItem(PushItemType.Project, task.Project.ID.ToString(), task.Project.Title)),
                    new TagValue(PushConstants.PushModuleTagName, PushModule.Projects),
                    new TagValue(PushConstants.PushActionTagName, PushAction.Created));
            }
            finally
            {
                client.RemoveInterceptor(interceptor.Name);
            }
        }
예제 #23
0
        private static TagValue GetReplyToEntityTag(ProjectEntity entity, Comment comment)
        {
            string type = string.Empty;

            if (entity is Task)
            {
                type = "project.task";
            }
            if (entity is Message)
            {
                type = "project.message";
            }
            if (entity is Milestone)
            {
                type = "project.milestone";
            }
            if (!string.IsNullOrEmpty(type))
            {
                return(ReplyToTagProvider.Comment(type, entity.ID.ToString(), comment != null ? comment.ID.ToString() : null));
            }
            return(null);
        }
예제 #24
0
        public void SendAboutResponsibleByMilestone(Milestone milestone)
        {
            var recipient = ToRecipient(milestone.Responsible);

            if (recipient != null)
            {
                client.SendNoticeToAsync(
                    NotifyConstants.Event_ResponsibleForMilestone,
                    milestone.NotifyId,
                    new[] { recipient },
                    GetDefaultSenders(recipient),
                    null,
                    new TagValue(NotifyConstants.Tag_ProjectID, milestone.Project.ID),
                    new TagValue(NotifyConstants.Tag_ProjectTitle, milestone.Project.Title),
                    new TagValue(NotifyConstants.Tag_EntityTitle, milestone.Title),
                    new TagValue(NotifyConstants.Tag_EntityID, milestone.ID),
                    new TagValue(NotifyConstants.Tag_AdditionalData, new Hashtable {
                    { "MilestoneDescription", HttpUtility.HtmlEncode(milestone.Description) }
                }),
                    ReplyToTagProvider.Comment("project.milestone", milestone.ID.ToString()));
            }
        }
예제 #25
0
        private ITagValue[] GetNotifyTags(string pageName, string patternType, Comment comment)
        {
            var page = GetPage(pageName);

            if (page == null)
            {
                return(null);
            }

            var user    = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
            var defPage = VirtualPathUtility.ToAbsolute(WikiManager.ViewVirtualPath);

            var tags = new List <ITagValue>
            {
                new TagValue(Constants.TagPageName, String.IsNullOrEmpty(page.PageName) ? WikiResource.MainWikiCaption : page.PageName),
                new TagValue(Constants.TagURL, CommonLinkUtility.GetFullAbsolutePath(ActionHelper.GetViewPagePath(defPage, page.PageName))),
                new TagValue(Constants.TagUserName, user.DisplayUserName()),
                new TagValue(Constants.TagUserURL, CommonLinkUtility.GetFullAbsolutePath(CommonLinkUtility.GetUserProfile(user.ID))),
                new TagValue(Constants.TagDate, TenantUtil.DateTimeNow()),
                new TagValue(Constants.TagPostPreview, HtmlUtil.GetText(EditPage.ConvertWikiToHtml(page.PageName, page.Body, defPage, WikiSection.Section.ImageHangler.UrlFormat, CoreContext.TenantManager.GetCurrentTenant().TenantId), 120))
            };

            if (comment != null && !string.IsNullOrEmpty(pageName))
            {
                ReplyToTagProvider.Comment("wiki", pageName, comment.Id.ToString());
            }

            if (!string.IsNullOrEmpty(patternType))
            {
                tags.Add(new TagValue(Constants.TagChangePageType, patternType));
            }
            if (comment != null)
            {
                tags.Add(new TagValue(Constants.TagCommentBody, comment.Body));
            }

            return(tags.ToArray());
        }
예제 #26
0
        public void SendAboutTaskRemoved(List <IRecipient> recipients, Task task, Milestone milestone, bool newMilestone)
        {
            var interceptor = new InitiatorInterceptor(new DirectRecipient(SecurityContext.CurrentAccount.ID.ToString(), ""));

            try
            {
                client.SendNoticeToAsync(newMilestone ? NotifyConstants.Event_TaskMovedToMilestone : NotifyConstants.Event_TaskMovedFromMilestone,
                                         task.NotifyId,
                                         recipients.ToArray(),
                                         true,
                                         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_SubEntityTitle, milestone.Title),
                                         new TagValue(NotifyConstants.Tag_AdditionalData, HttpUtility.HtmlEncode(task.Description)),
                                         ReplyToTagProvider.Comment("project.task", task.ID.ToString(CultureInfo.InvariantCulture)));
            }
            finally
            {
                client.RemoveInterceptor(interceptor.Name);
            }
        }
예제 #27
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()));
            }
        }
예제 #28
0
        public void SendAboutResponsibleBySubTask(Subtask subtask, Task task)
        {
            var interceptor = new InitiatorInterceptor(new DirectRecipient(SecurityContext.CurrentAccount.ID.ToString(), ""));

            client.AddInterceptor(interceptor);
            try
            {
                var recipient = ToRecipient(subtask.Responsible);
                if (recipient != null)
                {
                    client.SendNoticeToAsync(
                        NotifyConstants.Event_ResponsibleForSubTask,
                        task.NotifyId,
                        new[] { recipient },
                        true,
                        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(CultureInfo.InvariantCulture)),
                        new AdditionalSenderTag("push.sender"),
                        new TagValue(PushConstants.PushItemTagName, new PushItem(PushItemType.Subtask, subtask.ID.ToString(), subtask.Title)),
                        new TagValue(PushConstants.PushParentItemTagName, new PushItem(PushItemType.Task, task.ID.ToString(), task.Title)),
                        new TagValue(PushConstants.PushModuleTagName, PushModule.Projects),
                        new TagValue(PushConstants.PushActionTagName, PushAction.Assigned));
                }
            }
            finally
            {
                client.RemoveInterceptor(interceptor.Name);
            }
        }
예제 #29
0
        public void SendAboutTaskEditing(List <IRecipient> recipients, Task task)
        {
            var interceptor = new InitiatorInterceptor(new DirectRecipient(SecurityContext.CurrentAccount.ID.ToString(), ""));

            client.AddInterceptor(interceptor);

            try
            {
                client.SendNoticeToAsync(
                    NotifyConstants.Event_TaskEdited,
                    task.NotifyId,
                    recipients.ToArray(),
                    true,
                    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),
                    ReplyToTagProvider.Comment("project.task", task.ID.ToString(CultureInfo.InvariantCulture)));
            }
            finally
            {
                client.RemoveInterceptor(interceptor.Name);
            }
        }
예제 #30
0
 private static TagValue GetReplyToTag(Bookmark bookmark, Comment comment)
 {
     return(ReplyToTagProvider.Comment("bookmark", bookmark.ID.ToString(CultureInfo.InvariantCulture), comment != null ? comment.ID.ToString() : null));
 }