This commit is contained in:
71
server/PickList/PickListFactory.cs
Normal file
71
server/PickList/PickListFactory.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using System.Collections.Generic;
|
||||
using Sockeye.Biz;
|
||||
using Sockeye.Models;
|
||||
|
||||
|
||||
namespace Sockeye.PickList
|
||||
{
|
||||
internal static class PickListFactory
|
||||
{
|
||||
|
||||
//Instantiate list object specified from type
|
||||
internal static IAyaPickList GetAyaPickList(SockType sockType)
|
||||
{
|
||||
switch (sockType)
|
||||
{
|
||||
//CoreBizObject add here if it will be "picked" on any other form
|
||||
|
||||
case SockType.Customer:
|
||||
return new CustomerPickList() as IAyaPickList;
|
||||
case SockType.HeadOffice:
|
||||
return new HeadOfficePickList() as IAyaPickList;
|
||||
case SockType.User:
|
||||
return new UserPickList() as IAyaPickList;
|
||||
|
||||
case SockType.Report:
|
||||
return new ReportPickList() as IAyaPickList;
|
||||
|
||||
//@##### WARNING: BE SURE TO ADD NEW TYPES BELOW OR USERS WON"T BE ABLE TO EDIT THE TEMPLATE FOR THEM
|
||||
|
||||
default:
|
||||
throw new System.NotImplementedException($"PICKLIST {sockType} NOT IMPLEMENTED");
|
||||
|
||||
}
|
||||
//return null;
|
||||
}
|
||||
|
||||
//List all the PickList-able object types available
|
||||
internal static List<NameIdItem> GetListOfAllPickListTypes(long TranslationId)
|
||||
{
|
||||
List<string> TranslationKeysToFetch = new List<string>();
|
||||
List<NameIdItem> ret = new List<NameIdItem>();
|
||||
|
||||
List<SockType> values = new List<SockType>();
|
||||
values.Add(SockType.Customer);
|
||||
values.Add(SockType.HeadOffice);
|
||||
values.Add(SockType.Report);
|
||||
values.Add(SockType.User);
|
||||
|
||||
|
||||
//### NEW ONES HERE
|
||||
|
||||
|
||||
|
||||
foreach (SockType 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
|
||||
Reference in New Issue
Block a user