Пример #1
0
        public void SaveEvent(Event ev)
        {
            CommunitySecurity.DemandPermissions(PhotoConst.Action_AddEvent);

            if (ev == null)
            {
                throw new ArgumentNullException("event");
            }

            ev.Id = DbManager.ExecuteScalar <long>(
                Insert("photo_event")
                .InColumns(Mappers.EventColumns)
                .Values(ev.Id, ev.Name, ev.Description, ev.UserID, PrepareTimestamp(ev.Timestamp))
                .Identity <long>(1, 0, true)
                );

            var subscriber = NotifySource.GetSubscriptionProvider();

            subscriber.Subscribe(PhotoConst.NewEventComment, ev.Id.ToString(), NotifySource.GetRecipientsProvider().GetRecipient(SecurityContext.CurrentAccount.ID.ToString()));
        }
Пример #2
0
        private static T GetInternal <T>(INotifySource source) where T : class
        {
            T result = null;

            if (source == null)
            {
                return(null);
            }
            if (typeof(T) == typeof(IActionPatternProvider))
            {
                result = (T)WrappedGet(() => source.GetActionPatternProvider());
            }
            if (typeof(T) == typeof(IActionProvider))
            {
                result = (T)WrappedGet(() => source.GetActionProvider());
            }
            if (typeof(T) == typeof(IPatternProvider))
            {
                result = (T)WrappedGet(() => source.GetPatternProvider());
            }
            if (typeof(T) == typeof(IDependencyProvider))
            {
                result = (T)WrappedGet(() => source.GetDependencyProvider());
            }
            if (typeof(T) == typeof(ISubscriptionProvider))
            {
                result = (T)WrappedGet(() => source.GetSubscriptionProvider());
            }
            if (typeof(T) == typeof(IRecipientProvider))
            {
                result = (T)WrappedGet(() => source.GetRecipientsProvider());
            }
            if (typeof(T) == typeof(ISubscriptionSource))
            {
                result = (T)WrappedGet(() => source.GetSubscriptionSource());
            }
            return(result);
        }
Пример #3
0
 private IRecipient ToRecipient(Guid userID)
 {
     return(source.GetRecipientsProvider().GetRecipient(userID.ToString()));
 }