Beispiel #1
0
        public List <District> GetAllDistricts()
        {
            // string someObject = "FooBar";

            ////Cache the value
            //HttpRuntime.Cache.Add("somekey", someObject, null,
            //  DateTime.UtcNow.AddMinutes(1.0),
            //  System.Web.Caching.Cache.NoSlidingExpiration,
            //  System.Web.Caching.CacheItemPriority.Normal, null);

            //someObject = null;

            ////Access the cached value
            //someObject = (string) HttpRuntime.Cache.Get( "somekey" );

            //return DistrictIntegration.GetAllDistricts();

            //Cache the districts for faster response
            const string UniqueKey = "GetAllDistricts";

            if (HttpRuntime.Cache[UniqueKey] == null)
            {
                List <District> DistrictList = DistrictIntegration.GetAllDistricts();
                //HttpRuntime.Cache[UniqueKey] = DistrictList;
                HttpRuntime.Cache.Add(UniqueKey, DistrictList, null,
                                      DateTime.UtcNow.AddYears(1),
                                      System.Web.Caching.Cache.NoSlidingExpiration,
                                      System.Web.Caching.CacheItemPriority.High, null);
            }
            return((List <District>)HttpRuntime.Cache.Get(UniqueKey)); //(HttpRuntime.Cache[UniqueKey]);
        }
Beispiel #2
0
 public District GetDistrictStateCountryByDistrictId(int districtId)
 {
     return(DistrictIntegration.GetDistrictStateCountryByDistrictId(districtId));
 }
Beispiel #3
0
 public List <District> GetDistrictStateCountryByDistrictId()
 {
     return(DistrictIntegration.GetDistrictStateCountryByDistrictId());
 }
Beispiel #4
0
 public List <District> GetDistrictListByStateId(int stateId, bool showDeleted = false)
 {
     return(DistrictIntegration.GetDistrictListByStateId(stateId));
 }