コード例 #1
0
ファイル: Chatroom.cs プロジェクト: hansenjacobs/Chatroom
 public Chatroom(string name, IRecipient server)
 {
     Name       = name;
     Recipients = new Dictionary <string, IRecipient>();
     Recipients.Add("server", server);
     MessageQueue = new Queue <Message>();
 }
コード例 #2
0
        /// <summary>
        /// Проверить наличие у участника прав на сущность.
        /// </summary>
        /// <param name="entity">Сущность.</param>
        /// <param name="member">Участник.</param>
        /// <param name="accessRightsType">Тип прав.</param>
        /// <returns>True - если права есть, иначе - false.</returns>
        public static bool CheckGrantedRights(IEntity entity, IRecipient member, Guid accessRightsType)
        {
            if (accessRightsType == DefaultAccessRightsTypes.Change)
            {
                return(entity.AccessRights.IsGrantedDirectly(accessRightsType, member) ||
                       entity.AccessRights.IsGrantedDirectly(DefaultAccessRightsTypes.FullAccess, member));
            }

            if (accessRightsType == Docflow.Constants.Module.DefaultAccessRightsTypeSid.ChangeContent)
            {
                return(entity.AccessRights.IsGrantedDirectly(accessRightsType, member) ||
                       entity.AccessRights.IsGrantedDirectly(DefaultAccessRightsTypes.Change, member) ||
                       entity.AccessRights.IsGrantedDirectly(DefaultAccessRightsTypes.FullAccess, member));
            }

            if (accessRightsType == DefaultAccessRightsTypes.Read)
            {
                return(entity.AccessRights.IsGrantedDirectly(accessRightsType, member) ||
                       entity.AccessRights.IsGrantedDirectly(DefaultAccessRightsTypes.FullAccess, member) ||
                       entity.AccessRights.IsGrantedDirectly(DefaultAccessRightsTypes.Change, member) ||
                       entity.AccessRights.IsGrantedDirectly(Docflow.Constants.Module.DefaultAccessRightsTypeSid.ChangeContent, member));
            }

            return(entity.AccessRights.IsGrantedDirectly(accessRightsType, member));
        }
コード例 #3
0
        public NotifyRequest(INotifySource notifySource, INotifyAction action, string objectID, IRecipient recipient)
        {
            if (notifySource == null)
            {
                throw new ArgumentNullException("notifySource");
            }
            if (action == null)
            {
                throw new ArgumentNullException("action");
            }
            if (recipient == null)
            {
                throw new ArgumentNullException("recipient");
            }

            Properties   = new Hashtable();
            Arguments    = new List <ITagValue>();
            RequaredTags = new List <string>();
            Interceptors = new List <ISendInterceptor>();

            NotifySource = notifySource;
            Recipient    = recipient;
            NotifyAction = action;
            ObjectID     = objectID;

            IsNeedCheckSubscriptions = true;
        }
コード例 #4
0
        public string[] GetSubscriptionMethod(INotifyAction action, IRecipient recipient)
        {
            if (action == null) throw new ArgumentNullException("action");
            if (recipient == null) throw new ArgumentNullException("recipient");

            return subscriptionManager.GetSubscriptionMethod(sourceID, action.ID, recipient.ID);
        }
コード例 #5
0
        public void Subscribe(INotifyAction action, string objectID, IRecipient recipient)
        {
            if (action == null) throw new ArgumentNullException("action");
            if (recipient == null) throw new ArgumentNullException("recipient");

            subscriptionManager.Subscribe(sourceID, action.ID, objectID, recipient.ID);
        }
コード例 #6
0
 public SendResponse(INotifyAction action, string senderName, IRecipient recipient, SendResult sendResult)
 {
     SenderName   = senderName;
     Recipient    = recipient;
     Result       = sendResult;
     NotifyAction = action;
 }
コード例 #7
0
        public string[] GetSubscriptions(INotifyAction action, IRecipient recipient, bool checkSubscribe = true)
        {
            if (action == null) throw new ArgumentNullException("action");
            if (recipient == null) throw new ArgumentNullException("recipient");

            return subscriptionManager.GetSubscriptions(sourceID, action.ID, recipient.ID, checkSubscribe);
        }
