using System; using System.Collections.Generic; using System.Text; namespace GZTW.AyaNova.BLL { /// /// Factory class for returning read only collection lists by key name /// public sealed class ListFactory { /// /// Fetch a read only collection list /// /// Key name of collection (same as report name property in collection) /// XML Criteria and Order by filter /// TOP number of records or -1 for all records /// Read only collection object public static object GetList(string key, string filter, int maxrecords) { return GetList(key, filter, maxrecords, null); } /// /// Fetch a read only collection list with optional list of id's /// to return discrete items only /// /// /// /// /// Generic List(GUID) of id's to return or null if not a factor /// public static object GetList(string key, string filter, int maxrecords, List idlist ) { //Lists all assume null idlist means all //if called with a null or empty idlist should //return all as normal so this ensures idlist //is null if empty if (idlist != null && idlist.Count == 0) idlist = null; switch (key) { #region client related case "ClientList": return ClientList.Get(filter, maxrecords, idlist); case "ClientListDetailed": return ClientListDetailed.Get(filter, maxrecords, idlist); case "HeadOfficeList": return HeadOfficeList.Get(filter, maxrecords, idlist); case "HeadOfficeListDetailed": return HeadOfficeListDetailed.Get(filter, maxrecords, idlist); case "ContractList": return ContractList.Get(filter, maxrecords, idlist); case "ProjectList": return ProjectList.Get(filter, maxrecords, idlist); case "ClientServiceRequestList": return ClientServiceRequestList.Get(filter, maxrecords, idlist); #endregion client related #region Service workorders case "WorkorderServiceList": return WorkorderServiceList.Get(filter, maxrecords, idlist); case "WorkorderServiceDetailed": return WorkorderServiceDetailedReportData.Get(filter, maxrecords, idlist); case "WorkorderServiceItemList": return WorkorderServiceItemList.Get(filter, maxrecords, idlist); case "WorkorderServiceScheduledUserList": return WorkorderServiceScheduledUserList.Get(filter, maxrecords, idlist); case "WorkorderServicePartList": return WorkorderServicePartList.Get(filter, maxrecords, idlist); case "WorkorderServiceLaborList": return WorkorderServiceLaborList.Get(filter, maxrecords, idlist); case "WorkorderServiceTravelList": return WorkorderServiceTravelList.Get(filter, maxrecords, idlist); case "WorkorderServiceLoanList": return WorkorderServiceLoanList.Get(filter, maxrecords, idlist); case "WorkorderServiceExpenseList": return WorkorderServiceExpenseList.Get(filter, maxrecords, idlist); case "WorkorderServiceCustomList": return WorkorderServiceCustomList.Get(filter, maxrecords, idlist); case "TemplateServiceList": return TemplateServiceList.Get(filter, maxrecords, idlist); #endregion service workorders #region Quotes case "WorkorderQuoteList": return WorkorderQuoteList.Get(filter, maxrecords, idlist); case "WorkorderQuoteDetailed": return WorkorderQuoteDetailedReportData.Get(filter, maxrecords, idlist); case "WorkorderQuoteItemList": return WorkorderQuoteItemList.Get(filter, maxrecords, idlist); case "WorkorderQuoteScheduledUserList": return WorkorderQuoteScheduledUserList.Get(filter, maxrecords, idlist); case "WorkorderQuotePartList": return WorkorderQuotePartList.Get(filter, maxrecords, idlist); case "WorkorderQuoteLaborList": return WorkorderQuoteLaborList.Get(filter, maxrecords, idlist); case "WorkorderQuoteTravelList": return WorkorderQuoteTravelList.Get(filter, maxrecords, idlist); case "WorkorderQuoteCustomList": return WorkorderQuoteCustomList.Get(filter, maxrecords, idlist); case "TemplateQuoteList": return TemplateQuoteList.Get(filter, maxrecords, idlist); #endregion quotes #region PM's case "WorkorderPMList": return WorkorderPMList.Get(filter, maxrecords, idlist); case "WorkorderPMDetailed": return WorkorderPMDetailedReportData.Get(filter, maxrecords, idlist); case "WorkorderPMItemList": return WorkorderPMItemList.Get(filter, maxrecords, idlist); case "WorkorderPMScheduledUserList": return WorkorderPMScheduledUserList.Get(filter, maxrecords, idlist); case "WorkorderPMPartList": return WorkorderPMPartList.Get(filter, maxrecords, idlist); case "WorkorderPMLaborList": return WorkorderPMLaborList.Get(filter, maxrecords, idlist); case "WorkorderPMTravelList": return WorkorderPMTravelList.Get(filter, maxrecords, idlist); case "WorkorderPMCustomList": return WorkorderPMCustomList.Get(filter, maxrecords, idlist); case "TemplatePreventiveMaintenanceList": return TemplatePreventiveMaintenanceList.Get(filter, maxrecords, idlist); #endregion #region Inventory related case "PartList": return PartList.Get(filter, maxrecords, idlist); case "PurchaseOrderList": return PurchaseOrderList.Get(filter, maxrecords, idlist); case "PurchaseOrderListDetailed"://case 764 return PurchaseOrderListDetailed.Get(filter, maxrecords, idlist); case "PurchaseOrderDetailed": return PurchaseOrderDetailedReportData.Get(filter, maxrecords, idlist); case "PurchaseOrderReceiptList": return PurchaseOrderReceiptList.Get(filter, maxrecords, idlist); case "PurchaseOrderReceiptListDetailed"://case 765 return PurchaseOrderReceiptListDetailed.Get(filter, maxrecords, idlist); case "PartInventoryAdjustmentList": return PartInventoryAdjustmentList.Get(filter, maxrecords, idlist); case "PartInventoryAdjustmentListDetailed"://case 1394 return PartInventoryAdjustmentListDetailed.Get(filter, maxrecords, idlist); case "PartInventoryAdjustmentDetailed"://case 1513 return PartInventoryAdjustmentDetailedReportData.Get(filter, maxrecords, idlist); // case "PartWarehouseInventoryList": return PartWarehouseInventoryList.Get(filter, maxrecords, idlist); case "WorkorderItemPartRequestList": return WorkorderItemPartRequestList.Get(filter, maxrecords, idlist); #endregion #region Unit related case "UnitList": return UnitList.Get(filter, maxrecords, idlist); case "UnitModelList": return UnitModelList.Get(filter, maxrecords, idlist); case "LoanItemList": return LoanItemList.Get(filter, maxrecords, idlist); #endregion #region Vendor related case "VendorList": return VendorList.Get(filter, maxrecords, idlist); case "VendorListDetailed": return VendorListDetailed.Get(filter, maxrecords, idlist); #endregion #region Search related case "SearchResultList": return SearchResultList.Get(filter, maxrecords, idlist); #endregion #region User's lists case "MemoList": return MemoList.Get(filter, maxrecords, idlist); //case 1967 case "ScheduleMarkerList": return ScheduleMarkerList.Get(filter, maxrecords, idlist); #endregion #region Admin lists case "UserList": { //case 1172 - only retrieve a list of the single lite user //so that the user doesn't see all the possibly existing users from going from full to lite //in the user grid list and also doesn't see the administrator user if (AyaBizUtils.Lite) { if (idlist == null) idlist = new List(); else idlist.Clear(); idlist.Add(User.LiteUserID); } return UserList.Get(filter, maxrecords, idlist); } case "ReportList": return ReportList.Get(filter, maxrecords, idlist); case "AyaFileList": return AyaFileList.Get(filter, maxrecords, idlist); //case 1967 case "ScheduleMarkerListAllUsers": return ScheduleMarkerListAllUsers.Get(filter, maxrecords, idlist); #endregion default: throw new ApplicationException("ListFactory - list: " + key + " Not recognized"); } } } }