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 public static class AyaFormFieldDefinitions
{ {
private static Dictionary<string, List<AyaFormFieldDefinition>> _ayaFormFields; private static Dictionary<string, List<AyaFormFieldDefinition>> _ayaFormFields;
private static List<string> _ayaFormFieldDefinitionKeys = null;
public static List<string> AyaFormFieldDefinitionKeys public static List<string> AyaFormFieldDefinitionKeys
{ {
get get
{ {
//return the names of all AyaTypes that have the corebizobject attribute if (_ayaFormFieldDefinitionKeys == null)
List<string> l = new List<string>();
var values = Enum.GetValues(typeof(AyaType));
foreach (AyaType t in values)
{ {
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");
} }
return _ayaFormFieldDefinitionKeys;
//No type form keys:
l.Add("Contact");
return l;
} }
} }
public static bool IsValidFormFieldDefinitionKey(string key) public static bool IsValidFormFieldDefinitionKey(string key)
{ {
System.Diagnostics.Debugger.Log(1, "DEV_TEST", $"AyaFormFieldDefinitions::IsValidFormFieldDefinitionKey {key}\n");
return AyaFormFieldDefinitionKeys.Contains(key); return AyaFormFieldDefinitionKeys.Contains(key);
} }
public static List<AyaFormFieldDefinition> AyaFormFields(string key) public static List<AyaFormFieldDefinition> AyaFormFields(string key)
{ {
//Initialize the static list here on first retrieval //Initialize the static list here on first retrieval
if (_ayaFormFields == null) if (_ayaFormFields == null)
{ {
_ayaFormFields = new Dictionary<string, List<AyaFormFieldDefinition>>(); _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 /* ***************************** 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 ***************************** Otherwise the hidden field can't be set and the object can't be saved EVER