コード例 #8
0
 /// <summary>
 /// Call the registered data handlers.
 /// </summary>
 /// <param name="data">The received data.</param>
 /// <param name="recipient">The sender of the data.</param>
 protected void HandleReceivedData(byte[] data, IRecipient sender)
 {
     foreach (IDataHandler handler in _dataHandlers)
     {
         handler.Handle(data, sender);
     }
 }
コード例 #9
0
        public virtual string[] GetSubscriptionMethod(INotifyAction action, IRecipient recipient)
        {
            if (action == null)
            {
                throw new ArgumentNullException("action");
            }
            if (recipient == null)
            {
                throw new ArgumentNullException("recipient");
            }

            var senders = subscriptionProvider.GetSubscriptionMethod(action, recipient);

            if (senders == null || senders.Length == 0)
            {
                var parents = WalkUp(recipient);
                foreach (var parent in parents)
                {
                    senders = subscriptionProvider.GetSubscriptionMethod(action, parent);
                    if (senders != null && senders.Length != 0)
                    {
                        break;
                    }
                }
            }

            return(senders != null && 0 < senders.Length ? senders : defaultSenderMethods);
        }
コード例 #10
0
        private NotifyRequest CreateRequest(INotifyAction action, string objectID, IRecipient recipient, SendNoticeCallback sendCallback, ITagValue[] args, string[] senders, bool checkSubsciption)
        {
            if (action == null)
            {
                throw new ArgumentNullException("action");
            }
            if (recipient == null)
            {
                throw new ArgumentNullException("recipient");
            }
            if (sendCallback != null)
            {
                throw new NotImplementedException("sendCallback");
            }

            var request = new NotifyRequest(notifySource, action, objectID, recipient);

            request.SenderNames = senders;
            request.IsNeedCheckSubscriptions = checkSubsciption;
            if (args != null)
            {
                request.Arguments.AddRange(args);
            }
            return(request);
        }
コード例 #11
0
 /// <summary>
 /// Deletes a recipient from an envelope.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='envelopeId'>
 /// The id of the envelope/bulk.
 /// </param>
 /// <param name='recipientId'>
 /// The id of an recipient in the bulk or envelope.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <object> DeleteRecipientAsync(this IRecipient operations, string envelopeId, string recipientId, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.DeleteRecipientWithHttpMessagesAsync(envelopeId, recipientId, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
コード例 #12
0
ファイル: SendResponse.cs プロジェクト: ridhouan/teamlab.v6.5
 public SendResponse(INotifyAction action, string senderName, IRecipient recipient, SendResult sendResult)
 {
     SenderName = senderName;
     Recipient = recipient;
     Result = sendResult;
     NotifyAction = action;
 }
コード例 #13
0
 public SendResponse(INotifyAction action, IRecipient recipient, Exception exc)
 {
     Result       = SendResult.Impossible;
     Exception    = exc;
     Recipient    = recipient;
     NotifyAction = action;
 }
コード例 #14
0
        public virtual IRecipientsGroup[] GetGroups(IRecipient recipient)
        {
            if (recipient == null) throw new ArgumentNullException("recipient");

            var result = new List<IRecipientsGroup>();
            var recID = Guid.Empty;
            if (TryParseGuid(recipient.ID, out recID))
            {
                if (recipient is IRecipientsGroup)
                {
                    var group = CoreContext.GroupManager.GetGroupInfo(recID);
                    while (group != null && group.Parent != null)
                    {
                        result.Add(new RecipientsGroup(group.Parent.ID.ToString(), group.Parent.Name));
                        group = group.Parent;
                        break;
                    }
                }
                else if (recipient is IDirectRecipient)
                {
                    foreach (var group in CoreContext.UserManager.GetUserGroups(recID, IncludeType.Distinct))
                    {
                        result.Add(new RecipientsGroup(group.ID.ToString(), group.Name));
                    }
                }
            }
            return result.ToArray();
        }
