Example #1
0
        public static void NotifyAboutSharingEvent(ASC.Api.Calendar.BusinessObjects.Event calendarEvent, ASC.Api.Calendar.BusinessObjects.Event oldCalendarEvent)
        {
            var initatorInterceptor = new InitiatorInterceptor(new DirectRecipient(SecurityContext.CurrentAccount.ID.ToString(), SecurityContext.CurrentAccount.Name));

            try
            {
                var usr      = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
                var userLink = PerformUrl(CommonLinkUtility.GetUserProfile(usr.ID.ToString(), false));

                foreach (var item in calendarEvent.SharingOptions.PublicItems)
                {
                    if (oldCalendarEvent != null && oldCalendarEvent.SharingOptions.PublicItems.Exists(i => i.Id.Equals(item.Id)))
                    {
                        continue;
                    }

                    var r = CalendarNotifySource.Instance.GetRecipientsProvider().GetRecipient(item.Id.ToString());
                    if (r != null)
                    {
                        _notifyClient.SendNoticeAsync(CalendarNotifySource.CalendarSharing, null, r, true,
                                                      new TagValue("SharingType", "event"),
                                                      new TagValue("UserName", usr.DisplayUserName()),
                                                      new TagValue("UserLink", userLink),
                                                      new TagValue("EventName", calendarEvent.Name));
                    }
                }
                _notifyClient.EndSingleRecipientEvent(_syncName);
            }
            finally
            {
                _notifyClient.RemoveInterceptor(initatorInterceptor.Name);
            }
        }
Example #2
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);
            }
        }
Example #3
0
        private void NotifyNewComment(FeedComment comment, Feed feed)
        {
            var feedType = feed.FeedType == FeedType.Poll ? "poll" : "feed";

            var initatorInterceptor = new InitiatorInterceptor(new DirectRecipient(comment.Creator, ""));

            try
            {
                NewsNotifyClient.NotifyClient.AddInterceptor(initatorInterceptor);
                NewsNotifyClient.NotifyClient.SendNoticeAsync(
                    NewsConst.NewComment, feed.Id.ToString(CultureInfo.InvariantCulture),
                    null,
                    new TagValue(NewsConst.TagFEED_TYPE, feedType),
                    //new TagValue(NewsConst.TagAnswers, feed.Variants.ConvertAll<string>(v => v.Name)),
                    new TagValue(NewsConst.TagCaption, feed.Caption),
                    new TagValue("CommentBody", HtmlUtility.GetFull(comment.Comment)),
                    new TagValue(NewsConst.TagDate, comment.Date.ToShortString()),
                    new TagValue(NewsConst.TagURL, CommonLinkUtility.GetFullAbsolutePath("~/products/community/modules/news/?docid=" + feed.Id)),
                    new TagValue("CommentURL", CommonLinkUtility.GetFullAbsolutePath("~/products/community/modules/news/?docid=" + feed.Id + "#" + comment.Id.ToString(CultureInfo.InvariantCulture))),
                    new TagValue(NewsConst.TagUserName, DisplayUserSettings.GetFullUserName(SecurityContext.CurrentAccount.ID)),
                    new TagValue(NewsConst.TagUserUrl, CommonLinkUtility.GetFullAbsolutePath(CommonLinkUtility.GetUserProfile(SecurityContext.CurrentAccount.ID))),
                    GetReplyToTag(feed, comment)
                    );
            }
            finally
            {
                NewsNotifyClient.NotifyClient.RemoveInterceptor(initatorInterceptor.Name);
            }
        }
        public void UserPasswordChanged(Guid userID, string password)
        {
            var author = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
            var user   = CoreContext.UserManager.GetUsers(userID);

            ISendInterceptor initInterceptor = null;

            if (!ASC.Core.Users.Constants.LostUser.Equals(author))
            {
                initInterceptor = new InitiatorInterceptor(new[] { ToRecipient(author.ID) });
                client.AddInterceptor(initInterceptor);
            }

            client.SendNoticeToAsync(
                Constants.ActionPasswordChanged,
                null,
                new[] { ToRecipient(user.ID) },
                new[] { EMailSenderName },
                null,
                new TagValue(Constants.TagUserName, user.DisplayUserName()),
                new TagValue(Constants.TagUserEmail, user.Email),
                new TagValue(Constants.TagMyStaffLink, GetMyStaffLink()),
                new TagValue(Constants.TagPassword, password));

            if (initInterceptor != null)
            {
                client.RemoveInterceptor(initInterceptor.Name);
            }
        }
        /// <summary>
        /// Notify user about his profile updated
        /// </summary>
        public void UserInfoUpdated(UserInfo prevUserInfo, UserInfo newUserInfo, string password)
        {
            UserInfo Author = null;

            if (CoreContext.UserManager.UserExists(SecurityContext.CurrentAccount.ID))
            {
                Author = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
            }

            ISendInterceptor initInterceptor = null;

            if (Author != null)
            {
                initInterceptor = new InitiatorInterceptor(new[] { UserInfoAsRecipient(Author) });
                client.AddInterceptor(initInterceptor);
            }

            client.SendNoticeToAsync(
                Constants.ActionYourProfileUpdated,
                null,
                new[] { UserInfoAsRecipient(newUserInfo) },
                AllSenderNames,
                null,
                new TagValue(Constants.TagProfileChanges, GetUserInfoChanges(prevUserInfo, newUserInfo)),
                new TagValue(Constants.TagUserName, newUserInfo.DisplayUserName()),
                new TagValue(Constants.TagMyStaffLink, GetMyStaffLink()),
                new TagValue(Constants.TagPassword, password),
                new TagValue(Constants.TagIsPasswordChange, password != null)
                );

            if (initInterceptor != null)
            {
                client.RemoveInterceptor(initInterceptor.Name);
            }
        }
