From 1d9e778ced97767dc53a9539bb777b6c8720a508 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 26 Oct 2020 22:50:36 +0000 Subject: [PATCH] --- .../AyaNova/Controllers/ImportController.cs | 6 --- server/AyaNova/biz/WidgetBiz.cs | 45 ++++--------------- 2 files changed, 9 insertions(+), 42 deletions(-) diff --git a/server/AyaNova/Controllers/ImportController.cs b/server/AyaNova/Controllers/ImportController.cs index 54da3e83..2c0195a4 100644 --- a/server/AyaNova/Controllers/ImportController.cs +++ b/server/AyaNova/Controllers/ImportController.cs @@ -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 { diff --git a/server/AyaNova/biz/WidgetBiz.cs b/server/AyaNova/biz/WidgetBiz.cs index d8074c2f..0dcaba3a 100644 --- a/server/AyaNova/biz/WidgetBiz.cs +++ b/server/AyaNova/biz/WidgetBiz.cs @@ -316,8 +316,12 @@ namespace AyaNova.Biz - #region IMPORT EXPORT - //Get data for export + + //////////////////////////////////////////////////////////////////////////////////////////////// + // IMPORT EXPORT + // + + public async Task 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 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 wList = new List(); - // 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 //