コード例 #15
0
        /// <summary>
        /// Responding event handler. Checks if a send-as address must be specified.
        /// </summary>
        /// <param name="mail"></param>
        /// <param name="response"></param>
        private void MailEvents_Respond(IMailItem mail, IMailItem response)
        {
            Logger.Instance.Trace(this, "Responding to mail, checking");
            using (IStore store = mail.GetStore())
            {
                ZPushAccount zpush = Watcher.Accounts.GetAccount(store);
                Logger.Instance.Trace(this, "Checking ZPush: {0}", zpush);
                if (zpush == null)
                {
                    return;
                }

                // Check if the containing folder is a shared folder
                using (IFolder parent = mail.Parent)
                    using (IRecipient recip = FindSendAsSender(zpush, parent))
                    {
                        if (recip == null || !recip.IsResolved)
                        {
                            return;
                        }

                        // Set the sender
                        Logger.Instance.Trace(this, "Sending as: {0}", recip.Address);
                        using (IAddressEntry address = recip.GetAddressEntry())
                        {
                            response.SetSender(address);
                        }
                    }
            }
        }
コード例 #16
0
        public virtual IRecipientsGroup[] GetGroups(Tenant tenant, IRecipient recipient)
        {
            if (recipient == null)
            {
                throw new ArgumentNullException("recipient");
            }

            var result = new List <IRecipientsGroup>();

            if (TryParseGuid(recipient.ID, out var recID))
            {
                if (recipient is IRecipientsGroup)
                {
                    var group = CoreContext.UserManager.GetGroupInfo(tenant.TenantId, recID);
                    while (group != null && group.Parent != null)
                    {
                        result.Add(new RecipientsGroup(group.Parent.ID.ToString(), group.Parent.Name));
                        group = group.Parent;
                    }
                }
                else if (recipient is IDirectRecipient)
                {
                    foreach (var group in CoreContext.UserManager.GetUserGroups(tenant, recID, IncludeType.Distinct))
                    {
                        result.Add(new RecipientsGroup(group.ID.ToString(), group.Name));
                    }
                }
            }
            return(result.ToArray());
        }
コード例 #17
0
        public virtual object GetSubscriptionRecord(INotifyAction action, IRecipient recipient, string objectID)
        {
            if (recipient == null)
            {
                throw new ArgumentNullException("recipient");
            }
            if (action == null)
            {
                throw new ArgumentNullException("action");
            }

            var subscriptionRecord = subscriptionProvider.GetSubscriptionRecord(action, recipient, objectID);

            if (subscriptionRecord != null)
            {
                return(subscriptionRecord);
            }

            var parents = WalkUp(recipient);

            foreach (var parent in parents)
            {
                subscriptionRecord = subscriptionProvider.GetSubscriptionRecord(action, parent, objectID);

                if (subscriptionRecord != null)
                {
                    break;
                }
            }

            return(subscriptionRecord);
        }
コード例 #18
0
        /// <summary>
        /// Получить представление исполнителя.
        /// </summary>
        /// <param name="recipient">Роль/сотрудник.</param>
        /// <returns>Представление.</returns>
        public static string GetRecipientDescription(IRecipient recipient)
        {
            var result   = string.Empty;
            var employee = Employees.As(recipient);

            if (employee != null)
            {
                result = Functions.ApprovalStage.GetEmployeePresentation(employee);
            }
            else
            {
                var group = Sungero.CoreEntities.Groups.As(recipient);
                if (group != null)
                {
                    var employees = Docflow.PublicFunctions.Module.Remote.GetEmployeesFromRecipientsRemote(new List <IRecipient> {
                        recipient
                    }).Distinct();
                    List <string> employeesDescription = employees.Select(e => Functions.ApprovalStage.GetEmployeePresentation(e)).ToList();
                    result = string.Join(string.Format("{0}{1}", ",", Environment.NewLine), employeesDescription);
                    result = string.Format("\"{0}\" ({1})", recipient.Name, result);
                }
                else
                {
                    result = string.Format("\"{0}\"", recipient.Name);
                }
            }

            return(result);
        }
