コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }