This commit is contained in:
2020-03-16 22:25:27 +00:00
parent 85ddf8bd7b
commit a5e805c858
3 changed files with 39 additions and 24 deletions

View File

@@ -58,8 +58,43 @@ namespace AyaNova.Biz
//get picklist
internal async Task<List<NameIdActiveItem>> GetPickListAsync(AyaType ayaType, string query, bool inactive, AuthorizationRoles userRoles)
{
//Crack and validate the query part set a broken rule if not valid and return null
//else do the query
string TagSpecificQuery = null;
string AutoCompleteQuery = null;
List<NameIdActiveItem> items = await PickListFetcher.GetResponseAsync(ayaType, query, inactive, ct, userRoles);
//Here need to handle scenario of badly formed query so user knows they did it wrong and doesn't just assume it's not there
//determine if this is a tag query
bool HasAutoCompleteQuery = !string.IsNullOrWhiteSpace(query);
if (HasAutoCompleteQuery)
{
if (AutoCompleteQuery.Contains(" "))
{
// split the query on space
var querySegments = AutoCompleteQuery.Split(' ');
// users may type several spaces in a regular query, so ignore that and only use the first two segments
if (querySegments[0].Contains(".."))
{
TagSpecificQuery = querySegments[0].Replace("..", "");
// the second string is considered the
AutoCompleteQuery = querySegments[1];
}
else
{
}
}
else
{
//just a regular query
}
}
List<NameIdActiveItem> items = await PickListFetcher.GetResponseAsync(ayaType, AutoCompleteQuery, TagSpecificQuery, inactive, ct, userRoles);
return items;
}