コード例 #19
0
        public IMessageBuilder AddToRecipient(IRecipient recipient, JObject recipientVariables = null)
        {
            //check for recipient
            ThrowIf.IsArgumentNull(() => recipient);

            if (_recipientCount == Constants.MaximumAllowedRecipients)
            {
                throw new Exception("Messages cannot contain more than To 1000 recipients");
            }

            //set the to value
            if (_message.To == null)
            {
                _message.To = new Collection <IRecipient>();
            }

            //set the recipient variables
            if (recipientVariables != null)
            {
                if (_message.RecipientVariables == null)
                {
                    _message.RecipientVariables = new JObject();
                }
                _message.RecipientVariables[recipient.Email] = recipientVariables;
            }

            //add to the message
            _message.To.Add(recipient);
            _recipientCount++;

            return(this);
        }
コード例 #20
0
 public RecipientBillHistory(IRecipient recipient, IBillService service)
 {
     _billservice       = service;
     this.RecipientId   = recipient.RecipientId;
     this.RecipientName = recipient.CompanyName;
     _billservice.GetBillsForMonth();
 }
コード例 #21
0
ファイル: Messenger.cs プロジェクト: bounoable/gamenet
        /// <summary>
        /// Handle received data, parse the message and pass it to the registered handlers.
        /// </summary>
        /// <param name="data">The received data.</param>
        /// <param name="recipient">The sender of the data.</param>
        async public void Handle(byte[] data, IRecipient sender)
        {
            // Check if the data contains at least the message type id.
            if (data.Length < sizeof(int))
            {
                return;
            }

            IPacket      packet = ParsePacket(data);
            IMessageType type   = TypeConfig.GetTypeById(packet.MessageType);

            if (type == null || type.Serializer == null)
            {
                return;
            }

            object obj = type.Serializer.Deserialize(packet.Payload);

            if (obj is IAcknowledgeRequest)
            {
                var message = (IAcknowledgeRequest)obj;

                await Send(sender, new AcknowledgeResponse(message.AckToken));
            }

            if (obj is IAcknowledgeResponse)
            {
                var response = (IAcknowledgeResponse)obj;

                _pendingAcknowledgeRequests.TryRemove(response.AckToken, out PendingAcknowledgeRequest removed);
            }

            type.Handler?.Handle(obj);
        }
コード例 #22
0
        public virtual void Subscribe(INotifyAction action, string objectID, IRecipient recipient)
        {
            if (action == null) throw new ArgumentNullException("action");
            if (recipient == null) throw new ArgumentNullException("recipient");

            subscriptionProvider.Subscribe(action, objectID, recipient);
        }
コード例 #23
0
ファイル: SendResponse.cs プロジェクト: ridhouan/teamlab.v6.5
 public SendResponse(INotifyAction action, IRecipient recipient, Exception exc)
 {
     Result = SendResult.Impossible;
     Exception = exc;
     Recipient = recipient;
     NotifyAction = action;
 }
コード例 #24
0
 public GetPeopleAndRecipient(
     IPersonConnection people,
     IRecipient personById)
 {
     People     = people;
     PersonById = personById;
 }
コード例 #25
0
        public Notifier(IEnumerable <IClient> clients)
        {
            _clients = clients;

            _message   = new Message();
            _recipient = new Recipient();
        }
コード例 #26
0
 public IEmailAdditional BaseBuildEmail(IRecipient recipient, string body) =>
 new AdditionalBaseEmailBuilder(new Email
 {
     Recipients = new List <IRecipient> {
         recipient
     },
     Body = body
 });
コード例 #27
0
ファイル: ChatMessage.cs プロジェクト: fannbrian/chat-server
        public ChatMessage(IUser sender, IRecipient recipient, string content)
        {
            Sender    = sender;
            Recipient = recipient;
            Content   = content;

            TimeStamp = DateTime.Now;
        }
