public async Task ExecuteAsync(ExportTableRecruitCommandParameters parameters) { if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } await Task.Run(() => { var conscriptionDateExportDirectory = CreateDirectory(parameters); var fileName = !string.IsNullOrWhiteSpace(parameters.RegionalCollectionPoint) ? parameters.RegionalCollectionPoint : AllRegionalCollectionPoints; var filePath = Path.Combine(conscriptionDateExportDirectory, $"{fileName}{Path.GetExtension(_exportTableTemplateFilePath)}"); var recruitExporter = _recruitExcelExporterFactory.Create(_exportTableTemplateFilePath, filePath); recruitExporter.ExportRecruitShortUIModelsToExcelTable(parameters.RecruitShortUIModels, parameters.RegionalCollectionPoint, parameters.ConscriptionDate); parameters.StateChanged.OnStateChanged(CommandSuccess, StateResult.Success); }); }
private IRecruitExcelExporter CreateRecruitExporter(ExportRecruitCommandParameters parameters, RecruitInfo firstRecruit, RecruitInfo secondRecruit) { var rcpDirectory = CreateDirectory(parameters, firstRecruit); var fileName = GetFileName(firstRecruit, secondRecruit); var filePath = Path.Combine(rcpDirectory, $"{fileName}{Path.GetExtension(_exportTemplateFilePath)}"); return(_recruitExcelExporterFactory.Create(_exportTemplateFilePath, filePath)); }