using System.Collections.Generic; using AyaNova.Biz; using AyaNova.Models; namespace AyaNova.PickList { internal static class PickListFactory { //Instantiate list object specified from type internal static IAyaPickList GetAyaPickList(AyaType ayaType) { switch (ayaType) { //CoreBizObject add here case AyaType.Widget: return new WidgetPickList() as IAyaPickList; case AyaType.User: return new UserPickList() as IAyaPickList; } return null; } //List all the PickList-able object types available internal static List GetListOfAllPickListTypes(long TranslationId) { List TranslationKeysToFetch = new List(); List ret = new List(); var values = System.Enum.GetValues(typeof(AyaType)); foreach (AyaType t in values) { if (t.HasAttribute(typeof(CoreBizObjectAttribute))) { var name = t.ToString(); TranslationKeysToFetch.Add(name); ret.Add(new NameIdItem() { Name = name, Id = (long)t }); } } var LT = TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, TranslationId).Result; foreach (NameIdItem i in ret) { i.Name = LT[i.Name]; } return ret; } }//eoc }//eons