コード例 #28
0
 private bool IsSubscribeToWhatsNew(IRecipient recipient)
 {
     if (recipient == null)
     {
         return(false);
     }
     return(source.GetSubscriptionProvider().IsSubscribed(Constants.ActionSendWhatsNew, recipient, null));
 }
コード例 #29
0
 public static bool IsSubscribed(this ISubscriptionProvider provider, INotifyAction action, IRecipient recipient,
                                 string objectID)
 {
     return Array.Exists(
         provider.GetSubscriptions(action, recipient),
         id => id == objectID || (string.IsNullOrEmpty(id) && string.IsNullOrEmpty(objectID))
         );
 }
コード例 #30
0
 public IAdvancedEmailBuilder BuildBaseEmail(IRecipient recipient, string body) =>
 new AdvancedClassicEmailBuilder(new Email
 {
     Recipients = new List <IRecipient> {
         recipient
     },
     Body = body
 });
コード例 #31
0
 public virtual void UnSubscribe(INotifyAction action, IRecipient recipient)
 {
     string[] objects = GetSubscriptions(action, recipient);
     foreach (string objectID in objects)
     {
         _directSubscriptionProvider.UnSubscribe(action, objectID, recipient);
     }
 }
コード例 #32
0
 public RecipientVM(IRecipient recipient)
 {
     this.Account            = recipient.Account;
     this.RecipientId        = recipient.RecipientId;
     this.CompanyName        = recipient.CompanyName;
     this.Address            = recipient.Address;
     this.CustomerServiceUrl = recipient.CustomerServiceUrl;
     this.Active             = recipient.Active;
 }
コード例 #33
0
        public virtual void UnSubscribe(Tenant tenant, INotifyAction action, IRecipient recipient)
        {
            var objects = GetSubscriptions(tenant, action, recipient);

            foreach (var objectID in objects)
            {
                subscriptionProvider.UnSubscribe(action, objectID, recipient);
            }
        }
コード例 #34
0
        public IMessageBuilder SetFromAddress(IRecipient sender)
        {
            //check for recipient
            ThrowIf.IsArgumentNull(() => sender);

            //add to the message
            _message.From = sender;

            return(this);
        }
コード例 #35
0
        public Task SendAsync(IdentityMessage message, IRecipient fromAddress)
        {
            ThrowIf.IsArgumentNull(() => message);
            ThrowIf.IsArgumentNull(() => fromAddress);

            //set from address
            _from = fromAddress;

            return(_options != null?SendWithOptions(message) : SendWithSimpleParameters(message));
        }
コード例 #36
0
 public void UpdateRecepient(IRecipient recipient)
 {
     DbAccess.Entities.Recipient dbrecipient = this.repo.GetById(recipient.RecipientId);
     dbrecipient.Account            = recipient.Account;
     dbrecipient.Address            = recipient.Address;
     dbrecipient.CompanyName        = recipient.CompanyName;
     dbrecipient.CustomerServiceUrl = recipient.CustomerServiceUrl;
     dbrecipient.Active             = true;
     this.repo.Update(dbrecipient);
     this.repo.Save();
 }
コード例 #37
0
        /// <summary>
        /// Return a CmsTypedStream representing the content in the EnvelopedData after recovering the content
        /// encryption/MAC key using the passed in Recipient.
        /// </summary>
        /// <param name="recipient">Recipient object to use to recover content encryption key</param>
        /// <returns>The content inside the EnvelopedData this RecipientInformation is associated with.</returns>
        public CmsTypedStream GetContentStream(IRecipient recipient)
        {
            op = GetRecipientOperator(recipient);

            if (additionalData != null)
            {
                return(new CmsTypedStream(secureReadable.GetInputStream()));
            }

            return(new CmsTypedStream(op.GetStream(secureReadable.GetInputStream())));
        }
コード例 #38
0
 public void UpdateSubscriptionMethod(INotifyAction action, IRecipient recipient, params string[] senderNames)
 {
     if (action == null)
     {
         throw new ArgumentNullException("action");
     }
     if (recipient == null)
     {
         throw new ArgumentNullException("recipient");
     }
     subscriptionManager.UpdateSubscriptionMethod(sourceID, action.ID, recipient.ID, senderNames);
 }
