/// <summary> /// Currently cached directory. If there is no cached list it will /// automatically call the function to build it. /// </summary> /// <returns>All Directory Items</returns> public static List <DirectoryItemForMobile> GetDirectoryForMobile(bool includeMobile) { List <DirectoryItem> CurrentCache; // First we pull the full list from cache (saves having to keep multiple caches for Mobile) CurrentCache = (List <DirectoryItem>)System.Web.HttpRuntime.Cache[CURRENT_DIRECTORY_CACHE_NAME]; if (CurrentCache == null) { CurrentCache = LoadCurrentDirectory(); } return(CurrentCache.OrderBy(x => x.Name).Select(x => new DirectoryItemForMobile { Name = x.Name, PC = x.PC, Phone = x.Phone, IsServiceCenter = x.IsServiceCenter, IsRegionSupport = x.IsRegionSupport, IsRegionManager = x.IsRegionManager, IsPCManager = x.IsPCManager, IsProfitCenter = x.IsProfitCenter, HasShowroom = x.HasShowroom, Email = x.EmailAddress, Mobile = includeMobile ? x.Mobile : "", Street = x.Street, CSZ = x.CSZ, RegionNumber = x.RegionNumber, RegionName = x.RegionName, ManagerDepartment = x.ManagerDepartment, EclipseBox = x.EclipseBox, OnSiteContact = x.OnSiteContact }).ToList()); }