Files
sockeye/server/PickList/AyaPickListFieldDefinition.cs
2022-12-16 06:01:23 +00:00

42 lines
1.5 KiB
C#

using Sockeye.Biz;
using Newtonsoft.Json;
namespace Sockeye.PickList
{
//This class defines a field used for pick list templating querying processing editing and returning
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 TKey { get; set; }
// Used for casting query
public UiFieldDataType ColumnDataType { get; set; }
public bool IsRowId { get; set; }//both indicates is row ID but also that it's required as the only required field. Not technically necessary maybe but to prevent foot shooting.
public bool IsActiveColumn { get; set; }
[JsonIgnore]
public string SqlIdColumnName { get; set; }
[JsonIgnore]
public string SqlValueColumnName { get; set; }
public AyaPickListFieldDefinition()
{
//most common defaults
IsRowId = false;
IsActiveColumn = false;
}
//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;
}
}
}
}