コード例 #39
0
        public void CreateProviders()
        {
            tenant = new Tenants.Tenant(0, "teamlab");
            sourceId = "6045b68c-2c2e-42db-9e53-c272e814c4ad";
            actionId = "NewCommentForTask";
            objectId = "Task_5946_457";
            nAction = new NotifyAction(actionId, actionId);
            testRec = new DirectRecipient("ff0c4e13-1831-43c2-91ce-7b7beb56179b", null); //Oliver Khan
            testRec2 = new DirectRecipient("0017794f-aeb7-49a5-8817-9e870e02bd3f", null); //Якутова Юлия


            recProvider = new RecipientProviderImpl();
            var directSubProvider = new DirectSubscriptionProvider(sourceId, CoreContext.SubscriptionManager, recProvider, null);
            subProvider = new TopSubscriptionProvider(recProvider, directSubProvider);
            CoreContext.TenantManager.SetCurrentTenant(tenant);
        }
コード例 #40
0
        public NotifyRequest(INotifySource notifySource, INotifyAction action, string objectID, IRecipient recipient)
        {
            if (notifySource == null) throw new ArgumentNullException("notifySource");
            if (action == null) throw new ArgumentNullException("action");
            if (recipient == null) throw new ArgumentNullException("recipient");

            Properties = new Hashtable();
            Arguments = new List<ITagValue>();
            RequaredTags = new List<string>();
            Interceptors = new List<ISendInterceptor>();

            NotifySource = notifySource;
            Recipient = recipient;
            NotifyAction = action;
            ObjectID = objectID;

            IsNeedCheckSubscriptions = true;
        }
コード例 #41
0
        public virtual string[] GetSubscriptionMethod(INotifyAction action, IRecipient recipient)
        {
            if (action == null) throw new ArgumentNullException("action");
            if (recipient == null) throw new ArgumentNullException("recipient");

            var senders = subscriptionProvider.GetSubscriptionMethod(action, recipient);
            if (senders == null || senders.Length == 0)
            {
                var parents = WalkUp(recipient);
                foreach (var parent in parents)
                {
                    senders = subscriptionProvider.GetSubscriptionMethod(action, parent);
                    if (senders != null && senders.Length != 0) break;
                }
            }

            return senders != null && 0 < senders.Length ? senders : defaultSenderMethods;
        }
コード例 #42
0
 public virtual string[] GetSubscriptionMethod(INotifyAction action, IRecipient recipient)
 {
     if (action == null)
         throw new ArgumentNullException("action");
     if (recipient == null)
         throw new ArgumentNullException("recipient");
     string[] senders = _directSubscriptionProvider.GetSubscriptionMethod(action, recipient);
     if (senders == null || senders.Length == 0)
     {
         List<IRecipient> parents = WalkUp(recipient);
         foreach (IRecipient parent in parents)
         {
             senders = _directSubscriptionProvider.GetSubscriptionMethod(action, parent);
             if (senders != null && senders.Length != 0) break;
         }
     }
     if (senders == null || senders.Length == 0)
         senders = _defaultSenderMethods;
     return senders;
 }
コード例 #43
0
        private NotifyRequest CreateRequest(INotifyAction action, string objectID, IRecipient recipient, SendNoticeCallback sendCallback, ITagValue[] args, string[] senders, bool checkSubsciption)
        {
            if (action == null) throw new ArgumentNullException("action");
            if (recipient == null) throw new ArgumentNullException("recipient");
            if (sendCallback != null) throw new NotImplementedException("sendCallback");

            var request = new NotifyRequest(notifySource, action, objectID, recipient);
            request.SenderNames = senders;
            request.IsNeedCheckSubscriptions = checkSubsciption;
            if (args != null) request.Arguments.AddRange(args);
            return request;
        }
