This commit is contained in:
2020-12-24 20:27:46 +00:00
parent efee200669
commit 4e2840ad1c

View File

@@ -11,38 +11,42 @@ namespace AyaNova.Biz
public static class AyaFormFieldDefinitions
{
private static Dictionary<string, List<AyaFormFieldDefinition>> _ayaFormFields;
private static List<string> _ayaFormFieldDefinitionKeys = null;
public static List<string> AyaFormFieldDefinitionKeys
{
get
{
//return the names of all AyaTypes that have the corebizobject attribute
List<string> l = new List<string>();
var values = Enum.GetValues(typeof(AyaType));
foreach (AyaType t in values)
{
if (_ayaFormFieldDefinitionKeys == null)
{
if (t.HasAttribute(typeof(CoreBizObjectAttribute)))
_ayaFormFieldDefinitionKeys = new List<string>();
var values = Enum.GetValues(typeof(AyaType));
foreach (AyaType t in values)
{
l.Add(t.ToString());
if (t.HasAttribute(typeof(CoreBizObjectAttribute)))
{
_ayaFormFieldDefinitionKeys.Add(t.ToString());
}
}
//No type form keys:
_ayaFormFieldDefinitionKeys.Add("Contact");
}
//No type form keys:
l.Add("Contact");
return l;
return _ayaFormFieldDefinitionKeys;
}
}
public static bool IsValidFormFieldDefinitionKey(string key)
{
System.Diagnostics.Debugger.Log(1, "DEV_TEST", $"AyaFormFieldDefinitions::IsValidFormFieldDefinitionKey {key}\n");
return AyaFormFieldDefinitionKeys.Contains(key);
}
public static List<AyaFormFieldDefinition> AyaFormFields(string key)
{
{
//Initialize the static list here on first retrieval
if (_ayaFormFields == null)
{
{
_ayaFormFields = new Dictionary<string, List<AyaFormFieldDefinition>>();
/* ***************************** WARNING: Be careful here, if a standard field is hideable and also it's DB SCHEMA is set to NON NULLABLE then the CLIENT end needs to set a default
***************************** Otherwise the hidden field can't be set and the object can't be saved EVER