diff --git a/server/AyaNova/AyaNova.csproj b/server/AyaNova/AyaNova.csproj index b7645c96..ba311409 100644 --- a/server/AyaNova/AyaNova.csproj +++ b/server/AyaNova/AyaNova.csproj @@ -18,7 +18,7 @@ - + diff --git a/server/AyaNova/Controllers/ExportController.cs b/server/AyaNova/Controllers/ExportController.cs index b69129cc..7affb99c 100644 --- a/server/AyaNova/Controllers/ExportController.cs +++ b/server/AyaNova/Controllers/ExportController.cs @@ -13,8 +13,9 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System.IO; using System.IO.Compression; -using ChoETL; +using CsvHelper; using System; +using System.Globalization; namespace AyaNova.Api.Controllers { @@ -100,10 +101,11 @@ namespace AyaNova.Api.Controllers switch (format) { case "csv": - using (var w = new ChoCSVWriter(outputSourceFullPath).WithFirstLineHeader()) + using (StreamWriter file = System.IO.File.CreateText(outputSourceFullPath)) + using (var csv = new CsvHelper.CsvWriter(file, CultureInfo.InvariantCulture)) { - var dat = await ((IExportAbleObject)biz).GetExportData(selectedRequest, Guid.Empty);//todo: jobify - w.Write(ToDynamicList(dat)); + var dat = await ((IExportAbleObject)biz).GetExportData(selectedRequest, Guid.Empty); + csv.WriteRecords(dat); } break; case "json": @@ -129,7 +131,7 @@ namespace AyaNova.Api.Controllers catch (ReportRenderTimeOutException) { log.LogInformation($"RenderExport timeout data list key: {selectedRequest.DataListKey}, record count:{selectedRequest.SelectedRowIds.LongLength}, user:{UserNameFromContext.Name(HttpContext.Items)} "); - return BadRequest(new ApiErrorResponse(ApiErrorCode.INVALID_OPERATION, null, "timeout - select fewer records")); + return BadRequest(new ApiErrorResponse(ApiErrorCode.INVALID_OPERATION, null, "timeout - select fewer records")); } }