コード例 #44
0
 public void UpdateSubscriptionMethod(INotifyAction action, IRecipient recipient, params string[] senderNames)
 {
     provider.UpdateSubscriptionMethod(GetAdminAction(action), recipient, senderNames);
 }
コード例 #45
0
 internal NotifyRequest Split(IRecipient recipient)
 {
     if (recipient == null) throw new ArgumentNullException("recipient");
     var newRequest = new NotifyRequest(NotifySource, NotifyAction, ObjectID, recipient);
     newRequest.SenderNames = SenderNames;
     newRequest.Patterns = Patterns;
     newRequest.Arguments = new List<ITagValue>(Arguments);
     newRequest.RequaredTags = RequaredTags;
     newRequest.CurrentSender = CurrentSender;
     newRequest.CurrentMessage = CurrentMessage;
     newRequest.Interceptors.AddRange(Interceptors);
     return newRequest;
 }
コード例 #46
0
 public string[] GetSubscriptionMethod(INotifyAction action, IRecipient recipient)
 {
     return provider.GetSubscriptionMethod(GetAdminAction(action), recipient);
 }
コード例 #47
0
 public IRecipientsGroup[] GetGroups(IRecipient recipient, string objectID)
 {
     return GetGroups(recipient);
 }
コード例 #48
0
 public void UnSubscribe(INotifyAction action, string objectID, IRecipient recipient)
 {
     provider.UnSubscribe(GetAdminAction(action), objectID, recipient);
 }
コード例 #49
0
        private void SendNoticeToAsync(INotifyAction action, string objectID, IRecipient[] recipients, string[] senderNames, SendNoticeCallback sendCallback, bool checkSubsciption, params ITagValue[] args)
        {
            if (recipients == null) throw new ArgumentNullException("recipients");

            BeginSingleRecipientEvent("__syspreventduplicateinterceptor");

            foreach (var recipient in recipients)
            {
                var r = CreateRequest(action, objectID, recipient, sendCallback, args, senderNames, checkSubsciption);
                SendAsync(r);
            }
        }
コード例 #50
0
 internal List<IRecipient> WalkUp(IRecipient recipient)
 {
     var parents = new List<IRecipient>();
     IRecipientsGroup[] groups = _recipientProvider.GetGroups(recipient) ?? new IRecipientsGroup[0];
     foreach (IRecipientsGroup group in groups)
     {
         parents.Add(group);
         List<IRecipient> topgroups = WalkUp(group);
         parents.AddRange(topgroups);
     }
     return parents;
 }
コード例 #51
0
 public void SendNoticeToAsync(INotifyAction action, string objectID, IRecipient[] recipients, string[] senderNames, SendNoticeCallback sendCallback, params ITagValue[] args)
 {
     SendNoticeToAsync(action, objectID, recipients, senderNames, sendCallback, false, args);
 }
コード例 #52
0
 public void SendNoticeAsync(INotifyAction action, string objectID, IRecipient recipient, SendNoticeCallback sendCallback, params ITagValue[] args)
 {
     SendNoticeToAsync(action, objectID, new[] { recipient }, null, sendCallback, false, args);
 }
コード例 #53
0
ファイル: NotifyClient.cs プロジェクト: ridhouan/teamlab.v6.5
 private string[] GetDefaultSenders(IRecipient recipient)
 {
     return source.GetSubscriptionProvider().GetSubscriptionMethod(
         NotifyConstants.Event_NewCommentForMessage,
         recipient);
 }
コード例 #54
0
 public void SendNoticeAsync(INotifyAction action, string objectID, IRecipient recipient, bool checkSubscription, params ITagValue[] args)
 {
     SendNoticeToAsync(action, objectID, new[] { recipient }, null, null, checkSubscription, args);
 }
コード例 #55
0
 private bool IsSubscribeToWhatsNew(IRecipient recipient)
 {
     if (recipient == null) return false;
     return source.GetSubscriptionProvider().IsSubscribed(Constants.ActionSendWhatsNew, recipient, null);
 }
