using System; using System.Collections.Generic; using System.Text; namespace GZTW.AyaNova.BLL { /// /// Factory class for returning editable /// root object collections by name /// public sealed class EditableCollectionFactory { /// /// Fetch an editable collection /// /// LocaleKey of Collection or /// most significant portion of localeKey property of collection /// i.e. "Priority.Label.List" LocaleKey is accepted /// as is "Priority" /// 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"); } } } }