using AyaNova.Biz; using System.ComponentModel.DataAnnotations; using Newtonsoft.Json; namespace AyaNova.DataList { //This class defines a field used for returning data in list format for UI grid lists and reporting public class AyaDataListFieldDefinition { //CLIENT / SERVER Unique identifier used at BOTH client and server //also the sql displaycolumnname if identical public string FieldKey { get; set; } //CLIENT Use only for display public string LtKey { get; set; } //CLIENT / SERVER - client display server validation purposes public bool IsCustomField { get; set; } //CLIENT / SERVER - client display server validation purposes public bool IsFilterable { get; set; } //CLIENT / SERVER - client display server validation purposes public bool IsSortable { get; set; } //CLIENT Use only for display public int UiFieldDataType { get; set; } //CLIENT Use only for display public string EnumType { get; set; } //CLIENT / SERVER - client display and to indicate what object to open , Server for formatting return object public int AyaObjectType { get; set; } //SERVER - for building sql queries //don't return these properties when api user fetches field list definitions in DataListController [JsonIgnore] public string SqlIdColumnName { get; set; } [JsonIgnore] public string SqlValueColumnName { get; set; } public AyaDataListFieldDefinition() { //most common defaults IsCustomField = false; IsFilterable = true; IsSortable = true; //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; } //Get column to query for display name or use FieldName if there is no difference public string GetSqlValueColumnName() { if (string.IsNullOrEmpty(SqlValueColumnName)) { return FieldKey.ToLowerInvariant(); } else { return SqlValueColumnName; } } } }