Example #6
0
        public void SendAboutMilestoneResumed(IEnumerable <Guid> recipients, Milestone milestone)
        {
            var interceptor = new InitiatorInterceptor(new DirectRecipient(SecurityContext.CurrentAccount.ID.ToString(), ""));

            client.AddInterceptor(interceptor);

            try
            {
                client.SendNoticeToAsync(
                    NotifyConstants.Event_MilestoneResumed,
                    milestone.NotifyId,
                    recipients.Select(ToRecipient).Where(r => r != null).ToArray(),
                    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, HttpUtility.HtmlEncode(milestone.Description)),
                    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.Resumed));
            }
            finally
            {
                client.RemoveInterceptor(interceptor.Name);
            }
        }
Example #7
0
        private static void NotifyFeed(Feed feed, bool isEdit, FeedType type)
        {
            var initatorInterceptor = new InitiatorInterceptor(new DirectRecipient(feed.Creator, ""));

            try
            {
                NewsNotifyClient.NotifyClient.AddInterceptor(initatorInterceptor);

                if (type == FeedType.Poll && feed is FeedPoll)
                {
                    NewsNotifyClient.NotifyClient.SendNoticeAsync(
                        NewsConst.NewFeed, null, null,
                        new TagValue(NewsConst.TagFEED_TYPE, "poll"),
                        new TagValue(NewsConst.TagAnswers, ((FeedPoll)feed).Variants.ConvertAll(v => v.Name)),
                        new TagValue(NewsConst.TagCaption, feed.Caption),
                        new TagValue(NewsConst.TagText, HtmlUtility.GetFull(feed.Text)),
                        new TagValue(NewsConst.TagDate, feed.Date.ToShortString()),
                        new TagValue(NewsConst.TagURL,
                                     CommonLinkUtility.GetFullAbsolutePath(
                                         "~/Products/Community/Modules/News/Default.aspx?docid=" + feed.Id)),
                        new TagValue(NewsConst.TagUserName,
                                     DisplayUserSettings.GetFullUserName(SecurityContext.CurrentAccount.ID)),
                        new TagValue(NewsConst.TagUserUrl,
                                     CommonLinkUtility.GetFullAbsolutePath(
                                         CommonLinkUtility.GetUserProfile(SecurityContext.CurrentAccount.ID)))
                        );
                }
                else
                {
                    NewsNotifyClient.NotifyClient.SendNoticeAsync(
                        NewsConst.NewFeed, null, null,
                        new TagValue(NewsConst.TagFEED_TYPE, "feed"),
                        new TagValue(NewsConst.TagCaption, feed.Caption),
                        new TagValue(NewsConst.TagText,
                                     HtmlUtility.GetFull(feed.Text)),
                        new TagValue(NewsConst.TagDate, feed.Date.ToShortString()),
                        new TagValue(NewsConst.TagURL,
                                     CommonLinkUtility.GetFullAbsolutePath(
                                         "~/Products/Community/Modules/News/Default.aspx?docid=" + feed.Id)),
                        new TagValue(NewsConst.TagUserName,
                                     DisplayUserSettings.GetFullUserName(SecurityContext.CurrentAccount.ID)),
                        new TagValue(NewsConst.TagUserUrl,
                                     CommonLinkUtility.GetFullAbsolutePath(
                                         CommonLinkUtility.GetUserProfile(SecurityContext.CurrentAccount.ID)))
                        );
                }

                // subscribe to new comments
                var subsciber = NewsNotifySource.Instance.GetSubscriptionProvider();
                var me        = (IDirectRecipient)NewsNotifySource.Instance.GetRecipientsProvider().GetRecipient(SecurityContext.CurrentAccount.ID.ToString());
                if (me != null && !subsciber.IsUnsubscribe(me, NewsConst.NewComment, feed.Id.ToString(CultureInfo.InvariantCulture)))
                {
                    subsciber.Subscribe(NewsConst.NewComment, feed.Id.ToString(CultureInfo.InvariantCulture), me);
                }
            }
            finally
            {
                NewsNotifyClient.NotifyClient.RemoveInterceptor(initatorInterceptor.Name);
            }
        }
