GetLastProcessTime() static private méthode

static private GetLastProcessTime ( NotificationFrequency freq ) : System.DateTime
freq NotificationFrequency
Résultat System.DateTime
Exemple #1
0
        private static IEnumerable <Subscription> CollectEventsPerSubscription(NotificationFrequency freq, DateTime now)
        {
            var lastTime      = now;
            var subscriptions = Subscription.GetActiveSubscriptionsByFrequency(freq);

            if (subscriptions.Count() == 0)
            {
                return(null);
            }
            //var time = GetTimeLimit(freq);
            var time = LastProcessTime.GetLastProcessTime(freq);

            using (var context = new DataHandler())
            {
                var events = (time == DateTime.MinValue)?
                             context.Events.Where(x => x.When <= lastTime) :
                             context.Events.Where(x => x.When > time && x.When <= lastTime);
                foreach (var @event in events.OrderBy(x => x.When))
                {
                    foreach (var subscription in subscriptions)
                    {
                        if (IsRelatedPath(@event.ContentPath, subscription.ContentPath))
                        {
                            if (HasPermission(subscription, @event))
                            {
                                subscription.AddRelatedEvent(@event);
                            }
                        }
                    }
                }
            }
            LastProcessTime.SetLastProcessTime(freq, lastTime);
            return(subscriptions);
        }