Exemple #1
0
        public async Task <bool> Run(CallEmailQueueItem item)
        {
            var logic = new CallEmailImporterLogic();
            await logic.Process(item);

            return(true);
        }
        public async Task ProcessAsync(CallEmailImportCommand command, IQuidjiboProgress progress, CancellationToken cancellationToken)
        {
            progress.Report(1, $"Starting the {Name} Task");

            try
            {
                //await Task.Run(async () =>
                //{
                var _departmentsService = Bootstrapper.GetKernel().Resolve <IDepartmentsService>();
                var logic = new CallEmailImporterLogic();

                //var items = await _departmentsService.GetAllDepartmentEmailSettingsAsync();
                var items = new List <DepartmentCallEmail>();

                if (items != null)
                {
                    _logger.LogInformation("CallEmailImport::Email Import Settings: " + items.Count);

                    foreach (var i in items)
                    {
                        var cqi = new CallEmailQueueItem();
                        cqi.EmailSettings = i;

                        _logger.LogInformation("CallEmailImport::Processing Email for DepartmentCallEmailId:" + cqi.EmailSettings.DepartmentCallEmailId);

                        var result = await logic.Process(cqi);

                        if (result.Item1)
                        {
                            _logger.LogInformation($"CallEmailImport::Processed Email Import {cqi.EmailSettings.DepartmentCallEmailId} successfully.");
                        }
                        else
                        {
                            _logger.LogInformation($"CallEmailImport::Failed to Processed Email Import {cqi.EmailSettings.DepartmentCallEmailId} error {result.Item2}");
                        }
                    }
                }
                //}, cancellationToken);

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

            await Task.Factory.StartNew(() =>
            {
                var _departmentsService = Bootstrapper.GetKernel().Resolve <IDepartmentsService>();
                var logic = new CallEmailImporterLogic();

                var items = _departmentsService.GetAllDepartmentEmailSettings();

                if (items != null)
                {
                    _logger.LogInformation("CallEmailImport::Email Import Settings: " + items.Count);

                    foreach (var i in items)
                    {
                        var cqi           = new CallEmailQueueItem();
                        cqi.EmailSettings = i;

                        _logger.LogInformation("CallEmailImport::Processing Email for DepartmentCallEmailId:" + cqi.EmailSettings.DepartmentCallEmailId);

                        var result = logic.Process(cqi);

                        if (result.Item1)
                        {
                            _logger.LogInformation($"CallEmailImport::Processed Email Import {cqi.EmailSettings.DepartmentCallEmailId} successfully.");
                        }
                        else
                        {
                            _logger.LogInformation($"CallEmailImport::Failed to Processed Email Import {cqi.EmailSettings.DepartmentCallEmailId} error {result.Item2}");
                        }
                    }
                }
            }, cancellationToken, TaskCreationOptions.LongRunning, TaskScheduler.Default);

            progress.Report(100, $"Finishing the {Name} Task");
        }
Exemple #4
0
        public void Run(CallEmailQueueItem item)
        {
            var logic = new CallEmailImporterLogic();

            logic.Process(item);
        }