public List <Country> CountryGetAllByRole(string user) { string cacheKey = user + "Country"; object cacheItem = MarsV2Cache.GetCacheObject(cacheKey); if ((ConfigAccess.ByPassCache()) || (cacheItem == null)) { cacheItem = dal.CountryGetAllByRole(user.Substring(user.LastIndexOf("\\") + 1)); MarsV2Cache.AddObjectToCacheWithNoSlidingExpiry(cacheKey, cacheItem); } return(new List <Country>((List <Country>)cacheItem)); }
public List <UserRole> UsersInRolesGet(string user) { string cacheKey = user + "Roles"; object cacheItem = MarsV2Cache.GetCacheObject(cacheKey); if ((ConfigAccess.ByPassCache()) || (cacheItem == null)) { cacheItem = dal.UsersInRolesGet(user.Substring(user.LastIndexOf("\\") + 1)); MarsV2Cache.AddObjectToCache(cacheKey, cacheItem); } return(new List <UserRole>((List <UserRole>)cacheItem)); }
public List <CarGroup> CarGroupListGetByCountryID(string countryID) { string cacheKey = "CarGroupAll_" + countryID; object cacheItem = MarsV2Cache.GetCacheObject(cacheKey); if ((ConfigAccess.ByPassCache()) || (cacheItem == null)) { cacheItem = DAL.CarGroupListGetByCountryID(countryID); MarsV2Cache.AddObjectToCache(cacheKey, cacheItem); } return(new List <CarGroup>((List <CarGroup>)cacheItem)); }
public List <Country> CountryGetAll() { string cacheKey = MarsV2Cache.CountryList; object cacheItem = MarsV2Cache.GetCacheObject(cacheKey); if ((ConfigAccess.ByPassCache()) || (cacheItem == null)) { cacheItem = DAL.CountryGetAll(); MarsV2Cache.AddObjectToCache(cacheKey, cacheItem); } return(new List <Country>((List <Country>)cacheItem)); }
internal static List <BranchHolder> GetAllBranches() { var cacheKey = MarsV2Cache.MarsBranchList; var cacheItem = MarsV2Cache.GetCacheObject(cacheKey); if ((ConfigAccess.ByPassCache()) || (cacheItem == null)) { cacheItem = ParameterDataAccess.GetAllBranches(); MarsV2Cache.AddObjectToCache(cacheKey, cacheItem); } return((List <BranchHolder>)cacheItem); }
/// <summary> /// Retrieves the List of Location Groups either from the Cache or Database /// </summary> /// <returns>Location Pool Ids and Names</returns> internal static List <LocationGroupHolder> GetAllLocationGroups() { var cacheKey = MarsV2Cache.MarsLocationGroupList; var cacheItem = MarsV2Cache.GetCacheObject(cacheKey); if ((ConfigAccess.ByPassCache()) || (cacheItem == null)) { cacheItem = ParameterDataAccess.GetAllLocationPools(); MarsV2Cache.AddObjectToCache(cacheKey, cacheItem); } return((List <LocationGroupHolder>)cacheItem); }
public List <CMSReportingTimeZone> CMSReportingTimeZoneGetAll() { string cacheKey = MarsV2Cache.CMSReportingTimeZone; object cacheItem = MarsV2Cache.GetCacheObject(cacheKey); if ((ConfigAccess.ByPassCache()) || (cacheItem == null)) { cacheItem = _dal.CMSReportingTimeZoneGetAll(); MarsV2Cache.AddObjectToCache(cacheKey, cacheItem); } return((List <CMSReportingTimeZone>)cacheItem); }
public List <CMSForecastType> CMSForecastTypeGetAll(bool frozenZoneSelected) { string cacheKey = frozenZoneSelected ? MarsV2Cache.CMSForecastTypeWithAlreadyBooked : MarsV2Cache.CMSForecastTypeWithoutAlreadyBooked; object cacheItem = MarsV2Cache.GetCacheObject(cacheKey); if ((ConfigAccess.ByPassCache()) || (cacheItem == null)) { cacheItem = _dal.CMSForecastTypeGetAll(frozenZoneSelected); MarsV2Cache.AddObjectToCache(cacheKey, cacheItem); } return((List <CMSForecastType>)cacheItem); }
public List <CMSFleetPlan> CMSFleetPlanGetAll(bool hideScenarios) { string cacheKey = hideScenarios ? MarsV2Cache.CMSFrozenZoneFleetPlanList : MarsV2Cache.CMSFleetPlanList; object cacheItem = MarsV2Cache.GetCacheObject(cacheKey); if ((ConfigAccess.ByPassCache()) || (cacheItem == null)) { cacheItem = _dal.CMSFleetPlanGetAll(hideScenarios); MarsV2Cache.AddObjectToCache(cacheKey, cacheItem); } return((List <CMSFleetPlan>)cacheItem); }
internal static List <string> GetAllLicencePlates() { var cacheKey = MarsV2Cache.LicencePlate; var cacheItem = MarsV2Cache.GetCacheObject(cacheKey); if ((ConfigAccess.ByPassCache()) || (cacheItem == null)) { using (var dataAccess = new MarsDBDataContext()) { cacheItem = NonRevParameterDataAccess.GetLicecePlates(dataAccess); } MarsV2Cache.AddObjectToCache(cacheKey, cacheItem); } return((List <string>)cacheItem); }
internal static List <ListItem> GetLocationCountryListItems(MarsDBDataContext dataContext) { const string cacheKey = MarsV2Cache.LocationCountry; var cacheItem = MarsV2Cache.GetCacheObject(cacheKey); if ((ConfigAccess.ByPassCache()) || (cacheItem == null)) { var countries = (from v in dataContext.Vehicles group v by v.LOCATION.COUNTRy1 into groupedData orderby groupedData.Key.country_description select new ListItem(groupedData.Key.country_description, groupedData.Key.country1)).ToList(); MarsV2Cache.AddObjectToCache(cacheKey, countries); return(countries); } return((List <ListItem>)cacheItem); }
internal static List <ListItem> GetOwningCountryListItems(MarsDBDataContext dataContext) { const string cacheKey = MarsV2Cache.OwningCountry; var cacheItem = MarsV2Cache.GetCacheObject(cacheKey); if ((ConfigAccess.ByPassCache()) || (cacheItem == null)) { var countries = from v in dataContext.Vehicles where v.IsFleet join c in dataContext.COUNTRies on v.OwningCountry equals c.country1 select new ListItem(c.country_description, v.OwningCountry); var owningCountries = countries.Distinct().ToList().OrderBy(d => d.Text).ToList(); MarsV2Cache.AddObjectToCache(cacheKey, owningCountries); return(owningCountries); } return((List <ListItem>)cacheItem); }
internal static List <string> GetVehicleAutoComplete(AutoCompleteTypes typeOfAutoComplete, string cacheKey) { var cacheItem = MarsV2Cache.GetCacheObject(cacheKey); if ((ConfigAccess.ByPassCache()) || (cacheItem == null)) { using (var dataAccess = new MarsDBDataContext()) { switch (typeOfAutoComplete) { case AutoCompleteTypes.Vin: cacheItem = NonRevParameterDataAccess.GetVins(dataAccess); break; case AutoCompleteTypes.LicencePlate: cacheItem = NonRevParameterDataAccess.GetLicecePlates(dataAccess); break; case AutoCompleteTypes.UnitNumber: cacheItem = NonRevParameterDataAccess.GetUnitNumbers(dataAccess); break; case AutoCompleteTypes.DriverName: cacheItem = NonRevParameterDataAccess.GetDriverNames(dataAccess); break; case AutoCompleteTypes.Colour: cacheItem = NonRevParameterDataAccess.GetVehicleColours(dataAccess); break; case AutoCompleteTypes.ModelDescription: cacheItem = NonRevParameterDataAccess.GetModelDescription(dataAccess); break; default: throw new ArgumentOutOfRangeException("typeOfAutoComplete"); } } } return((List <string>)cacheItem); }