Esempio n. 1
0
        public async Task NotifyAsync()
        {
            //Fixa a cultura em pt-BR
            CultureInfo.CurrentUICulture = CultureInfo.GetCultureInfo("pt-BR");

            var range = new DateRange(DateTimeOffset.Now, DateTimeOffset.Now.AddMinutes(15));

            var subscriptions = await _eventSubscriptionRepository.FindEventsStartingBetweenAsync(range);

            if (subscriptions.Count > 0)
            {
                foreach (var notificationService in _notificationServices)
                {
                    await notificationService.NotifyAttendantsAsync(subscriptions);
                }

                subscriptions.ForEach(s => s.MarkAsNotified());

                await _eventSubscriptionRepository.UpdateSubscriptionsAsync(subscriptions);
            }
            else
            {
                _logger.NoSubscriptionsPendingNotification();
            }
        }