This commit is contained in:
@@ -109,7 +109,7 @@ TODO SERVER STUFF
|
||||
- Maybe a db stored procedure and trigger or biz code that feeds a consolidated tag table of all entered tags in the system?
|
||||
- Maybe a reference count for each tag to drive a tag cloud feature and also a order by commonality feature when offering and also to know when to remove the tag repository when no one is using that tag anymore in any records
|
||||
|
||||
|
||||
- Boot server and seed with debug log turned on, see what is being tracked by EF that doesn't need to, seems some of that shit is being tracked.
|
||||
|
||||
-----------------
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace AyaNova
|
||||
bool LOG_SENSITIVE_DATA = false;
|
||||
|
||||
#if (DEBUG)
|
||||
//LOG_SENSITIVE_DATA = true;
|
||||
LOG_SENSITIVE_DATA = true;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,15 +1,8 @@
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.JsonPatch;
|
||||
using EnumsNET;
|
||||
using AyaNova.Util;
|
||||
using AyaNova.Api.ControllerHelpers;
|
||||
using AyaNova.Biz;
|
||||
using AyaNova.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
|
||||
namespace AyaNova.Biz
|
||||
@@ -19,8 +12,9 @@ namespace AyaNova.Biz
|
||||
|
||||
internal static PickListResult GetPickList(AyContext ct, long userId, PagingOptions pagingOptions, string tableName)
|
||||
{
|
||||
|
||||
|
||||
List<NameIdItem> listItems = new List<NameIdItem>();
|
||||
int recordCount = 0;
|
||||
|
||||
using (var cm = ct.Database.GetDbConnection().CreateCommand())
|
||||
{
|
||||
@@ -29,7 +23,15 @@ namespace AyaNova.Biz
|
||||
|
||||
//BUILD THE QUERY
|
||||
//base query
|
||||
var q = $"SELECT id, name FROM {tableName} ";
|
||||
string qItemBase = string.Empty;
|
||||
string qCountBase = string.Empty;
|
||||
string qCriteria = string.Empty;
|
||||
string qSort = string.Empty;
|
||||
// string q = string.Empty;
|
||||
|
||||
qItemBase = $"SELECT id, name FROM {tableName} ";
|
||||
qCountBase = $"SELECT COUNT(*) FROM {tableName} ";
|
||||
|
||||
|
||||
//GET THE FILTER / SORT
|
||||
if (pagingOptions.DataFilterId > 0)
|
||||
@@ -37,30 +39,41 @@ namespace AyaNova.Biz
|
||||
var TheFilter = ct.DataFilter.FirstOrDefault(x => x.Id == pagingOptions.DataFilterId);
|
||||
|
||||
//BUILD WHERE AND APPEND IT
|
||||
q = q + FilterSqlCriteriaBuilder.DataFilterToSQLCriteria(TheFilter, WidgetBiz.FilterOptions(), userId);
|
||||
qCriteria = FilterSqlCriteriaBuilder.DataFilterToSQLCriteria(TheFilter, WidgetBiz.FilterOptions(), userId);
|
||||
|
||||
//BUILD ORDER BY AND APPEND IT
|
||||
q = q + FilterSqlOrderByBuilder.DataFilterToSQLOrderBy(TheFilter);
|
||||
qSort = FilterSqlOrderByBuilder.DataFilterToSQLOrderBy(TheFilter);
|
||||
}
|
||||
else
|
||||
{
|
||||
//GET DEFAULT ORDER BY
|
||||
q = q + FilterSqlOrderByBuilder.DefaultOrderBy();
|
||||
qSort= FilterSqlOrderByBuilder.DefaultOrderBy();
|
||||
}
|
||||
|
||||
cm.CommandText = q;
|
||||
//ITEMS
|
||||
//add the limit and offset values:
|
||||
|
||||
cm.CommandText = qItemBase + qCriteria + qSort + $" LIMIT {pagingOptions.Limit} OFFSET {pagingOptions.Offset}";
|
||||
using (var dr = cm.ExecuteReader())
|
||||
{
|
||||
{
|
||||
while (dr.Read())
|
||||
{
|
||||
listItems.Add(new NameIdItem() { Id = dr.GetInt64(0), Name = dr.GetString(1) });
|
||||
}
|
||||
listItems.Add(new NameIdItem() { Id = dr.GetInt64(0), Name = dr.GetString(1) });
|
||||
}
|
||||
}
|
||||
|
||||
//TOTAL RECORD COUNT
|
||||
cm.CommandText = qCountBase + qCriteria;
|
||||
using (var dr = cm.ExecuteReader())
|
||||
{
|
||||
dr.Read();
|
||||
recordCount = dr.GetInt32(0);
|
||||
}
|
||||
}
|
||||
|
||||
PickListResult ret = new PickListResult();
|
||||
ret.Items = listItems.ToArray();
|
||||
ret.TotalRecordCount = 9999;
|
||||
ret.TotalRecordCount = recordCount;
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -97,7 +110,15 @@ namespace AyaNova.Biz
|
||||
// }
|
||||
|
||||
|
||||
/*
|
||||
2018-12-12 16:29:12.7547|INFO|Microsoft.EntityFrameworkCore.Database.Command|Executed DbCommand (3ms) [Parameters=[@__p_2='999', @__p_1='0'], CommandType='Text', CommandTimeout='30']
|
||||
SELECT a.id, a.active, a.xmin, a.count, a.dollaramount, a.enddate, a.name, a.notes, a.ownerid, a.roles, a.serial, a.startdate, a.tags
|
||||
FROM (
|
||||
SELECT *, xmin FROM AWIDGET where (name Like 'SortByFieldAscendingWorks 1544660950941%') ORDER BY startdate ASC
|
||||
) AS a
|
||||
LIMIT @__p_2 OFFSET @__p_1
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace raven_integration
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user