Esempio n. 1
0
 public CsvReaderController(
     ICsvReaderService csvReaderService,
     ILogger <CsvReaderController> logger)
 {
     _csvReaderService = csvReaderService;
     _logger           = logger;
 }
Esempio n. 2
0
 public ProcessFileController(IExcelReaderService excelReaderService, ICustomerService customerService, IHostingEnvironment hostingEnvironment, ICsvReaderService csvReaderService)
 {
     this._excelReaderService = excelReaderService;
     _customerService         = customerService;
     _hostingEnvironment      = hostingEnvironment;
     _csvReaderService        = csvReaderService;
 }
 public HandlerCsvJsonParser(ICsvReaderService csvReaderService,
                             ICsvJsonParserService csvJsonParserService,
                             ICreateJsonFileService createJsonFileService)
 {
     _csvReaderService      = csvReaderService;
     _csvJsonParserService  = csvJsonParserService;
     _createJsonFileService = createJsonFileService;
 }
Esempio n. 4
0
        public static async Task <List <TRecord> > ReadRecordsAsync <TRecord>(this ICsvReaderService csvReaderService, string fileName, ICsvContext csvContext)
        {
            Argument.IsNotNull(() => csvReaderService);
            Argument.IsOfType("csvContext.RecordType", csvContext.RecordType, typeof(TRecord));

            var records = await csvReaderService.ReadRecordsAsync(fileName, csvContext);

            return(records.Cast <TRecord>().ToList());
        }
Esempio n. 5
0
        public static List <TRecord> ReadRecords <TRecord>(this ICsvReaderService csvReaderService, StreamReader streamReader, ICsvContext csvContext)
        {
            Argument.IsNotNull(() => csvReaderService);
            Argument.IsOfType("csvContext.RecordType", csvContext.RecordType, typeof(TRecord));

            var records = csvReaderService.ReadRecords(streamReader, csvContext);

            return(records.Cast <TRecord>().ToList());
        }
Esempio n. 6
0
 public CsvParserService(
     ICsvReaderService csvReaderService,
     ICsvFilterService csvFilterService,
     IIndex <OutputFormats, ICsvPrinterService> printers,
     ILogger <CsvParserService> logger)
 {
     CsvReaderService = csvReaderService;
     CsvFilterService = csvFilterService;
     Printers         = printers;
     Logger           = logger;
 }
Esempio n. 7
0
        public static Task <List <TRecord> > ReadRecordsAsync <TRecord, TRecordMap>(this ICsvReaderService csvReaderService, string fileName, ICsvContext csvContext = null)
            where TRecordMap : ClassMap, new()
        {
            Argument.IsNotNull(() => csvReaderService);

            if (csvContext == null)
            {
                csvContext = new CsvContext <TRecord, TRecordMap>();
            }

            return(ReadRecordsAsync <TRecord>(csvReaderService, fileName, csvContext));
        }
Esempio n. 8
0
        public CsvReader(string source, ICsvReaderService csvReaderService, IFileService fileService)
            : base(source)
        {
            Argument.IsNotNullOrWhitespace(() => source);
            Argument.IsNotNull(() => csvReaderService);
            Argument.IsNotNull(() => fileService);

            _csvReaderService = csvReaderService;
            _fileService      = fileService;

            Initialize(source);
        }
Esempio n. 9
0
        public static List <TRecord> ReadRecords <TRecord, TRecordMap>(this ICsvReaderService csvReaderService, StreamReader streamReader, ICsvContext csvContext = null)
            where TRecordMap : ClassMap, new()
        {
            Argument.IsNotNull(() => csvReaderService);

            if (csvContext == null)
            {
                csvContext = new CsvContext <TRecord, TRecordMap>();
            }

            return(ReadRecords <TRecord>(csvReaderService, streamReader, csvContext));
        }
Esempio n. 10
0
        public static CsvReader CreateReader(this ICsvReaderService csvReaderService, string fileName, ICsvContext csvContext)
        {
            Argument.IsNotNull(() => csvReaderService);

            var dependencyResolver = csvReaderService.GetDependencyResolver();
            var fileService        = dependencyResolver.Resolve <IFileService>();

            // Note: don't dispose, the reader cannot be used when disposed
            var stream       = fileService.OpenRead(fileName);
            var streamReader = new StreamReader(stream);

            return(csvReaderService.CreateReader(streamReader, csvContext));
        }
Esempio n. 11
0
        public static IEnumerable ReadRecords(this ICsvReaderService csvReaderService, string fileName, ICsvContext csvContext)
        {
            Argument.IsNotNull(() => csvReaderService);

            var dependencyResolver = csvReaderService.GetDependencyResolver();
            var fileService        = dependencyResolver.Resolve <IFileService>();

            using (var stream = fileService.OpenRead(fileName))
            {
                using (var streamReader = new StreamReader(stream))
                {
                    var records = csvReaderService.ReadRecords(streamReader, csvContext);
                    return(records);
                }
            }
        }
Esempio n. 12
0
        public ServiceMonitoringRepository(
            ICsvReaderService csvReaderService,
            ICSVWriterService cSVWriterService)
        {
            if (csvReaderService == null)
            {
                throw new ArgumentNullException(nameof(csvReaderService));
            }

            if (cSVWriterService == null)
            {
                throw new ArgumentNullException(nameof(cSVWriterService));
            }

            this.csvReaderService = csvReaderService;
            this.cSVWriterService = cSVWriterService;
        }
Esempio n. 13
0
 public ImportFileReaderService(ICsvReaderService csvReaderService)
 {
     _csvReaderService = csvReaderService;
 }
 public LineupBuilderController(ICsvReaderService csvReaderService, ILineupBuilderService lineupBuilderService)
 {
     this.csvReaderService     = csvReaderService;
     this.lineupBuilderService = lineupBuilderService;
 }