Beispiel #1
0
        public async Task <bool> Run(CallPruneQueueItem item)
        {
            var logic = new CallPruneLogic();
            await logic.Process(item);

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

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

                var items = await _departmentsService.GetAllDepartmentCallPruningsAsync();

                if (items != null)
                {
                    _logger.LogInformation("CallPrune::Call Pruning To Process: " + items.Count);

                    foreach (var i in items)
                    {
                        var item = new CallPruneQueueItem();
                        item.PruneSettings = i;

                        _logger.LogInformation("CallPrune::Pruning Calls for DepartmentId:" + item.PruneSettings.DepartmentId);
                        item.PruneSettings.Department =
                            await _departmentsService.GetDepartmentByIdAsync(item.PruneSettings.DepartmentId);

                        var result = await logic.Process(item);

                        if (result.Item1)
                        {
                            _logger.LogInformation($"CallPrune::Pruned Calls for Department {item.PruneSettings.DepartmentId} successfully.");
                        }
                        else
                        {
                            _logger.LogInformation($"CallPrune::Failed to Process Calls for Department {item.PruneSettings.DepartmentId} error {result.Item2}");
                        }
                    }
                }
                //}, cancellationToken);

                progress.Report(100, $"Finishing the {Name} Task");
            }
            catch (Exception ex)
            {
                Resgrid.Framework.Logging.LogException(ex);
                _logger.LogError(ex.ToString());
            }
        }
Beispiel #3
0
        public async Task ProcessAsync(CallPruneCommand 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 CallPruneLogic();

                var items = _departmentsService.GetAllDepartmentCallPrunings();

                if (items != null)
                {
                    _logger.LogInformation("CallPrune::Call Pruning To Process: " + items.Count);

                    foreach (var i in items)
                    {
                        var item           = new CallPruneQueueItem();
                        item.PruneSettings = i;

                        _logger.LogInformation("CallPrune::Processing Calls for DepartmentId:" + item.PruneSettings.DepartmentId);

                        var result = logic.Process(item);

                        if (result.Item1)
                        {
                            _logger.LogInformation($"CallPrune::Processing Calls for Department {item.PruneSettings.DepartmentId} successfully.");
                        }
                        else
                        {
                            _logger.LogInformation($"CallPrune::Failed to Process Calls for Department {item.PruneSettings.DepartmentId} error {result.Item2}");
                        }
                    }
                }
            }, cancellationToken, TaskCreationOptions.LongRunning, TaskScheduler.Default);


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

            logic.Process(item);
        }