Exemplo n.º 1
0
        public void NotifyAboutSharingCalendar(ASC.Calendar.BusinessObjects.Calendar calendar, ASC.Calendar.BusinessObjects.Calendar oldCalendar)
        {
            var initatorInterceptor = new InitiatorInterceptor(new DirectRecipient(AuthContext.CurrentAccount.ID.ToString(), AuthContext.CurrentAccount.Name));

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

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

                    var r = CalendarNotifySource.GetRecipientsProvider().GetRecipient(item.Id.ToString());
                    if (r != null)
                    {
                        _notifyClient.SendNoticeAsync(CalendarNotifySource.CalendarSharing, null, r, true,
                                                      new TagValue("SharingType", "calendar"),
                                                      new TagValue("UserName", usr.DisplayUserName(DisplayUserSettingsHelper)),
                                                      new TagValue("UserLink", userLink),
                                                      new TagValue("CalendarName", calendar.Name));
                    }
                }
                _notifyClient.EndSingleRecipientEvent(_syncName);
            }
            finally
            {
                _notifyClient.RemoveInterceptor(initatorInterceptor.Name);
            }
        }
Exemplo n.º 2
0
 public void NotifyAboutSharingCalendar(ASC.Calendar.BusinessObjects.Calendar calendar)
 {
     NotifyAboutSharingCalendar(calendar, null);
 }