This commit is contained in:
@@ -13,6 +13,9 @@ namespace AyaNova.PickList
|
|||||||
internal static async Task<List<NameIdActiveItem>> GetResponseAsync(IAyaPickList PickList, string autoCompleteQuery,
|
internal static async Task<List<NameIdActiveItem>> GetResponseAsync(IAyaPickList PickList, string autoCompleteQuery,
|
||||||
string tagSpecificQuery, bool includeInactive, long[] preIds, string variant, AyContext ct, ILogger log)
|
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
|
//Sort out effective Template
|
||||||
string Template = null;
|
string Template = null;
|
||||||
|
|||||||
@@ -488,7 +488,7 @@ namespace AyaNova.Biz
|
|||||||
{
|
{
|
||||||
|
|
||||||
List<AyaFormFieldDefinition> l = new List<AyaFormFieldDefinition>();
|
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 = "PartAssemblyNotes", FieldKey = "Notes" });
|
||||||
l.Add(new AyaFormFieldDefinition { TKey = "Active", FieldKey = "Active", Hideable = false });
|
l.Add(new AyaFormFieldDefinition { TKey = "Active", FieldKey = "Active", Hideable = false });
|
||||||
l.Add(new AyaFormFieldDefinition { TKey = "Tags", FieldKey = "Tags" });
|
l.Add(new AyaFormFieldDefinition { TKey = "Tags", FieldKey = "Tags" });
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using AyaNova.Util;
|
|||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
using AyaNova.PickList;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -102,12 +103,20 @@ namespace AyaNova.Biz
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//GET
|
//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);
|
var ret = await ct.PartAssembly.AsNoTracking().Include(z => z.Items).SingleOrDefaultAsync(m => m.Id == id);
|
||||||
if (logTheGetEvent && ret != null)
|
if (logTheGetEvent && ret != null)
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, id, BizType, AyaEvent.Retrieved), ct);
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +136,7 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
putObject.Tags = TagBiz.NormalizeTags(putObject.Tags);
|
putObject.Tags = TagBiz.NormalizeTags(putObject.Tags);
|
||||||
putObject.CustomFields = JsonUtil.CompactJson(putObject.CustomFields);
|
putObject.CustomFields = JsonUtil.CompactJson(putObject.CustomFields);
|
||||||
await ValidateAsync(putObject, dbObject);
|
await ValidateAsync(putObject, dbObject);
|
||||||
if (HasErrors) return null;
|
if (HasErrors) return null;
|
||||||
ct.Replace(dbObject, putObject);
|
ct.Replace(dbObject, putObject);
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using AyaNova.Biz;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -19,6 +16,9 @@ namespace AyaNova.Models
|
|||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public PartAssembly PartAssembly { get; set; }
|
public PartAssembly PartAssembly { get; set; }
|
||||||
|
|
||||||
|
[NotMapped]
|
||||||
|
public string PartDisplay {get;set;}
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|
||||||
}//eons
|
}//eons
|
||||||
Reference in New Issue
Block a user