This commit is contained in:
@@ -161,7 +161,7 @@ namespace AyaNova.Biz
|
||||
await ValidateCanDeleteAsync(dbObject);
|
||||
if (HasErrors)
|
||||
return false;
|
||||
{
|
||||
{
|
||||
var IDList = await ct.Review.AsNoTracking().Where(x => x.AType == AyaType.Part && x.ObjectId == id).Select(x => x.Id).ToListAsync();
|
||||
if (IDList.Count() > 0)
|
||||
{
|
||||
@@ -512,6 +512,7 @@ namespace AyaNova.Biz
|
||||
var batchResults = await ct.Part.AsNoTracking().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;
|
||||
batchResults = null;
|
||||
foreach (Part w in orderedList)
|
||||
{
|
||||
if (!ReportRenderManager.KeepGoing(jobId)) return null;
|
||||
@@ -521,21 +522,37 @@ namespace AyaNova.Biz
|
||||
jo["CustomFields"] = JObject.Parse((string)jo["CustomFields"]);
|
||||
ReportData.Add(jo);
|
||||
}
|
||||
orderedList = null;
|
||||
}
|
||||
vc.Clear();
|
||||
return ReportData;
|
||||
}
|
||||
private VizCache vc = new VizCache();
|
||||
|
||||
//populate viz fields from provided object
|
||||
private async Task PopulateVizFields(Part o)
|
||||
{
|
||||
if (o.WholeSalerId != null)
|
||||
o.WholeSalerViz = await ct.Vendor.AsNoTracking().Where(x => x.Id == o.WholeSalerId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
if (o.ManufacturerId != null)
|
||||
o.ManufacturerViz = await ct.Vendor.AsNoTracking().Where(x => x.Id == o.ManufacturerId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
if (o.AlternativeWholeSalerId != null)
|
||||
o.AlternativeWholeSalerViz = await ct.Vendor.AsNoTracking().Where(x => x.Id == o.AlternativeWholeSalerId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||
{
|
||||
if (!vc.Has("vendorname", o.WholeSalerId))
|
||||
vc.Add(await ct.Vendor.AsNoTracking().Where(x => x.Id == o.WholeSalerId).Select(x => x.Name).FirstOrDefaultAsync(), "vendorname", o.WholeSalerId);
|
||||
o.WholeSalerViz = vc.Get("vendorname", o.WholeSalerId);
|
||||
}
|
||||
|
||||
if (o.ManufacturerId != null)
|
||||
{
|
||||
if (!vc.Has("vendorname", o.ManufacturerId))
|
||||
vc.Add(await ct.Vendor.AsNoTracking().Where(x => x.Id == o.ManufacturerId).Select(x => x.Name).FirstOrDefaultAsync(), "vendorname", o.ManufacturerId);
|
||||
o.ManufacturerViz = vc.Get("vendorname", o.ManufacturerId);
|
||||
}
|
||||
|
||||
if (o.AlternativeWholeSalerId != null)
|
||||
{
|
||||
if (!vc.Has("vendorname", o.AlternativeWholeSalerId))
|
||||
vc.Add(await ct.Vendor.AsNoTracking().Where(x => x.Id == o.AlternativeWholeSalerId).Select(x => x.Name).FirstOrDefaultAsync(), "vendorname", o.AlternativeWholeSalerId);
|
||||
o.AlternativeWholeSalerViz = vc.Get("vendorname", o.AlternativeWholeSalerId);
|
||||
}
|
||||
|
||||
|
||||
//if there turns out to be a situation where there are just too many serials slowing down the reporting always
|
||||
//can look at tying this to the report data list column selection to check if serials are selected to display or not
|
||||
o.PartSerialsViz = string.Join(", ", (await ct.PartSerial.Where(z => z.PartId == o.Id).OrderBy(z => z.Serial).Select(z => z.Serial).ToListAsync()));
|
||||
|
||||
Reference in New Issue
Block a user