This commit is contained in:
2020-10-26 22:50:36 +00:00
parent 7947b508dd
commit 1d9e778ced
2 changed files with 9 additions and 42 deletions

View File

@@ -1,6 +1,5 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Authorization;
@@ -8,12 +7,7 @@ using Microsoft.Extensions.Logging;
using AyaNova.Models;
using AyaNova.Api.ControllerHelpers;
using AyaNova.Biz;
using AyaNova.Util;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.IO;
using System.IO.Compression;
using ChoETL;
namespace AyaNova.Api.Controllers
{

View File

@@ -316,8 +316,12 @@ namespace AyaNova.Biz
#region IMPORT EXPORT
//Get data for export
////////////////////////////////////////////////////////////////////////////////////////////////
// IMPORT EXPORT
//
public async Task<JArray> GetExportData(long[] idList)
{
//for now just re-use the report data code
@@ -325,6 +329,9 @@ namespace AyaNova.Biz
return await GetReportData(idList);
}
public async Task ImportData(JArray ja)
{
foreach (JObject j in ja)
@@ -336,40 +343,6 @@ namespace AyaNova.Biz
// public async Task<object[]> GetObjectArrayExportData(long[] idList)
// {
// //NOTE: Report widget is a superset of biz object widget
// //Biz objects will add and needed linked records here as extra fields with the data included
// //for example instead of a userid only there will be username added to the record
// //so the report designer can just select it as a field, no need to query seperately for it etc
// //REMEMBER: there is a name display format system and it should honour that so that the report
// //displays a user the same as it would display in the UI in an input form, no surprises
// List<Widget> wList = new List<Widget>();
// while (idList.Any())
// {
// var batch = idList.Take(IReportAbleObject.REPORT_DATA_BATCH_SIZE);
// idList = idList.Skip(IReportAbleObject.REPORT_DATA_BATCH_SIZE).ToArray();
// //query for this batch, comes back in db natural order unfortunately
// var batchResults = await ct.Widget.Where(z => batch.Contains(z.Id)).ToArrayAsync();
// //order the results back into original
// var orderedList = from id in batch join z in batchResults on id equals z.Id select z;
// wList.AddRange(orderedList);
// // foreach (Widget w in orderedList)
// // {
// // var jo = JObject.FromObject(w);
// // jo["CustomFields"] = JObject.Parse((string)jo["CustomFields"]);
// // ReportData.Add(jo);
// // }
// }
// return wList.ToArray();
// }
#endregion import export
////////////////////////////////////////////////////////////////////////////////////////////////
//JOB / OPERATIONS
//