This commit is contained in:
18
server/AyaNova/biz/IReportAbleObject.cs
Normal file
18
server/AyaNova/biz/IReportAbleObject.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using AyaNova.Models;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
namespace AyaNova.Biz
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interface for biz objects that support reporting
|
||||||
|
/// </summary>
|
||||||
|
internal interface IReportAbleObject
|
||||||
|
{
|
||||||
|
|
||||||
|
//Get items indicated in id list in report format
|
||||||
|
//called by ReportBiz rendering code
|
||||||
|
Task<JArray> GetReportData(long[] idList);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -267,7 +267,8 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
|
|
||||||
//Get data
|
//Get data
|
||||||
|
var biz = BizObjectFactory.GetBizObject(report.ObjectType, ct);
|
||||||
|
var data = ((IReportAbleObject)biz).GetReportData(objectidarray);
|
||||||
|
|
||||||
//initialization
|
//initialization
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
namespace AyaNova.Biz
|
namespace AyaNova.Biz
|
||||||
{
|
{
|
||||||
internal class WidgetBiz : BizObject, IJobObject, ISearchAbleObject
|
internal class WidgetBiz : BizObject, IJobObject, ISearchAbleObject, IReportAbleObject
|
||||||
{
|
{
|
||||||
internal WidgetBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
internal WidgetBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
||||||
{
|
{
|
||||||
@@ -283,6 +283,20 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<JArray> GetReportData(long[] idList)
|
||||||
|
{
|
||||||
|
JArray j = new JArray();
|
||||||
|
while (idList.Any())
|
||||||
|
{
|
||||||
|
var batch = idList.Take(100);
|
||||||
|
idList = idList.Skip(100).ToArray();
|
||||||
|
var res = await ct.Widget.Where(z => idList.Contains(z.Id)).ToArrayAsync();
|
||||||
|
foreach(Widget w in res){
|
||||||
|
j.Add(w);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return j;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//JOB / OPERATIONS
|
//JOB / OPERATIONS
|
||||||
@@ -358,6 +372,8 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|||||||
Reference in New Issue
Block a user