Esempio n. 1
0
        public void Execute()
        {
            var processFiles = _fileReader.FileReader(_path);

            foreach (var file in processFiles)
            {
                _logger.InfoFormat($"Processing DayRate: {file.DayRateFile} with Price: {file.PriceFile}. Has Free Consultant: {file.HasFreeConsultant}");
                var prices   = _priceReader.FileReader(file.PriceFile);
                var dayRates = _dayRateReader.FileReader(file.DayRateFile);

                var dailyRecords = new List <DailyRecord>();
                foreach (var dayRate in dayRates)
                {
                    var salesRecord = _distributor.PriceBuilder(dayRate, prices, file.HasFreeConsultant);
                    dailyRecords.Add(salesRecord);
                }

                _logger.InfoFormat($"Processing DayRate to OutputFile: {file.OutputFile}");
                _outputService.WriteToFile(dailyRecords, file.OutputFile);
            }
        }