Ejemplo n.º 1
0
        public async Task <bool> Run(CalendarNotifierQueueItem item)
        {
            var logic = new CalendarNotifierLogic();
            await logic.Process(item);

            return(true);
        }
Ejemplo n.º 2
0
        public async Task ProcessAsync(CalendarNotificationCommand command, IQuidjiboProgress progress, CancellationToken cancellationToken)
        {
            try
            {
                progress.Report(1, $"Starting the {Name} Task");

                //await Task.Run(async () =>
                //{
                var _calendarService = Bootstrapper.GetKernel().Resolve <ICalendarService>();
                var logic            = new CalendarNotifierLogic();

                var calendarItems = await _calendarService.GetCalendarItemsToNotifyAsync(DateTime.UtcNow);

                if (calendarItems != null)
                {
                    _logger.LogInformation("CalendarNotification::Calendar Items to Notify: " + calendarItems.Count);

                    foreach (var calendarItem in calendarItems)
                    {
                        var qi = new CalendarNotifierQueueItem();
                        qi.CalendarItem = calendarItem;

                        _logger.LogInformation("CalendarNotification::Processing Notification for CalendarId:" + qi.CalendarItem.CalendarItemId);

                        var result = await logic.Process(qi);

                        if (result.Item1)
                        {
                            _logger.LogInformation($"CalendarNotification::Processed Calendar Notification {qi.CalendarItem.CalendarItemId} successfully.");
                        }
                        else
                        {
                            _logger.LogInformation($"CalendarNotification::Failed to Processed Calendar Notification {qi.CalendarItem.CalendarItemId} error {result.Item2}");
                        }
                    }
                }
                else
                {
                    progress.Report(6, "CalendarNotification::No Calendar Items to Notify");
                }
                //}, cancellationToken);

                progress.Report(100, $"Finishing the {Name} Task");
            }
            catch (Exception ex)
            {
                Resgrid.Framework.Logging.LogException(ex);
                _logger.LogError(ex.ToString());
            }
        }
Ejemplo n.º 3
0
        public async Task ProcessAsync(CalendarNotificationCommand command, IQuidjiboProgress progress, CancellationToken cancellationToken)
        {
            progress.Report(1, $"Starting the {Name} Task");

            await Task.Factory.StartNew(() =>
            {
                var _calendarService = Bootstrapper.GetKernel().Resolve <ICalendarService>();
                var logic            = new CalendarNotifierLogic();

                var calendarItems = _calendarService.GetV2CalendarItemsToNotify(DateTime.UtcNow);

                if (calendarItems != null)
                {
                    _logger.LogInformation("CalendarNotification::Calendar Items to Notify: " + calendarItems.Count);

                    foreach (var calendarItem in calendarItems)
                    {
                        var qi          = new CalendarNotifierQueueItem();
                        qi.CalendarItem = calendarItem;

                        _logger.LogInformation("CalendarNotification::Processing Notification for CalendarId:" + qi.CalendarItem.CalendarItemId);

                        var result = logic.Process(qi);

                        if (result.Item1)
                        {
                            _logger.LogInformation($"CalendarNotification::Processed Calendar Notification {qi.CalendarItem.CalendarItemId} successfully.");
                        }
                        else
                        {
                            _logger.LogInformation($"CalendarNotification::Failed to Processed Calendar Notification {qi.CalendarItem.CalendarItemId} error {result.Item2}");
                        }
                    }
                }
                else
                {
                    progress.Report(6, "CalendarNotification::No Calendar Items to Notify");
                }
            }, cancellationToken, TaskCreationOptions.LongRunning, TaskScheduler.Default);

            progress.Report(100, $"Finishing the {Name} Task");
        }
Ejemplo n.º 4
0
        public void Run(CalendarNotifierQueueItem item)
        {
            var logic = new CalendarNotifierLogic();

            logic.Process(item);
        }