85 lines
3.2 KiB
C#
85 lines
3.2 KiB
C#
using AyaNova.Biz;
|
|
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 DataListFieldDefinition
|
|
{
|
|
//CLIENT / SERVER Unique identifier used at BOTH client and server
|
|
//also the sql valuecolumnname if identical
|
|
public string FieldKey { get; set; }
|
|
|
|
//CLIENT Use only for display
|
|
public string TKey { 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 / SERVER - indicates internal only meta column, don't show to user for filter settings etc
|
|
public bool IsMeta { get; set; }
|
|
|
|
//CLIENT Use only for display
|
|
public int UiFieldDataType { get; set; }
|
|
|
|
//CLIENT Use only for display
|
|
public string EnumType { get; set; }
|
|
|
|
//SERVER / CLIENT - used to identify the column that represents the entire row ID and object
|
|
//MUST be present in all datalists and displayed at the client
|
|
public bool IsRowId { get; set; }
|
|
|
|
//CLIENT / SERVER - client display and to indicate what object to open , Server for formatting return object
|
|
public int AType { 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; }
|
|
[JsonIgnore]
|
|
public string SqlATypeColumnName { get; set; }//column to fetch the AyaType openabel for this field to set it dynamically instead of preset
|
|
[JsonIgnore]
|
|
public string SqlColorColumnName { get; set; }//column to fetch the color if applicable to this field
|
|
|
|
public DataListFieldDefinition()
|
|
{
|
|
//most common defaults
|
|
IsCustomField = false;
|
|
IsFilterable = true;
|
|
IsSortable = true;
|
|
IsRowId = false;
|
|
IsMeta = false;
|
|
//Set openable object type to no type which is the default and means it's not a link to another object
|
|
AType = (int)AyaType.NoType;
|
|
SqlATypeColumnName = null;//must be null as that is checked against specifically
|
|
SqlColorColumnName = null;//must be null to be ignored properly
|
|
}
|
|
|
|
//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;
|
|
}
|
|
}
|
|
|
|
public bool HasIdColumn()
|
|
{
|
|
return !string.IsNullOrWhiteSpace(SqlIdColumnName);
|
|
}
|
|
|
|
}
|
|
} |