This commit is contained in:
@@ -1035,14 +1035,9 @@ namespace AyaNova.Biz
|
||||
//order the results back into original
|
||||
var orderedList = from id in batch join z in batchResults on id equals z.Id select z;
|
||||
|
||||
//cache frequent viz data
|
||||
//usertypes
|
||||
var UserTypesEnumList = await AyaNova.Api.Controllers.EnumListController.GetEnumList(
|
||||
StringUtil.TrimTypeName(typeof(UserType).ToString()),
|
||||
UserTranslationId,
|
||||
CurrentUserRoles);
|
||||
|
||||
//foreach (User w in orderedList)
|
||||
|
||||
batchResults = null;
|
||||
foreach (var w in orderedList)
|
||||
{
|
||||
if (!ReportRenderManager.KeepGoing(jobId)) return null;
|
||||
@@ -1056,24 +1051,48 @@ namespace AyaNova.Biz
|
||||
|
||||
ReportData.Add(jo);
|
||||
}
|
||||
orderedList = null;
|
||||
}
|
||||
vc.Clear();
|
||||
return ReportData;
|
||||
}
|
||||
private VizCache vc = new VizCache();
|
||||
|
||||
//populate viz fields from provided object
|
||||
private async Task PopulateVizFields(User o, List<NameIdItem> userTypesEnumList)
|
||||
{
|
||||
if (userTypesEnumList == null)
|
||||
userTypesEnumList = await AyaNova.Api.Controllers.EnumListController.GetEnumList(
|
||||
StringUtil.TrimTypeName(typeof(UserType).ToString()),
|
||||
UserTranslationId,
|
||||
CurrentUserRoles);
|
||||
|
||||
if (o.CustomerId != null)
|
||||
o.CustomerViz = await ct.Customer.AsNoTracking().Where(x => x.Id == o.CustomerId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
{
|
||||
if (!vc.Has("customer", o.CustomerId))
|
||||
vc.Add(await ct.Customer.AsNoTracking().Where(x => x.Id == o.CustomerId).Select(x => x.Name).FirstOrDefaultAsync(), "customer", o.CustomerId);
|
||||
o.CustomerViz = vc.Get("customer", o.CustomerId);
|
||||
}
|
||||
|
||||
if (o.HeadOfficeId != null)
|
||||
o.HeadOfficeViz = await ct.HeadOffice.AsNoTracking().Where(x => x.Id == o.HeadOfficeId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
{
|
||||
if (!vc.Has("headoffice", o.HeadOfficeId))
|
||||
{
|
||||
vc.Add(await ct.HeadOffice.AsNoTracking().Where(x => x.Id == o.HeadOfficeId).Select(x => x.Name).FirstOrDefaultAsync(), "headoffice", o.HeadOfficeId);
|
||||
}
|
||||
o.HeadOfficeViz = vc.Get("headoffice", o.HeadOfficeId);
|
||||
}
|
||||
|
||||
if (o.VendorId != null)
|
||||
o.VendorViz = await ct.Vendor.AsNoTracking().Where(x => x.Id == o.VendorId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
{
|
||||
if (!vc.Has("vendorname", o.VendorId))
|
||||
vc.Add(await ct.Vendor.AsNoTracking().Where(x => x.Id == o.VendorId).Select(x => x.Name).FirstOrDefaultAsync(), "vendorname", o.VendorId);
|
||||
o.VendorViz = vc.Get("vendorname", o.VendorId);
|
||||
}
|
||||
|
||||
o.UserTypeViz = userTypesEnumList.Where(x => x.Id == (long)o.UserType).Select(x => x.Name).First();
|
||||
}
|
||||
List<NameIdItem> UserTypesEnumList = null;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// IMPORT EXPORT
|
||||
|
||||
Reference in New Issue
Block a user