コード例 #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]);
        }
コード例 #2
0
 public District GetDistrictStateCountryByDistrictId(int districtId)
 {
     return(DistrictIntegration.GetDistrictStateCountryByDistrictId(districtId));
 }
コード例 #3
0
 public List <District> GetDistrictStateCountryByDistrictId()
 {
     return(DistrictIntegration.GetDistrictStateCountryByDistrictId());
 }
コード例 #4
0
 public List <District> GetDistrictListByStateId(int stateId, bool showDeleted = false)
 {
     return(DistrictIntegration.GetDistrictListByStateId(stateId));
 }