This commit is contained in:
2020-03-17 18:13:46 +00:00
parent 54efbd9df8
commit 05bd6db5c6
11 changed files with 26 additions and 44 deletions

View File

@@ -1,7 +1,6 @@
using System.Collections.Generic;
using AyaNova.Biz;
using Newtonsoft.Json.Linq;
namespace AyaNova.PickList
{
/// <summary>
@@ -10,7 +9,7 @@ namespace AyaNova.PickList
internal abstract class AyaPickList : IAyaPickList
{
public AyaPickList()
{}
{ }
public string SQLFrom { get; set; }
public List<AyaPickListFieldDefinition> ColumnDefinitions { get; set; }
public AuthorizationRoles AllowedRoles { get; set; }
@@ -18,7 +17,7 @@ namespace AyaNova.PickList
public string DefaultTemplate { get; set; }
//return array of field keys in list view
public List<string> GetFieldListFromTemplate(JArray template)
{
{
List<string> ret = new List<string>();
for (int i = 0; i < template.Count; i++)
{

View File

@@ -1,11 +1,8 @@
using AyaNova.Biz;
using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json;
namespace AyaNova.PickList
{
//This class defines a field used for returning data in list format for UI pick lists
//This class defines a field used for pick list templating querying processing editing and returning
public class AyaPickListFieldDefinition
{
//CLIENT / SERVER Unique identifier used at BOTH client and server
@@ -27,9 +24,7 @@ namespace AyaNova.PickList
{
//most common defaults
IsRowId = false;
IsActiveColumn = false;
// AyaObjectType = (int)AyaType.NoType;
IsActiveColumn = false;
}
//Get column to query for display name or use FieldName if there is no difference
@@ -44,11 +39,5 @@ namespace AyaNova.PickList
return SqlValueColumnName;
}
}
// public bool HasIdColumn()
// {
// return !string.IsNullOrWhiteSpace(SqlIdColumnName);
// }
}
}

View File

@@ -13,8 +13,11 @@ namespace AyaNova.PickList
{
switch (ayaType)
{
//CoreBizObject add here
case AyaType.Widget:
return new WidgetPickList() as IAyaPickList;
case AyaType.User:
return new UserPickList() as IAyaPickList;
}
return null;
}
@@ -33,9 +36,7 @@ namespace AyaNova.PickList
TranslationKeysToFetch.Add(name);
ret.Add(new NameIdItem() { Name = name, Id = (long)t });
}
}
var LT = TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, TranslationId).Result;
foreach (NameIdItem i in ret)
{
@@ -43,7 +44,5 @@ namespace AyaNova.PickList
}
return ret;
}
}//eoc
}//eons

View File

@@ -11,11 +11,8 @@ namespace AyaNova.PickList
DefaultListObjectType = AyaType.User;
SQLFrom = "from auser";
AllowedRoles = BizRoles.GetRoleSet(DefaultListObjectType).Select;
//Default template
dynamic dTemplate = new JArray();
dynamic cm = new JObject();
cm.fld = "username";
dTemplate.Add(cm);
@@ -30,9 +27,8 @@ namespace AyaNova.PickList
base.DefaultTemplate = dTemplate.ToString(Newtonsoft.Json.Formatting.None);
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined (in this case User) table need to be specified completely
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined table need to be specified completely
ColumnDefinitions = new List<AyaPickListFieldDefinition>();
ColumnDefinitions.Add(new AyaPickListFieldDefinition
{
LtKey = "Active",
@@ -41,7 +37,6 @@ namespace AyaNova.PickList
SqlValueColumnName = "auser.active",
IsActiveColumn = true
});
ColumnDefinitions.Add(new AyaPickListFieldDefinition
{
LtKey = "UserName",
@@ -51,7 +46,6 @@ namespace AyaNova.PickList
SqlValueColumnName = "auser.name",
IsRowId = true
});
ColumnDefinitions.Add(new AyaPickListFieldDefinition
{
LtKey = "UserEmployeeNumber",
@@ -60,7 +54,6 @@ namespace AyaNova.PickList
SqlValueColumnName = "auser.employeenumber"
});
ColumnDefinitions.Add(new AyaPickListFieldDefinition
{
LtKey = "Tags",
@@ -68,8 +61,6 @@ namespace AyaNova.PickList
ColumnDataType = UiFieldDataType.Tags,
SqlValueColumnName = "auser.tags"
});
}
}//eoc
}//eons

View File

@@ -7,7 +7,6 @@ namespace AyaNova.PickList
{
public WidgetPickList()
{
DefaultListObjectType = AyaType.Widget;
SQLFrom = "from awidget left outer join auser on (awidget.userid=auser.id)";
AllowedRoles = BizRoles.GetRoleSet(DefaultListObjectType).Select;
@@ -31,8 +30,6 @@ namespace AyaNova.PickList
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined (in this case User) table need to be specified completely
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",
@@ -77,8 +74,6 @@ namespace AyaNova.PickList
ColumnDataType = UiFieldDataType.Tags,
SqlValueColumnName = "awidget.tags"
});
}
}//eoc
}//eons