Example #8
0
        public void SendAboutAddRelationshipEventAdd(RelationshipEvent entity,
                                                     Hashtable fileListInfoHashtable, params Guid[] userID)
        {
            if (userID.Length == 0)
            {
                return;
            }

            NameValueCollection baseEntityData;

            if (entity.EntityID != 0)
            {
                baseEntityData = ExtractBaseDataFrom(entity.EntityType, entity.EntityID);
            }
            else
            {
                var contact = Global.DaoFactory.GetContactDao().GetByID(entity.ContactID);

                baseEntityData                      = new NameValueCollection();
                baseEntityData["title"]             = contact.GetTitle();
                baseEntityData["id"]                = contact.ID.ToString();
                baseEntityData["entityRelativeURL"] = "default.aspx?id=" + contact.ID;

                if (contact is Person)
                {
                    baseEntityData["entityRelativeURL"] += "&type=people";
                }

                baseEntityData["entityRelativeURL"] = String.Concat(PathProvider.BaseAbsolutePath,
                                                                    baseEntityData["entityRelativeURL"]);
            }

            client.BeginSingleRecipientEvent("send about add relationship event add");

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

            client.AddInterceptor(interceptor);

            try
            {
                client.SendNoticeToAsync(
                    NotifyConstants.Event_AddRelationshipEvent,
                    null,
                    userID.Select(item => ToRecipient(item)).ToArray(),
                    true,
                    new TagValue(NotifyConstants.Tag_EntityTitle, baseEntityData["title"]),
                    new TagValue(NotifyConstants.Tag_EntityID, baseEntityData["id"]),
                    new TagValue(NotifyConstants.Tag_EntityRelativeURL, baseEntityData["entityRelativeURL"]),
                    new TagValue(NotifyConstants.Tag_AdditionalData,
                                 new Hashtable {
                    { "Files", fileListInfoHashtable },
                    { "EventContent", entity.Content }
                }));
            }
            finally
            {
                client.RemoveInterceptor(interceptor.Name);
                client.EndSingleRecipientEvent("send about add relationship event add");
            }
        }
Example #9
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);
            }
        }
Example #10
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");
            }
        }
Example #11
0
        public void SendAboutProjectDeleting(IEnumerable <Guid> recipients, Project project)
        {
            var interceptor = new InitiatorInterceptor(new DirectRecipient(SecurityContext.CurrentAccount.ID.ToString(), ""));

            client.AddInterceptor(interceptor);

            try
            {
                client.SendNoticeToAsync(
                    NotifyConstants.Event_ProjectDeleted,
                    project.UniqID,
                    recipients.Select(ToRecipient).Where(r => r != null).ToArray(),
                    true,
                    new TagValue(NotifyConstants.Tag_EntityTitle, project.Title),
                    new TagValue(NotifyConstants.Tag_EntityID, 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.Deleted));
            }
            finally
            {
                client.RemoveInterceptor(interceptor.Name);
            }
        }
