This commit is contained in:
2018-12-04 00:36:32 +00:00
parent a5f32466ef
commit aaf21ce881
5 changed files with 23 additions and 19 deletions

View File

@@ -98,7 +98,7 @@ namespace AyaNova
bool LOG_SENSITIVE_DATA = false;
#if (DEBUG)
LOG_SENSITIVE_DATA = true;
//LOG_SENSITIVE_DATA = true;
#endif
@@ -434,7 +434,7 @@ namespace AyaNova
//to support html5 pushstate routing in spa
//this ensures that a refresh at the client will not 404 but rather force back to the index.html app page and then handled internally by the client
await next();
if (context.Request.Path.Value!= "/docs" && context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value))
if (context.Request.Path.Value != "/docs" && context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value))
{
context.Request.Path = "/index.html";
context.Response.StatusCode = 200;

View File

@@ -8,10 +8,7 @@ namespace AyaNova.Biz
{
public static class FilterSqlCriteriaBuilder
{
//"SELECT *, xmin FROM AWIDGET name Like 'BoolDataFilterTest%' AND active = true AND "
public static string DataFilterToSQLCriteria(AyaNova.Models.DataFilter dataFilter, FilterOptions filterOptions)
{
@@ -34,9 +31,13 @@ namespace AyaNova.Biz
var dataType = filterOptions.Flds.Find(x => x.Fld == fld).Type;
sb.Append(DataFilterToColumnCriteria(fld, dataType, opType, val));
if (i < FilterArray.Count - 1)
{
sb.Append(" AND ");
}
}
return sb.ToString();
return " where " + sb.ToString();
}
/// <summary>
@@ -783,9 +784,6 @@ namespace AyaNova.Biz
#endregion
}//end of nonnull path
//
//if(log.IsDebugEnabled)
// //case 1039 //log.Debug("GridToSqlCriteria: returning[" + sb.ToString() + "]");
return sb.ToString();

View File

@@ -159,7 +159,7 @@ namespace AyaNova.Biz
//If no datafilter then it can just run this regular code which already works, I think?
//no, order by is brokeh
pagingOptions.Offset = pagingOptions.Offset ?? PagingOptions.DefaultOffset;
pagingOptions.Limit = pagingOptions.Limit ?? PagingOptions.DefaultLimit;
@@ -174,11 +174,17 @@ namespace AyaNova.Biz
//base query
var q = "SELECT *, xmin FROM AWIDGET ";
//BUILD WHERE AND APPEND IT
q=q+FilterSqlCriteriaBuilder.DataFilterToSQLCriteria(theFilter,WidgetBiz.FilterOptions);
//GET THE FILTER
if (pagingOptions.DataFilterId > 0)
{
var TheFilter = await ct.DataFilter.FirstOrDefaultAsync(x => x.Id == pagingOptions.DataFilterId);
//BUILD WHERE AND APPEND IT
q = q + FilterSqlCriteriaBuilder.DataFilterToSQLCriteria(TheFilter, WidgetBiz.FilterOptions());
}
//BUILD ORDER BY AND APPEND IT
//TODO: Code a separate order by builder block
var items = await ct.Widget
.AsNoTracking()