Files
ayanova7/source/bizobjects/AyaLib/GZTW.AyaNova.BLL/EditableCollectionFactory.cs
2018-06-29 19:47:36 +00:00

91 lines
2.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
namespace GZTW.AyaNova.BLL
{
/// <summary>
/// Factory class for returning editable
/// root object collections by name
/// </summary>
public sealed class EditableCollectionFactory
{
/// <summary>
/// Fetch an editable collection
/// </summary>
/// <param name="Key">LocaleKey of Collection or
/// most significant portion of localeKey property of collection
/// i.e. "Priority.Label.List" LocaleKey is accepted
/// as is "Priority"
/// </param>
public static object Get(string Key)
{
if (Key.LastIndexOf(".") != -1)
{
string [] s=Key.Split('.');
Key=s[0];
}
switch (Key)
{
case "ContactTitle":
return ContactTitles.GetItems();
case "DispatchZone":
return DispatchZones.GetItems(true);
case "ClientGroup":
return ClientGroups.GetItems();
case "ClientNoteType":
return ClientNoteTypes.GetItems();
case "WorkorderItemType":
return WorkorderItemTypes.GetItems();
case "WorkorderCategory":
return WorkorderCategories.GetItems();
case "WorkorderStatus":
return WorkorderStatuses.GetItems();
case "Priority":
return Priorities.GetItems();
case "UnitOfMeasure":
return UnitOfMeasures.GetItems();
case "PartCategory":
return PartCategories.GetItems();
case "PartAssembly":
return PartAssemblies.GetItems();
case "UserSkill":
return UserSkills.GetItems();
case "UserCertification":
return UserCertifications.GetItems();
case "UnitServiceType":
return UnitServiceTypes.GetItems();
case "PartWarehouse":
return PartWarehouses.GetItems(true);
case "UnitModelCategory":
return UnitModelCategories.GetItems();
case "RateUnitChargeDescription":
return RateUnitChargeDescriptions.GetItems();
case "Task":
return Tasks.GetItems();
default:
throw new ApplicationException("EditableCollectionFactory - list: " + Key + " Not recognized");
}
}
}
}