Files
raven/server/AyaNova/PickList/AyaPickListFieldDefinition.cs
2020-03-17 17:59:12 +00:00

54 lines
1.7 KiB
C#

using AyaNova.Biz;
using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json;
namespace AyaNova.PickList
{
//This class defines a field used for returning data in list format for UI pick lists
public class AyaPickListFieldDefinition
{
//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; }
// Used for casting query
public UiFieldDataType ColumnDataType { get; set; }
public bool IsRowId { get; set; }
public bool IsActiveColumn { get; set; }
public AyaType AyaObjectType { get; set; }
[JsonIgnore]
public string SqlIdColumnName { get; set; }
[JsonIgnore]
public string SqlValueColumnName { get; set; }
public AyaPickListFieldDefinition()
{
//most common defaults
IsRowId = false;
IsActiveColumn = false;
// 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;
}
}
// public bool HasIdColumn()
// {
// return !string.IsNullOrWhiteSpace(SqlIdColumnName);
// }
}
}