This commit is contained in:
2020-03-13 19:28:54 +00:00
parent d6d69b4a0c
commit 75b18e0f0e
5 changed files with 28 additions and 6 deletions

View File

@@ -8,6 +8,9 @@ namespace AyaNova.PickList
//This class defines a field used for returning data in list format for UI pick lists
public class AyaPickListFieldDefinition
{
//TODO: Many of these options are redundant for a picklist as this object was copied from datalist
//TODO: remove the redundant options once it's working
//CLIENT / SERVER Unique identifier used at BOTH client and server
//also the sql displaycolumnname if identical
public string FieldKey { get; set; }
@@ -34,6 +37,7 @@ namespace AyaNova.PickList
//MUST be present in all datalists and displayed at the client
public bool IsRowId { get; set; }
//CLIENT / SERVER - client display and to indicate what object to open , Server for formatting return object
public int AyaObjectType { get; set; }

View File

@@ -6,6 +6,8 @@ namespace AyaNova.PickList
internal interface IAyaPickList
{
//Item has an active column
//sql query from fragment with table joins et
string SQLFrom { get; set; }

View File

@@ -15,6 +15,8 @@ namespace AyaNova.PickList
{
internal static class PickListFetcher
{
internal static async Task<List<NameIdActiveItem>> GetResponseAsync(AyaType ayaType, string autoCompleteQuery, AyContext ct, AuthorizationRoles userRoles)
{

View File

@@ -12,13 +12,18 @@ namespace AyaNova.PickList
internal static class PickListSqlBuilder
{
//Maximum number of results to return at any given time
//did a little research and may adjust this but it can be fairly girthy in this day and age
//and many people might not want or need to autocomplete type if we provide enough leeway.
//for example, if you're selecting a
const int MAXIMUM_RESULT_COUNT = 100;
//Build the query for a picklist request
internal static string Build(IAyaPickList pickList, List<string> templateColumnNames, string autoCompleteQuery)
internal static string Build(IAyaPickList pickList, List<string> templateColumnNames, string autoCompleteQuery, bool IncludeInactive)
{
//TODO: if no autocompletequery returns the first XX results without querying in natural order by column names
//if autocomplete returns teh first XX results with query in natural order by column names
//TODO: if no autocompletequery returns the first XX results without querying in natural order by column names
//if autocomplete returns teh first XX results with query in natural order by column names
//TODO: build a sql List<AyaPickListFieldDefinition> columnDefinitionsselect and order by and a where clause that searches appropriately in each field (tags)
//it should return results based on the query where there is a single name (display) column and an id column for rowid
@@ -47,9 +52,9 @@ namespace AyaNova.PickList
{//Ignore missing fields in production
var valueColumnName = o.GetSqlValueColumnName();
lSelect.Add(valueColumnName);
string sWhere=$"{valueColumnName} LIKE '%{autoCompleteQuery"
lSelect.Add(valueColumnName);
string sWhere = $"{valueColumnName} LIKE '%{autoCompleteQuery"

View File

@@ -33,6 +33,14 @@ namespace AyaNova.PickList
ColumnDefinitions = new List<AyaPickListFieldDefinition>();
//DEPRECATED: FieldDefinitions.Add(new AyaPickListFieldDefinition { FieldKey = "df", AyaObjectType = (int)AyaType.Widget, SqlIdColumnName = "awidget.id", IsFilterable = false, IsSortable = false, });
ColumnDefinitions.Add(new AyaPickListFieldDefinition
{
LtKey = "Active",
FieldKey = "widgetactive",
UiFieldDataType = (int)UiFieldDataType.Bool,
SqlValueColumnName = "awidget.active"
});
ColumnDefinitions.Add(new AyaPickListFieldDefinition
{
LtKey = "WidgetName",
@@ -70,6 +78,7 @@ namespace AyaNova.PickList
SqlValueColumnName = "awidget.tags"
});
}
}//eoc
}//eons