コード例 #56
0
 public void UnSubscribe(INotifyAction action, IRecipient recipient)
 {
     provider.UnSubscribe(GetAdminAction(action), recipient);
 }
コード例 #57
0
        public void TopSubProviderTest()
        {
            try
            {
                //0017794f-aeb7-49a5-8817-9e870e02bd3f - Якутова Юлия
                //ff0c4e13-1831-43c2-91ce-7b7beb56179b - Oliver Khan
                //cc8eea30-1260-427e-83c4-ff9e9680edba - Отдел интернет-приложений!!!;)

                IRecipient[] res;

                //GetRecipients
                res = subProvider.GetRecipients(nAction, objectId);
                var cnt = res.Count();

                //Subscribe
                subProvider.Subscribe(nAction, objectId, testRec);
                res = subProvider.GetRecipients(nAction, objectId);
                Assert.AreEqual(cnt + 1, res.Count());

                //UnSubscribe
                subProvider.UnSubscribe(nAction, testRec);
                res = subProvider.GetRecipients(nAction, objectId);
                Assert.AreEqual(cnt, res.Count());

                String[] objs;

                //GetSubscribtions

                //Получаем подписки юзера
                //for (int i = 0; i < 6; i++) subProvider.Subscribe(nAction, new Random().Next().ToString(), testRec2);
                objs = subProvider.GetSubscriptions(nAction, testRec2);
                CollectionAssert.IsNotEmpty(objs);
                CollectionAssert.AllItemsAreUnique(objs);

                //Получаем список групп к которым он принадлежит
                var parents = recProvider.GetGroups(testRec2);
                CollectionAssert.IsNotEmpty(parents);
                otdel = parents.First();
                everyone = parents.Last();

                var objsGroup = subProvider.GetSubscriptions(nAction, otdel);
                CollectionAssert.AllItemsAreUnique(objsGroup);

                //Подписываем весь отдел на объект
                rndObj = String.Concat("TestObject#", new Random().Next().ToString());
                subProvider.Subscribe(nAction, rndObj, otdel);
                //Проверяем подписался ли юзер вместе со всем отделом двумя способами.
                Assert.AreEqual(objsGroup.Count() + 1, subProvider.GetSubscriptions(nAction, otdel).Count());
                Assert.AreEqual(objs.Count() + 1, subProvider.GetSubscriptions(nAction, testRec2).Count());
                Assert.AreEqual(true, subProvider.IsSubscribed(nAction, testRec2, rndObj));

                //Подписываем Everybody
                rndObj2 = String.Concat("TestObject#", new Random().Next().ToString());
                objs = subProvider.GetSubscriptions(nAction, testRec2);
                subProvider.Subscribe(nAction, rndObj2, everyone);
                //Проверяем подписался ли user двумя способами.
                Assert.AreEqual(objs.Count() + 1, subProvider.GetSubscriptions(nAction, testRec2).Count());
                Assert.AreEqual(true, subProvider.IsSubscribed(nAction, testRec2, rndObj2));

            }
            finally
            {
                subProvider.UnSubscribe(nAction, objectId, testRec);
                subProvider.UnSubscribe(nAction, rndObj, otdel);
                subProvider.UnSubscribe(nAction, rndObj2, everyone);
            }
        }
コード例 #58
0
 public string[] GetSubscriptions(INotifyAction action, IRecipient recipient, bool checkSubscription = true)
 {
     return provider.GetSubscriptions(GetAdminAction(action), recipient, checkSubscription);
 }
コード例 #59
0
 public void UnSubscribe(INotifyAction action, IRecipient recipient)
 {
     throw new NotSupportedException("use UnSubscribe(INotifyAction, string, IRecipient )");
 }
コード例 #60
0
 public void UpdateSubscriptionMethod(INotifyAction action, IRecipient recipient, params string[] senderNames)
 {
     if (action == null) throw new ArgumentNullException("action");
     if (recipient == null) throw new ArgumentNullException("recipient");
     subscriptionManager.UpdateSubscriptionMethod(sourceID, action.ID, recipient.ID, senderNames);
 }