This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user