This commit is contained in:
2020-02-26 18:46:32 +00:00
parent a5b3444e4b
commit 1a36dad3e9
10 changed files with 70 additions and 73 deletions

View File

@@ -72,7 +72,7 @@ namespace AyaNova.DataList
qTotalRecordsQuery = $"SELECT COUNT(*) {qFrom} {qWhere}".Replace(" ", " ");
//RETURN OBJECTS
int returnRowColumnCount = ListViewFieldList.Count();// + 1;//Templates don't have the DF column in them but we need it and it's in the query so plus one
int returnRowColumnCount = ListViewFieldList.Count();
List<List<AyaFieldData>> rows = new List<List<AyaFieldData>>();
long totalRecordCount = 0;
@@ -89,28 +89,11 @@ namespace AyaNova.DataList
{
List<AyaFieldData> row = new List<AyaFieldData>(returnRowColumnCount);
//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
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
// dr.GetOrdinal();
// dr.GetName();
//INSERT REMAINING FIELDS FROM TEMPLATE INTO THE RETURN ROWS LIST
foreach (string TemplateField in ListViewFieldList)
{
if (TemplateField == "df")
continue;
//get the AyaObjectFieldDefinition
AyaDataListFieldDefinition f = DataList.FieldDefinitions.FirstOrDefault(x => x.FieldKey == TemplateField);
if (f.IsCustomField)
@@ -150,15 +133,14 @@ dr.GetOrdinal("customfields");
{
AyaFieldData AyaField = new AyaFieldData();
AyaField.v = dr.GetValue(SelectBuild.map[f.GetSqlValueColumnName()]);
//nCurrentColumnPointer++;
if (f.SqlIdColumnName != null)//skip over df column id, it's not there
if (f.SqlIdColumnName != null)
{
var ordinal = SelectBuild.map[f.SqlIdColumnName];
if (!await dr.IsDBNullAsync(ordinal))
AyaField.i = dr.GetInt64(ordinal);
//nCurrentColumnPointer++;
}
row.Add(AyaField);
}