Exemplo n.º 1
0
        public void LoadExcelForSpesialistTest()
        {
            var builder = new AdvanceStreamBuilder <SpecialistExcelEntity>(_options);
            IList <SpecialistExcelEntity> result = builder.CreateReader(Path.GetExtension(_file.Name))
                                                   .Read(_file);

            Assert.NotEmpty(result);
        }
Exemplo n.º 2
0
        public void LoadExcelForPoliTest()
        {
            var builder = new AdvanceStreamBuilder <PoliclinicExcelEntity>(_options);
            IList <PoliclinicExcelEntity> result = builder.CreateReader(Path.GetExtension(_file.Name))
                                                   .Read(_file, 2);

            Assert.NotEmpty(result);
        }
Exemplo n.º 3
0
        public List <T> ImportData <T>(IFormFile file, StreamAdvanceOption option = null) where T : class, IStreamEntity, new()
        {
            if (file != null)
            {
                Stream stream = file.OpenReadStream();

                var builder = new AdvanceStreamBuilder <T>(option);
                return(builder.CreateReader(Path.GetExtension(file.FileName)).Read(stream));
            }
            else
            {
                throw new FieldAccessException("Failed accessed file");
            }
        }