diff --git a/server/AyaNova/DataList/AttachmentDataList.cs b/server/AyaNova/DataList/AttachmentDataList.cs index ec8cf79d..e299b156 100644 --- a/server/AyaNova/DataList/AttachmentDataList.cs +++ b/server/AyaNova/DataList/AttachmentDataList.cs @@ -25,7 +25,7 @@ namespace AyaNova.DataList cm.fld = "ayatype"; dlistView.Add(cm); - cm = new JObject(); + cm = new JObject(); cm.fld = "ayatypeex"; dlistView.Add(cm); @@ -81,6 +81,7 @@ namespace AyaNova.DataList }); + FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "AyaType", diff --git a/server/AyaNova/DataList/AyaDataListFieldDefinition.cs b/server/AyaNova/DataList/AyaDataListFieldDefinition.cs index 566ad21d..ac59600e 100644 --- a/server/AyaNova/DataList/AyaDataListFieldDefinition.cs +++ b/server/AyaNova/DataList/AyaDataListFieldDefinition.cs @@ -47,7 +47,7 @@ namespace AyaNova.DataList [JsonIgnore] public string SqlValueColumnName { get; set; } [JsonIgnore] - public string SqlAyTypeColumnName { get; set; }//column to fetch the AyaType for this field to set it dynamically instead of preset + public string SqlAyTypeColumnName { get; set; }//column to fetch the AyaType openabel for this field to set it dynamically instead of preset @@ -62,7 +62,7 @@ namespace AyaNova.DataList IsMeta = false; //Set openable object type to no type which is the default and means it's not a link to another object AyaObjectType = (int)AyaType.NoType; - SqlAyTypeColumnName=string.Empty; + SqlAyTypeColumnName=null;//must be null as that is checked against specifically } diff --git a/server/AyaNova/DataList/DataListFetcher.cs b/server/AyaNova/DataList/DataListFetcher.cs index 6d9fae40..3497f086 100644 --- a/server/AyaNova/DataList/DataListFetcher.cs +++ b/server/AyaNova/DataList/DataListFetcher.cs @@ -181,8 +181,15 @@ namespace AyaNova.DataList var ordinal = SelectBuild.map[f.SqlIdColumnName]; if (!await dr.IsDBNullAsync(ordinal)) AyaField.i = dr.GetInt64(ordinal); - } + + if (f.SqlAyTypeColumnName != null) + { + var ordinal = SelectBuild.map[f.SqlAyTypeColumnName]; + if (!await dr.IsDBNullAsync(ordinal)) + AyaField.ot = dr.GetInt32(ordinal); + } + row.Add(AyaField); } } diff --git a/server/AyaNova/DataList/DataListSqlFilterCriteriaBuilder.cs b/server/AyaNova/DataList/DataListSqlFilterCriteriaBuilder.cs index 94017af4..dc65c782 100644 --- a/server/AyaNova/DataList/DataListSqlFilterCriteriaBuilder.cs +++ b/server/AyaNova/DataList/DataListSqlFilterCriteriaBuilder.cs @@ -111,6 +111,8 @@ namespace AyaNova.DataList //this is indicated by this column being an id type //and by the comparison operator being eq or neq //and the value being a number not a string + //NOTE: This is not actually used anywhere at the client or on server, only defined here in this class + //it was probabaly for supporting filtering by ID but I have found that unnecessary so far if (DataListField.HasIdColumn() && IsPossibleIdValue && (opType == DataListFilterComparisonOperator.Equality || opType == DataListFilterComparisonOperator.NotEqual)) { columnNameToFilter = DataListField.SqlIdColumnName; diff --git a/server/AyaNova/DataList/DataListSqlSelectBuilder.cs b/server/AyaNova/DataList/DataListSqlSelectBuilder.cs index 868499f0..fa0fd89b 100644 --- a/server/AyaNova/DataList/DataListSqlSelectBuilder.cs +++ b/server/AyaNova/DataList/DataListSqlSelectBuilder.cs @@ -1,11 +1,6 @@ using System.Collections.Generic; -using System; -using System.Globalization; using System.Text; -using Newtonsoft.Json.Linq; using System.Linq; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; namespace AyaNova.DataList { @@ -81,6 +76,20 @@ namespace AyaNova.DataList map.Add(idColumnName, nOrdinal++); } } + + //does it also have an openable AyaType column? + var ayaTypeColumnName = o.SqlAyTypeColumnName; + if (!string.IsNullOrWhiteSpace(ayaTypeColumnName)) + { + if (!map.ContainsKey(ayaTypeColumnName)) + { + if (firstColumnAdded) + sb.Append(", "); + sb.Append(ayaTypeColumnName); + firstColumnAdded = true; + map.Add(ayaTypeColumnName, nOrdinal++); + } + } } } } diff --git a/server/AyaNova/DataList/EventDataList.cs b/server/AyaNova/DataList/EventDataList.cs index 781c2b09..abce5fe5 100644 --- a/server/AyaNova/DataList/EventDataList.cs +++ b/server/AyaNova/DataList/EventDataList.cs @@ -74,7 +74,7 @@ namespace AyaNova.DataList UiFieldDataType = (int)UiFieldDataType.Enum, EnumType = AyaNova.Util.StringUtil.TrimTypeName(typeof(AyaType).ToString()), SqlValueColumnName = "aevent.ayatype", - SqlIdColumnName = "aevent.ayid"//Test to see if can make this column openable + SqlIdColumnName = "aevent.ayid" }); FieldDefinitions.Add(new AyaDataListFieldDefinition diff --git a/server/AyaNova/biz/AyaFieldData.cs b/server/AyaNova/biz/AyaFieldData.cs index 76650f94..4a9dd8ba 100644 --- a/server/AyaNova/biz/AyaFieldData.cs +++ b/server/AyaNova/biz/AyaFieldData.cs @@ -13,5 +13,7 @@ namespace AyaNova.Biz public long? i { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] //https://www.newtonsoft.com/json/help/html/JsonPropertyPropertyLevelSetting.htm public bool? rid { get; set; } + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] //https://www.newtonsoft.com/json/help/html/JsonPropertyPropertyLevelSetting.htm + public int? ot { get; set; } } } \ No newline at end of file diff --git a/server/AyaNova/biz/UiFieldDataType.cs b/server/AyaNova/biz/UiFieldDataType.cs index 13828452..7d0ee8da 100644 --- a/server/AyaNova/biz/UiFieldDataType.cs +++ b/server/AyaNova/biz/UiFieldDataType.cs @@ -22,6 +22,6 @@ namespace AyaNova.Biz MemorySize = 14,//this is so client can convert what would normally be an Integer type to human readable file / ram size value TimeSpan=15, PhoneNumber=16,//this is so client can dial directly, - Roles = 17//for grid display (users) + Roles = 17//for grid display (users), } }