Example #12
0
        public void SendAboutMessageDeleting(List <IRecipient> recipients, Message message)
        {
            var interceptor = new InitiatorInterceptor(new DirectRecipient(SecurityContext.CurrentAccount.ID.ToString(), ""));

            try
            {
                client.AddInterceptor(interceptor);
                client.SendNoticeToAsync(
                    NotifyConstants.Event_MessageDeleted,
                    message.NotifyId,
                    recipients.ToArray(),
                    true,
                    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 AdditionalSenderTag("push.sender"),
                    new TagValue(PushConstants.PushItemTagName, new PushItem(PushItemType.Message, message.ID.ToString(), message.Title)),
                    new TagValue(PushConstants.PushParentItemTagName, new PushItem(PushItemType.Project, message.Project.ID.ToString(), message.Project.Title)),
                    new TagValue(PushConstants.PushModuleTagName, PushModule.Projects),
                    new TagValue(PushConstants.PushActionTagName, PushAction.Deleted));
            }
            finally
            {
                client.RemoveInterceptor(interceptor.Name);
            }
        }
Example #13
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");
            }
        }
Example #14
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);
            }
        }
        private void NotifyAboutNewPost(Post post)
        {
            string url       = VirtualPathUtility.ToAbsolute("~/");
            int    numb_page = Convert.ToInt32(Math.Ceiling(Topic.PostCount / (_settings.PostCountOnPage * 1.0)));

            string hostUrl = CommonLinkUtility.ServerRootPath;

            string topicURL  = hostUrl + _settings.LinkProvider.PostList(Topic.ID);
            string postURL   = hostUrl + _settings.LinkProvider.Post(post.ID, Topic.ID, numb_page);
            string threadURL = hostUrl + _settings.LinkProvider.TopicList(Topic.ThreadID);
            string userURL   = hostUrl + CommonLinkUtility.GetUserProfile(post.PosterID, _settings.ProductID);

            string postText = HtmlUtility.GetFull(post.Text, _settings.ProductID);

            var initatorInterceptor = new InitiatorInterceptor(new DirectRecipient(SecurityContext.CurrentAccount.ID.ToString(), SecurityContext.CurrentAccount.Name));

            try
            {
                SubscriptionConstants.NotifyClient.AddInterceptor(initatorInterceptor);

                var poster = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);

                _forumManager.PresenterFactory.GetPresenter <INotifierView>().SetView(this);
                SubscriptionConstants.NotifyClient.BeginSingleRecipientEvent(SubscriptionConstants.SyncName);
                if (SendNotify != null)
                {
                    if (PostType == NewPostType.Poll || PostType == NewPostType.Topic)
                    {
                        SendNotify(this, new NotifyEventArgs(SubscriptionConstants.NewTopicInForum,
                                                             null)
                        {
                            ThreadTitle = Topic.ThreadTitle, TopicId = Topic.ID, TopicTitle = Topic.Title, Poster = poster, Date = post.CreateDate.ToShortString(), PostURL = postURL, TopicURL = topicURL, ThreadURL = threadURL, UserURL = userURL, PostText = postText
                        });
                    }


                    SendNotify(this, new NotifyEventArgs(SubscriptionConstants.NewPostInThread,
                                                         Topic.ThreadID.ToString())
                    {
                        ThreadTitle = Topic.ThreadTitle, TopicTitle = Topic.Title, Poster = poster, Date = post.CreateDate.ToShortString(), PostURL = postURL, TopicURL = topicURL, ThreadURL = threadURL, UserURL = userURL, PostText = postText, TopicId = Topic.ID, PostId = post.ID, TenantId = Topic.TenantID
                    });

                    SendNotify(this, new NotifyEventArgs(SubscriptionConstants.NewPostInTopic,
                                                         Topic.ID.ToString())
                    {
                        ThreadTitle = Topic.ThreadTitle, TopicTitle = Topic.Title, Poster = poster, Date = post.CreateDate.ToShortString(), PostURL = postURL, TopicURL = topicURL, ThreadURL = threadURL, UserURL = userURL, PostText = postText, TopicId = Topic.ID, PostId = post.ID, TenantId = Topic.TenantID
                    });
                }
                SubscriptionConstants.NotifyClient.EndSingleRecipientEvent(SubscriptionConstants.SyncName);
            }
            finally
            {
                SubscriptionConstants.NotifyClient.RemoveInterceptor(initatorInterceptor.Name);
            }
        }
Example #16
0
        public void SaveComment(Comment comment, Post post)
        {
            CommunitySecurity.DemandPermissions(post, ASC.Blogs.Core.Constants.Action_AddComment);
            SaveComment(comment);

            var initiatorInterceptor = new InitiatorInterceptor(new DirectRecipient(comment.UserID.ToString(), ""));

            try
            {
                NotifyClient.BeginSingleRecipientEvent("asc_blog_c");
                NotifyClient.AddInterceptor(initiatorInterceptor);

                List <ITagValue> tags = new List <ITagValue>
                {
                    new TagValue(ASC.Blogs.Core.Constants.TagPostSubject, post.Title),
                    new TagValue(ASC.Blogs.Core.Constants.TagPostPreview, post.GetPreviewText(500)),
                    new TagValue(ASC.Blogs.Core.Constants.TagUserName, DisplayUserSettings.GetFullUserName(comment.UserID)),
                    new TagValue(ASC.Blogs.Core.Constants.TagUserURL, CommonLinkUtility.GetFullAbsolutePath(CommonLinkUtility.GetUserProfile(comment.UserID, CommonLinkUtility.GetProductID()))),
                    new TagValue(ASC.Blogs.Core.Constants.TagDate, string.Format("{0:d} {0:t}", comment.Datetime)),
                    new TagValue(ASC.Blogs.Core.Constants.TagCommentBody, comment.Content),

                    new TagValue(ASC.Blogs.Core.Constants.TagURL, CommonLinkUtility.GetFullAbsolutePath(ASC.Blogs.Core.Constants.ViewBlogPageUrl + "?blogID=" + post.ID.ToString())),
                    new TagValue(ASC.Blogs.Core.Constants.TagCommentURL, CommonLinkUtility.GetFullAbsolutePath(ASC.Blogs.Core.Constants.ViewBlogPageUrl + "?blogID=" + post.ID.ToString() + "#" + comment.ID.ToString())),
                    GetReplyToTag(comment.ID, post)
                };

                NotifyClient.SendNoticeAsync(
                    ASC.Blogs.Core.Constants.NewComment,
                    post.ID.ToString(),
                    null,
                    tags.ToArray());

                NotifyClient.EndSingleRecipientEvent("asc_blog_c");
            }
            finally
            {
                NotifyClient.RemoveInterceptor(initiatorInterceptor.Name);
            }

            BlogUserActivityPublisher.AddComment(comment, post);

            ASC.Notify.Model.ISubscriptionProvider subscriptionProvider = NotifySource.GetSubscriptionProvider();

            if (!subscriptionProvider.IsUnsubscribe((IDirectRecipient)NotifySource.GetRecipientsProvider().
                                                    GetRecipient(SecurityContext.CurrentAccount.ID.ToString()), ASC.Blogs.Core.Constants.NewComment, post.ID.ToString()))
            {
                subscriptionProvider.Subscribe(
                    ASC.Blogs.Core.Constants.NewComment,
                    post.ID.ToString(),
                    NotifySource.GetRecipientsProvider().
                    GetRecipient(SecurityContext.CurrentAccount.ID.ToString())
                    );
            }
        }
        public static void SendNoticeAsync(string AuthorID, INotifyAction action, string objectID, SendNoticeCallback sendCallback, params ITagValue[] args)
        {
            InitiatorInterceptor initatorInterceptor = new InitiatorInterceptor(new DirectRecipient(AuthorID, ""));

            try
            {
                NotifyClient.AddInterceptor(initatorInterceptor);
                NotifyClient.SendNoticeAsync(action, objectID, sendCallback, args);
            }
            finally
            {
                NotifyClient.RemoveInterceptor(initatorInterceptor.Name);
            }
        }
Example #18
0
        private static void SendBookmarkNoticeAsync(INotifyAction action, string objectID, TagValue[] tags)
        {
            var initatorInterceptor = new InitiatorInterceptor(GetCurrentRecipient());
            var notifyClient        = BookmarkingNotifyClient.NotifyClient;

            try
            {
                notifyClient.AddInterceptor(initatorInterceptor);
                notifyClient.SendNoticeAsync(action, objectID, null, tags);
            }
            finally
            {
                notifyClient.RemoveInterceptor(initatorInterceptor.Name);
            }
        }
