예제 #1
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);
            }
        }
예제 #2
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);
            }
        }
예제 #3
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())
                );
        }
예제 #4
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);
            }
        }
예제 #5
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");
            }
        }
예제 #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 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");
            }
        }
예제 #8
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));
            }
        }
예제 #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 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())
         );
 }
예제 #12
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)));
 }
예제 #13
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())
         );
 }
예제 #14
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()));
 }
예제 #15
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()));
            }
        }
예제 #16
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);
            }
        }
예제 #17
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);
            }
        }
예제 #18
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);
        }
예제 #19
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()));
            }
        }
예제 #20
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());
        }
예제 #21
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);
            }
        }
예제 #22
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()));
            }
        }
예제 #23
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);
            }
        }
예제 #24
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);
            }
        }
예제 #25
0
 private static TagValue GetReplyToTag(Bookmark bookmark, Comment comment)
 {
     return(ReplyToTagProvider.Comment("bookmark", bookmark.ID.ToString(CultureInfo.InvariantCulture), comment != null ? comment.ID.ToString() : null));
 }
예제 #26
0
 private static TagValue GetReplyToTag(Guid commentId, Post post)
 {
     return(ReplyToTagProvider.Comment("blog", post.ID.ToString(), commentId.ToString()));
 }
예제 #27
0
 private static TagValue GetReplyToTag(Feed feed, FeedComment feedComment)
 {
     return(ReplyToTagProvider.Comment("event", feed.Id.ToString(CultureInfo.InvariantCulture), feedComment != null ? feedComment.Id.ToString(CultureInfo.InvariantCulture) : null));
 }
예제 #28
0
        private void SendNotifyHandler(object sender, NotifyEventArgs e)
        {
            if (String.Equals(e.NotifyAction.ID, Constants.NewPostInTopic.ID, StringComparison.InvariantCultureIgnoreCase))
            {
                ForumNotifyClient.NotifyClient.SendNoticeAsync(Constants.NewPostInTopic, e.ObjectID, null,
                                                               new TagValue(Constants.TagDate, e.Date),
                                                               new TagValue(Constants.TagThreadTitle, e.ThreadTitle),
                                                               new TagValue(Constants.TagTopicTitle, e.TopicTitle),
                                                               new TagValue(Constants.TagTopicURL, e.TopicURL),
                                                               new TagValue(Constants.TagPostURL, e.PostURL),
                                                               new TagValue(Constants.TagThreadURL, e.ThreadURL),
                                                               new TagValue(Constants.TagPostText, e.PostText),
                                                               new TagValue(Constants.TagUserURL, e.UserURL),
                                                               new TagValue(Constants.TagUserName, e.Poster.ToString()),
                                                               ReplyToTagProvider.Comment("forum.topic", e.TopicId.ToString(), e.PostId.ToString())
                                                               );
            }


            else if (String.Equals(e.NotifyAction.ID, Constants.NewPostInThread.ID, StringComparison.InvariantCultureIgnoreCase))
            {
                ForumNotifyClient.NotifyClient.SendNoticeAsync(Constants.NewPostInThread, e.ObjectID, null,
                                                               new TagValue(Constants.TagDate, e.Date),
                                                               new TagValue(Constants.TagThreadTitle, e.ThreadTitle),
                                                               new TagValue(Constants.TagTopicTitle, e.TopicTitle),
                                                               new TagValue(Constants.TagTopicURL, e.TopicURL),
                                                               new TagValue(Constants.TagPostURL, e.PostURL),
                                                               new TagValue(Constants.TagThreadURL, e.ThreadURL),
                                                               new TagValue(Constants.TagPostText, e.PostText),
                                                               new TagValue(Constants.TagUserURL, e.UserURL),
                                                               new TagValue(Constants.TagUserName, e.Poster.ToString()));
            }

            else if (String.Equals(e.NotifyAction.ID, Constants.NewPostByTag.ID, StringComparison.InvariantCultureIgnoreCase))
            {
                ForumNotifyClient.NotifyClient.SendNoticeAsync(Constants.NewPostByTag, e.ObjectID, null,
                                                               new TagValue(Constants.TagDate, e.Date),
                                                               new TagValue(Constants.TagThreadTitle, e.ThreadTitle),
                                                               new TagValue(Constants.TagTopicTitle, e.TopicTitle),
                                                               new TagValue(Constants.TagTopicURL, e.TopicURL),
                                                               new TagValue(Constants.TagPostURL, e.PostURL),
                                                               new TagValue(Constants.TagThreadURL, e.ThreadURL),
                                                               new TagValue(Constants.TagPostText, e.PostText),
                                                               new TagValue(Constants.TagUserURL, e.UserURL),
                                                               new TagValue(Constants.TagUserName, e.Poster.ToString()));
            }

            else if (String.Equals(e.NotifyAction.ID, Constants.NewTopicInForum.ID, StringComparison.InvariantCultureIgnoreCase))
            {
                ForumNotifyClient.NotifyClient.SendNoticeAsync(Constants.NewTopicInForum, e.ObjectID, null,
                                                               new TagValue(Constants.TagDate, e.Date),
                                                               new TagValue(Constants.TagThreadTitle, e.ThreadTitle),
                                                               new TagValue(Constants.TagTopicTitle, e.TopicTitle),
                                                               new TagValue(Constants.TagTopicURL, e.TopicURL),
                                                               new TagValue(Constants.TagPostURL, e.PostURL),
                                                               new TagValue(Constants.TagThreadURL, e.ThreadURL),
                                                               new TagValue(Constants.TagPostText, e.PostText),
                                                               new TagValue(Constants.TagTagName, e.TagName),
                                                               new TagValue(Constants.TagTagURL, e.TagURL),
                                                               new TagValue(Constants.TagUserURL, e.UserURL),
                                                               new TagValue(Constants.TagUserName, e.Poster.ToString()),
                                                               ReplyToTagProvider.Comment("forum.topic", e.TopicId.ToString()));
            }
        }