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); }
public static bool IsSubscribed(this ISubscriptionProvider provider, INotifyAction action, IRecipient recipient, string objectID) { var result = false; try { var subscriptionRecord = provider.GetSubscriptionRecord(action, recipient, objectID); if (subscriptionRecord != null) { var properties = subscriptionRecord.GetType().GetProperties(); if (properties.Any()) { var property = properties.Single(p => p.Name == "Subscribed"); if (property != null) { result = (bool)property.GetValue(subscriptionRecord, null); } } } } catch (Exception exception) { LogManager.GetLogger("ASC").Error(exception); } return(result); }
public object GetSubscriptionRecord(INotifyAction action, IRecipient recipient, string objectID) { return(provider.GetSubscriptionRecord(GetAdminAction(action), recipient, objectID)); }