Example #19
0
        private void NotifyNewComment(FeedComment comment, Feed feed)
        {
            var feedType = feed.FeedType == FeedType.Poll ? "poll" : "feed";

            var tags = new ITagValue[]
            {
                new TagValue(NewsConst.TagFEED_TYPE, feedType),
                //new TagValue(NewsConst.TagAnswers, feed.Variants.ConvertAll<string>(v => v.Name)),
                new TagValue(NewsConst.TagCaption, feed.Caption),
                new TagValue("CommentBody", HtmlUtility.GetFull(comment.Comment)),
                new TagValue(NewsConst.TagDate, comment.Date.ToShortString()),
                new TagValue(NewsConst.TagURL, CommonLinkUtility.GetFullAbsolutePath("~/Products/Community/Modules/News/Default.aspx?docid=" + feed.Id)),
                new TagValue("CommentURL", CommonLinkUtility.GetFullAbsolutePath("~/Products/Community/Modules/News/Default.aspx?docid=" + feed.Id + "#container_" + comment.Id.ToString(CultureInfo.InvariantCulture))),
                new TagValue(NewsConst.TagUserName, DisplayUserSettings.GetFullUserName(SecurityContext.CurrentAccount.ID)),
                new TagValue(NewsConst.TagUserUrl, CommonLinkUtility.GetFullAbsolutePath(CommonLinkUtility.GetUserProfile(SecurityContext.CurrentAccount.ID)))
            };

            var initatorInterceptor = new InitiatorInterceptor(new DirectRecipient(comment.Creator, ""));

            try
            {
                NewsNotifyClient.NotifyClient.AddInterceptor(initatorInterceptor);

                var mentionedUsers   = MentionProvider.GetMentionedUsers(comment.Comment);
                var mentionedUserIds = mentionedUsers.Select(u => u.ID.ToString());

                var provider = NewsNotifySource.Instance.GetSubscriptionProvider();

                var objectID = feed.Id.ToString(CultureInfo.InvariantCulture);

                var recipients = provider
                                 .GetRecipients(NewsConst.NewComment, objectID)
                                 .Where(r => !mentionedUserIds.Contains(r.ID))
                                 .ToArray();

                NewsNotifyClient.NotifyClient.SendNoticeToAsync(NewsConst.NewComment, objectID, recipients, false, tags);

                if (mentionedUsers.Length > 0)
                {
                    NewsNotifyClient.NotifyClient.SendNoticeToAsync(NewsConst.MentionForFeedComment, objectID, mentionedUsers, false, tags);
                }
            }
            finally
            {
                NewsNotifyClient.NotifyClient.RemoveInterceptor(initatorInterceptor.Name);
            }
        }
Example #20
0
        public void SendNewComment(ProjectEntity entity, Comment comment)
        {
            INotifyAction action;

            if (entity.GetType() == typeof(Issue))
            {
                action = NotifyConstants.Event_NewCommentForIssue;
            }
            else if (entity.GetType() == typeof(Message))
            {
                action = NotifyConstants.Event_NewCommentForMessage;
            }
            else if (entity.GetType() == typeof(Milestone))
            {
                action = NotifyConstants.Event_NewCommentForMilestone;
            }
            else if (entity.GetType() == typeof(Task))
            {
                action = NotifyConstants.Event_NewCommentForTask;
            }
            else
            {
                return;
            }

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

            try
            {
                client.AddInterceptor(interceptor);
                client.SendNoticeAsync(
                    action,
                    entity.NotifyId,
                    null,
                    new TagValue(NotifyConstants.Tag_ProjectID, entity.Project.ID),
                    new TagValue(NotifyConstants.Tag_ProjectTitle, entity.Project.Title),
                    new TagValue(NotifyConstants.Tag_EntityTitle, entity.Title),
                    new TagValue(NotifyConstants.Tag_EntityID, entity.ID),
                    new TagValue(NotifyConstants.Tag_AdditionalData, comment.Content),
                    GetReplyToEntityTag(entity, comment));
            }
            finally
            {
                client.RemoveInterceptor(interceptor.Name);
            }
        }
