This commit is contained in:
2021-09-09 00:06:16 +00:00
parent 220f185418
commit 4f70082d09
4 changed files with 31 additions and 14 deletions

View File

@@ -11,20 +11,27 @@ namespace AyaNova.PickList
internal static class PickListFetcher
{
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, string overrideTemplate)
{
//Sort out effective Template
string Template = null;
//Attempt to fetch custom template
var t = await ct.PickListTemplate.FirstOrDefaultAsync(z => z.Id == ((long)PickList.DefaultListAType));
if (t == null)
if (string.IsNullOrWhiteSpace(overrideTemplate))
{
Template = PickList.DefaultTemplate;
//Attempt to fetch custom template
var t = await ct.PickListTemplate.FirstOrDefaultAsync(z => z.Id == ((long)PickList.DefaultListAType));
if (t == null)
{
Template = PickList.DefaultTemplate;
}
else
{
Template = t.Template;
}
}
else
{
Template = t.Template;
Template = overrideTemplate;
}
//parse the template
@@ -77,7 +84,7 @@ namespace AyaNova.PickList
log.LogError(e, "DB Exception");
throw new System.Exception("PickListFetcher - Query failed see log");
}
catch (System.Exception e)
catch (System.Exception e)
{
//ensure any other type of exception gets surfaced properly
//log out the exception and the query