public static async Task <IList <T> > ReadAsync <T>(this IExcelDocumentService excelDocumentService, string filePath, string worksheetName, CultureInfo cultureInfo)
 {
     using (var stream = File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
     {
         return(await excelDocumentService.ReadAsync <T>(stream, worksheetName, cultureInfo));
     }
 }
 public static async Task WriteAsync(this IExcelDocumentService excelDocumentService, string filePath, string worksheetName, IEnumerable items, Type type, CultureInfo cultureInfo)
 {
     using (var stream = File.Open(filePath, FileMode.Create, FileAccess.Write, FileShare.None))
     {
         await excelDocumentService.WriteAsync(stream, worksheetName, items, type, cultureInfo);
     }
 }
 public static async Task <IList <string> > GetWorksheetNamesAsync(this IExcelDocumentService excelDocumentService, string filePath)
 {
     using (var stream = File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
     {
         return(await excelDocumentService.GetWorksheetNamesAsync(stream));
     }
 }
 public static IReadOnlyCollection <T> Read <T>(this IExcelDocumentService excelDocumentService, Stream excelStream, string worksheetName, CultureInfo cultureInfo)
 {
     return
         (excelDocumentService
          .Read(excelStream, worksheetName, typeof(T), cultureInfo)
          .Cast <T>()
          .ToList()
          .AsReadOnly());
 }
예제 #5
0
 public WorkFlowsController(
     IMediator mediator,
     IRepositoryInt <WorkFlow> workFlowRepository,
     IRepositoryInt <User> userRepository,
     IExcelDocumentService excelDocumentService,
     IHttpContextAccessor httpContextAccessor,
     ILogger <WorkFlowsController> logger)
 {
     _mediator             = mediator ?? throw new ArgumentNullException(nameof(mediator));
     _workFlowRepository   = workFlowRepository ?? throw new ArgumentNullException(nameof(workFlowRepository));
     _userRepository       = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
     _excelDocumentService = excelDocumentService ?? throw new ArgumentNullException(nameof(excelDocumentService));
     _httpContextAccessor  = httpContextAccessor ?? throw new ArgumentNullException(nameof(httpContextAccessor));
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
예제 #6
0
 public AuditLogsController(ITypeHelperService typeHelperService,
                            IMapper mapper,
                            ILinkGeneratorService linkGeneratorService,
                            IRepositoryInt <AuditLog> auditLogRepository,
                            IRepositoryInt <Attachment> attachmentRepository,
                            IRepositoryInt <User> userRepository,
                            IExcelDocumentService excelDocumentService,
                            IHttpContextAccessor httpContextAccessor)
 {
     _typeHelperService    = typeHelperService ?? throw new ArgumentNullException(nameof(typeHelperService));
     _mapper               = mapper ?? throw new ArgumentNullException(nameof(mapper));
     _linkGeneratorService = linkGeneratorService ?? throw new ArgumentNullException(nameof(linkGeneratorService));
     _auditLogRepository   = auditLogRepository ?? throw new ArgumentNullException(nameof(auditLogRepository));
     _attachmentRepository = attachmentRepository ?? throw new ArgumentNullException(nameof(attachmentRepository));
     _userRepository       = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
     _excelDocumentService = excelDocumentService ?? throw new ArgumentNullException(nameof(excelDocumentService));
     _httpContextAccessor  = httpContextAccessor ?? throw new ArgumentNullException(nameof(httpContextAccessor));
 }
 public static void Write <T>(this IExcelDocumentService excelDocumentService, Stream excelStream, string worksheetName, IEnumerable items, IFormatProvider formatProvider)
 {
     excelDocumentService
     .Write(excelStream, worksheetName, typeof(T), items, formatProvider);
 }
 public static Task WriteAsync <T>(this IExcelDocumentService excelDocumentService, string filePath, string worksheetName, IEnumerable <T> items, CultureInfo cultureInfo)
 {
     return(excelDocumentService.WriteAsync(filePath, worksheetName, items, typeof(T), cultureInfo));
 }
        public static async Task <IList <T> > ReadAsync <T>(this IExcelDocumentService excelDocumentService, Stream stream, string worksheetName, CultureInfo cultureInfo)
        {
            var result = await excelDocumentService.ReadAsync(stream, worksheetName, typeof(T), cultureInfo);

            return(result.Cast <T>().ToArray());
        }
예제 #10
0
 public LancamentoCommandService(IDominioRepository dominioRepository)
 {
     _dominioRepository    = dominioRepository;
     _excelDocumentService = new CreditCardOpenXmlApplication();
 }
 public ExportToExcelCommandService(IDominioRepository dominioRepository,
                                    IExcelDocumentService excelDocumentService)
 {
     _dominioRepository    = dominioRepository;
     _excelDocumentService = excelDocumentService;
 }