Example #21
0
        public static void SendUpdateNotice(File document)
        {
            if (document == null ||
                SecurityContext.CurrentAccount.ID.Equals(ASC.Core.Configuration.Constants.Guest.ID))
            {
                return;
            }

            var url = document.ViewUrl;

            if (FileUtility.ExtsWebPreviewed.Contains(FileUtility.GetFileExtension(document.Title), StringComparer.CurrentCultureIgnoreCase))
            {
                url = CommonLinkUtility.GetFileWebViewerUrl(document.ID);
            }

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

            try
            {
                Instance.AddInterceptor(interceptor);
                Instance.SendNoticeAsync(
                    NotifyConstants.Event_UpdateDocument,
                    document.UniqID,
                    null,
                    new TagValue(NotifyConstants.Tag_DocumentTitle, document.Title),
                    new TagValue(NotifyConstants.Tag_DocumentUrl, CommonLinkUtility.GetFullAbsolutePath(url)),
                    new TagValue(NotifyConstants.Tag_VersionNumber, document.Version));
            }
            finally
            {
                Instance.RemoveInterceptor(interceptor.Name);
            }

            if (document.RootFolderType == FolderType.USER &&
                document.CreateBy != SecurityContext.CurrentAccount.ID)
            {
                Instance.SendNoticeAsync(
                    NotifyConstants.Event_UpdateDocument,
                    document.UniqID,
                    NotifySource.Instance.GetRecipientsProvider().GetRecipient(document.CreateBy.ToString()),
                    null,
                    new TagValue(NotifyConstants.Tag_DocumentTitle, document.Title),
                    new TagValue(NotifyConstants.Tag_DocumentUrl, CommonLinkUtility.GetFullAbsolutePath(url)),
                    new TagValue(NotifyConstants.Tag_VersionNumber, document.Version));
            }
        }
Example #22
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);
            }
        }
Example #23
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);
            }
        }
Example #24
0
        public void SendNewFile(List <IRecipient> recipients, ProjectEntity entity, string fileTitle)
        {
            INotifyAction action;

            if (entity.GetType() == typeof(Message))
            {
                action = NotifyConstants.Event_NewFileForDiscussion;
            }
            else if (entity.GetType() == typeof(Task))
            {
                action = NotifyConstants.Event_NewFileForTask;
            }
            else
            {
                return;
            }

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

            try
            {
                client.AddInterceptor(interceptor);
                client.SendNoticeToAsync(
                    action,
                    entity.NotifyId,
                    recipients.ToArray(),
                    true,
                    new TagValue(NotifyConstants.Tag_ProjectID, entity.Project.ID),
                    new TagValue(NotifyConstants.Tag_ProjectTitle, entity.Project.Title),
                    new TagValue(NotifyConstants.Tag_EntityTitle, entity.Title),
                    new TagValue(NotifyConstants.Tag_EntityID, entity.ID),
                    new TagValue(NotifyConstants.Tag_AdditionalData, fileTitle));
            }
            finally
            {
                client.RemoveInterceptor(interceptor.Name);
            }
        }
Example #25
0
        private void NotifyCommentAdd(AlbumItem image, Comment newComment)
        {
            var initiatorInterceptor = new InitiatorInterceptor(new DirectRecipient(SecurityContext.CurrentAccount.ID.ToString(), ""));

            try
            {
                NotifyClient.AddInterceptor(initiatorInterceptor);

                var albumUrl    = UrlHelper.GetAbsoluteAlbumUrl(image.Album.Id);
                var albumName   = DisplayUserSettings.GetFullUserName(new Guid(image.UserID));
                var eventUrl    = UrlHelper.GetAbsoluteEventUrl(image.Album.Event.Id);
                var userName    = DisplayUserSettings.GetFullUserName(new Guid(newComment.UserID));
                var userUrl     = CommonLinkUtility.GetFullAbsolutePath(CommonLinkUtility.GetUserProfile(new Guid(newComment.UserID), ASC.Web.Community.Product.CommunityProduct.ID));
                var commentsUrl = UrlHelper.GetAbsolutePhotoUrl(image.Id);
                var commentText = newComment.Text;

                NotifyClient.SendNoticeAsync(
                    PhotoConst.NewEventComment,
                    image.Album.Event != null ? image.Album.Event.Id.ToString() : "0",
                    null,
                    new TagValue(PhotoConst.TagEventName, image.Album.Event.Name),
                    new TagValue(PhotoConst.TagUserName, userName),
                    new TagValue(PhotoConst.TagUserURL, userUrl),
                    new TagValue(PhotoConst.TagEventUrl, eventUrl),
                    new TagValue(PhotoConst.TagAlbumName, albumName),
                    new TagValue(PhotoConst.TagAlbumURL, albumUrl),
                    new TagValue(PhotoConst.TagPhotoName, image.Name),
                    new TagValue(PhotoConst.TagDate, string.Format("{0:d} {0:t}", newComment.Timestamp)),
                    new TagValue(PhotoConst.TagCommentBody, commentText),
                    new TagValue(PhotoConst.TagURL, commentsUrl));
            }
            finally
            {
                NotifyClient.RemoveInterceptor(initiatorInterceptor.Name);
            }

            PhotoUserActivityPublisher.AddComment(image, newComment);
        }
