This commit is contained in:
2018-11-30 00:36:16 +00:00
parent 5b3f67ecd9
commit b01c48fa49
4 changed files with 21 additions and 5 deletions

View File

@@ -261,6 +261,9 @@ namespace AyaNova.Biz
var filterItem = v[i]; var filterItem = v[i];
if (filterItem["fld"] == null) if (filterItem["fld"] == null)
AddError(ValidationErrorType.RequiredPropertyEmpty, "Filter", $"Filter array item {i}, object is missing required \"fld\" property "); AddError(ValidationErrorType.RequiredPropertyEmpty, "Filter", $"Filter array item {i}, object is missing required \"fld\" property ");
else{
//todo: find the filteroptions object adn confirm this is a valid value for fld
}
if (filterItem["op"] == null) if (filterItem["op"] == null)
AddError(ValidationErrorType.RequiredPropertyEmpty, "Filter", $"Filter array item {i}, object is missing required \"op\" property "); AddError(ValidationErrorType.RequiredPropertyEmpty, "Filter", $"Filter array item {i}, object is missing required \"op\" property ");
else else

View File

@@ -19,12 +19,12 @@ namespace AyaNova.Biz
public FilterOptions AddField(string FieldName, string LocaleKey, string DataType) public FilterOptions AddField(string FieldName, string LocaleKey, string DataType)
{ {
Flds.Add(new FilterField() { Fld = FieldName, Lt = LocaleKey, Type = DataType }); Flds.Add(new FilterField(FieldName, LocaleKey, DataType));
return this; return this;
} }
internal void Localize(long userLocaleId) internal void Localize(long userLocaleId)
{ {
List<string> keysRequired = new List<string>(); List<string> keysRequired = new List<string>();
foreach (FilterField f in Flds) foreach (FilterField f in Flds)
{ {
@@ -33,7 +33,7 @@ namespace AyaNova.Biz
var trans = LocaleBiz.GetSubsetStatic(keysRequired, userLocaleId).Result; var trans = LocaleBiz.GetSubsetStatic(keysRequired, userLocaleId).Result;
foreach (FilterField f in Flds) foreach (FilterField f in Flds)
{ {
f.Lt=trans[f.Lt]; f.Lt = trans[f.Lt];
} }
} }
} }
@@ -43,5 +43,12 @@ namespace AyaNova.Biz
public string Fld { get; set; } public string Fld { get; set; }
public string Lt { get; set; } public string Lt { get; set; }
public string Type { get; set; } public string Type { get; set; }
public FilterField(string fld, string lt, string type)
{
Fld = fld;
Lt = lt;
Type = type;
}
} }
} }

View File

@@ -16,10 +16,11 @@ namespace AyaNova.Biz
//FILTEROPTIONS COLLECTION //FILTEROPTIONS COLLECTION
FilterOptions FilterOptions { get; } FilterOptions FilterOptions { get; }
List<FilterField> FilterFields {get;}
//VALIDATE FILTER? //VALIDATE FILTER?
} }

View File

@@ -8,7 +8,7 @@ using AyaNova.Util;
using AyaNova.Api.ControllerHelpers; using AyaNova.Api.ControllerHelpers;
using AyaNova.Biz; using AyaNova.Biz;
using AyaNova.Models; using AyaNova.Models;
using System.Collections.Generic;
namespace AyaNova.Biz namespace AyaNova.Biz
{ {
@@ -33,6 +33,11 @@ namespace AyaNova.Biz
} }
} }
public static List<FilterField> FilterFields(){
List<FilterField> fields=new List<FilterField>();
fields.Add(new FilterField())
}
internal WidgetBiz(AyContext dbcontext, long currentUserId, long userLocaleId, AuthorizationRoles UserRoles) internal WidgetBiz(AyContext dbcontext, long currentUserId, long userLocaleId, AuthorizationRoles UserRoles)
{ {
ct = dbcontext; ct = dbcontext;