This commit is contained in:
2020-01-22 20:58:28 +00:00
parent abb5051826
commit 23c0264127
3 changed files with 73 additions and 47 deletions

View File

@@ -27,7 +27,7 @@ namespace AyaNova.DataList
//check rights
if (listOptions.Mini)
{
{
if (!UserRoles.HasAnyFlags(DataList.MiniListAllowedRoles))
throw new System.UnauthorizedAccessException("User roles insufficient for this mini format datalist");
}
@@ -82,7 +82,7 @@ namespace AyaNova.DataList
{
TheFilter = await ct.DataListFilter.FirstOrDefaultAsync(x => x.Id == listOptions.DataFilterId);
//WHERE CLAUSE - FILTER
qWhere = DataListSqlFilterCriteriaBuilder.DataFilterToSQLCriteria(TheFilter, DataList.FieldDefinitions, UserId);
qWhere = DataListSqlFilterCriteriaBuilder.DataFilterToSQLCriteria(DataList.FieldDefinitions, TheFilter, DataList.FieldDefinitions, UserId);
//ORDER BY CLAUSE - SORT
//BUILD ORDER BY AND APPEND IT
qOrderBy = DataListSqlFilterOrderByBuilder.DataFilterToSQLOrderBy(TheFilter);
@@ -129,7 +129,16 @@ namespace AyaNova.DataList
//PROCESS THE DF DEFAULT FIRST COLUMN
//first column is always the underlying id value of the default record to open for this row in the client ui
row.Add(new AyaFieldData() { v = dr.GetInt64(0) });
if (!dr.IsDBNull(0))
{
row.Add(new AyaFieldData() { v = dr.GetInt64(0) });
}
else
{
#if (DEBUG)
throw new System.ArgumentNullException($"DEV ERROR in DataListFetcher.cs: fetching df column for {DataListKey} df value is null, expecting long int record value");
#endif
}
//GetOrdinal by name is flakey in npgsql so just going by field definition and ordinal numerically
int nCurrentColumnPointer = 1;//start at 1
@@ -146,7 +155,9 @@ namespace AyaNova.DataList
if (f.SqlIdColumnName != null)//skip over df column id, it's not there
{
AyaField.i = dr.GetInt64(nCurrentColumnPointer);
if (!dr.IsDBNull(nCurrentColumnPointer))
AyaField.i = dr.GetInt64(nCurrentColumnPointer);
nCurrentColumnPointer++;
}
row.Add(AyaField);