예제 #1
0
        private async Task ExecuteOrderProcessAsync(CancellationToken stoppingToken)
        {
            _logger.LogInformation("Getting data from file...");
            var ordersProvider = new OrdersProvider();
            var orders         = ordersProvider.GetOrdersFromCsv(Reader).Take(_maxMailsAtOnce).ToList();

            if (!orders.Any())
            {
                return;
            }

            _logger.LogInformation($"Found {orders.Count} orders for send.");
            _logger.LogInformation("Starting sending process...");
            var orderMailService = new OrderMailService(_smtpClient, _logger);
            await orderMailService.SendOrders(orders, stoppingToken);
        }