This commit is contained in:
2021-01-15 20:42:21 +00:00
parent 6b8d113d3c
commit 64b6e8aa74
4 changed files with 19 additions and 7 deletions

View File

@@ -13,6 +13,9 @@ namespace AyaNova.PickList
internal static async Task<List<NameIdActiveItem>> GetResponseAsync(IAyaPickList PickList, string autoCompleteQuery,
string tagSpecificQuery, bool includeInactive, long[] preIds, string variant, AyContext ct, ILogger log)
{
//This may be called internally in *Biz classes who don't have a log of their own
if (log == null)
log = AyaNova.Util.ApplicationLogging.CreateLogger("PickListFetcher");
//Sort out effective Template
string Template = null;

View File

@@ -488,7 +488,7 @@ namespace AyaNova.Biz
{
List<AyaFormFieldDefinition> l = new List<AyaFormFieldDefinition>();
l.Add(new AyaFormFieldDefinition { TKey = "Name", FieldKey = "Name", Hideable = false });
l.Add(new AyaFormFieldDefinition { TKey = "PartAssemblyName", FieldKey = "Name", Hideable = false });
l.Add(new AyaFormFieldDefinition { TKey = "PartAssemblyNotes", FieldKey = "Notes" });
l.Add(new AyaFormFieldDefinition { TKey = "Active", FieldKey = "Active", Hideable = false });
l.Add(new AyaFormFieldDefinition { TKey = "Tags", FieldKey = "Tags" });

View File

@@ -6,6 +6,7 @@ using AyaNova.Util;
using AyaNova.Api.ControllerHelpers;
using Microsoft.Extensions.Logging;
using AyaNova.Models;
using AyaNova.PickList;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using Newtonsoft.Json;
@@ -102,12 +103,20 @@ namespace AyaNova.Biz
////////////////////////////////////////////////////////////////////////////////////////////////
//GET
//
internal async Task<PartAssembly> GetAsync(long id, bool logTheGetEvent = true)
internal async Task<PartAssembly> GetAsync(long id, bool logTheGetEvent = true, bool populatePartNames = false)
{
//.Include(w => w.Items)
var ret = await ct.PartAssembly.AsNoTracking().Include(z => z.Items).SingleOrDefaultAsync(m => m.Id == id);
if (logTheGetEvent && ret != null)
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, id, BizType, AyaEvent.Retrieved), ct);
if (populatePartNames && ret.Items.Count > 0)
{
var partIdList = ret.Items.Select(z => z.PartId).ToList();
var PickList = PickListFactory.GetAyaPickList(AyaType.Part);
var partNames = await PickListFetcher.GetResponseAsync(PickList, null, null, true, partIdList, null, ct, log);
}
return ret;
}

View File

@@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;
using AyaNova.Biz;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
@@ -19,6 +16,9 @@ namespace AyaNova.Models
[JsonIgnore]
public PartAssembly PartAssembly { get; set; }
[NotMapped]
public string PartDisplay {get;set;}
}//eoc
}//eons