Example #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);
            }
        }
Example #27
0
        private void NotifyAlbumSave(Album currentAlbum, IEnumerable <AlbumItem> newItems)
        {
            var initiatorInterceptor = new InitiatorInterceptor(new DirectRecipient(SecurityContext.CurrentAccount.ID.ToString(), ""));

            try
            {
                NotifyClient.AddInterceptor(initiatorInterceptor);
                NotifyClient.BeginSingleRecipientEvent("photo uploaded");

                var albumUrl = UrlHelper.GetAbsoluteAlbumUrl(currentAlbum.Id);
                var eventUrl = UrlHelper.GetAbsoluteEventUrl(currentAlbum.Event.Id);
                var userName = DisplayUserSettings.GetFullUserName(SecurityContext.CurrentAccount.ID);
                var userUrl  = CommonLinkUtility.GetFullAbsolutePath(CommonLinkUtility.GetUserProfile(SecurityContext.CurrentAccount.ID, ASC.Web.Community.Product.CommunityProduct.ID));

                NotifyClient.SendNoticeAsync(
                    PhotoConst.NewPhotoUploaded,
                    null,
                    null,
                    new[] {
                    new TagValue(PhotoConst.TagEventName, currentAlbum.Event.Name),
                    new TagValue(PhotoConst.TagUserName, userName),
                    new TagValue(PhotoConst.TagUserURL, userUrl),
                    new TagValue(PhotoConst.TagPhotoCount, newItems.Count()),
                    new TagValue(PhotoConst.TagDate, string.Format("{0:d} {0:t}", TenantUtil.DateTimeNow())),
                    new TagValue(PhotoConst.TagURL, albumUrl),
                    new TagValue(PhotoConst.TagEventUrl, eventUrl),
                    new TagValue("PHOTO_UPLOAD", true)
                });
            }
            finally
            {
                NotifyClient.EndSingleRecipientEvent("photo uploaded");
                NotifyClient.RemoveInterceptor(initiatorInterceptor.Name);
            }

            PhotoUserActivityPublisher.AddPhoto(currentAlbum, SecurityContext.CurrentAccount.ID, newItems.ToList());
        }
Example #28
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);
            }
        }
        /// <summary>
        /// notify user about his password changed
        /// </summary>
        public void UserPasswordChanged(Guid userID, string password)
        {
            UserInfo Author      = null;
            UserInfo newUserInfo = CoreContext.UserManager.GetUsers(userID);

            if (CoreContext.UserManager.UserExists(SecurityContext.CurrentAccount.ID))
            {
                Author = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
            }

            ISendInterceptor initInterceptor = null;

            if (Author != null)
            {
                initInterceptor = new InitiatorInterceptor(new[] { UserInfoAsRecipient(Author) });
                client.AddInterceptor(initInterceptor);
            }

            client.SendNoticeToAsync(
                Constants.ActionPasswordChanged,
                null,
                new[] { UserInfoAsRecipient(newUserInfo) },
                new[] { EMailSenderName },
                null,
                new TagValue(Constants.TagUserName, newUserInfo.DisplayUserName()),
                new TagValue(Constants.TagUserEmail, newUserInfo.Email),
                new TagValue(Constants.TagMyStaffLink, GetMyStaffLink()),
                new TagValue(Constants.TagPassword, password)
                );


            if (initInterceptor != null)
            {
                client.RemoveInterceptor(initInterceptor.Name);
            }
        }
Example #30
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);
            }
        }