public static void BindAdminRegionsDropDown(String empNo, Roles role, ICacheStorage adapter, DropDownList d) { d.DataSource = BllAdmin.GetRegionsByRights(empNo, role, adapter); d.DataTextField = "Value"; d.DataValueField = "Key"; d.DataBind(); }
public ProductService( IProductRepository productRepository, ICacheStorage cacheStorage, IConfigurationRepository configurationRepository, ILoggingService loggingService) { if (productRepository == null) { throw new ArgumentNullException("ProductRepository"); } if (cacheStorage == null) { throw new ArgumentNullException("CacheStorage"); } if (configurationRepository == null) { throw new ArgumentException("Configuration"); } if (loggingService == null) { throw new ArgumentException("Logging"); } this._productRepository = productRepository; this._cacheStorage = cacheStorage; this._configurationRepository = configurationRepository; this._loggingService = loggingService; }
public static String GetApplicationsButton(int site, Languages language, String encEmpNo, ICacheStorage adapter) { List<Applications> applications = BllApplications.GetApplicationsBySiteId(site, adapter); if (applications == null) return String.Empty; StringBuilder sbr = new StringBuilder(); sbr.Append(@"<div style='border: 1px solid #000;'>"); sbr.Append(@"<ul>"); foreach (var a in applications) { sbr.Append(@"<li>"); sbr.Append(@"<input type='button' value='"); sbr.Append(language == Languages.Hindi ? a.ApplicationNameHi : a.ApplicationNameEn); sbr.Append(@"' onclick='window.location = """); sbr.Append(a.Url); sbr.Append(@"?en="); sbr.Append(encEmpNo); sbr.Append(@""""); sbr.Append(@"'"); sbr.Append(@"/>"); //sbr.Append(@"</a>"); sbr.Append(@"</li>"); } sbr.Append(@"</ul></div>"); return sbr.ToString(); }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or /// resetting unmanaged resources. /// </summary> public override void Dispose() { if (_cacheStore != null) { _cacheStore.Dispose(); _cacheStore = null; } base.Dispose(); }
public EnrichedCustomerService(ICustomerService innerCustomerService, ICacheStorage cacheStorage , IConfigurationRepository configurationRepository) { if (innerCustomerService == null) throw new ArgumentNullException("CustomerService"); if (cacheStorage == null) throw new ArgumentNullException("CacheStorage"); if (configurationRepository == null) throw new ArgumentNullException("ConfigurationRepository"); _innerCustomerService = innerCustomerService; _cacheStorage = cacheStorage; _configurationRepository = configurationRepository; }
public CachedProductCatalogueService(ICacheStorage cachStorage, IProductCatalogueService realProductCatalogueService, IProductTitleRepository productTitleRepository, IProductRepository productRepository) { _cachStorage = cachStorage; _realProductCatalogueService = realProductCatalogueService; _productTitleRepository = productTitleRepository; _productRepository = productRepository; }
public static Employee GetLogin(String empNo, String password, ICacheStorage adapter) { var ds = DalEmployee.GetLogin(empNo, password); if (ds != null && ds.Tables.Count!=0) { Employee emp = BindModel.GetEmployee(ds.Tables[0]); emp.EPermissions = BllAdmin.GetEmployeePermissionsByUser(empNo, adapter); return emp; } return null; }
public static Employee GetEmployeeDetail(String empNo, ICacheStorage adapter) { var ds = DalEmployee.GetEmployeeDetail(empNo); if (ds != null) { Employee emp = BindModel.GetEmployee(ds.Tables[0]); emp.EPermissions = BllAdmin.GetEmployeePermissionsByUser(empNo, adapter); return emp; } return null; }
public static List<Applications> GetApplicationsBySiteId(int siteId, ICacheStorage adapter) { String storageKey = String.Format("Applications_{0}", siteId); List<Applications> applicationsList = adapter.Retrieve<List<Applications>>(storageKey); if (applicationsList == null) { var ds = DalApplications.GetApplicationListBySiteId(siteId); applicationsList = BindModel.GetApplications(ds.Tables[0]); if (applicationsList != null && applicationsList.Count != 0) adapter.Store(storageKey, applicationsList); return applicationsList; } return applicationsList; }
public static List<Permissions> GetPermissionsByUser(String empNo, ICacheStorage adapter) { String storageKey = String.Format("Permission_{0}", empNo); List<Permissions> pList = adapter.Retrieve<List<Permissions>>(storageKey); if (pList == null) { var ds = DalAdmin.GetPermissionByUser(empNo); pList = BindModel.GetPermissions(ds.Tables[0]); if (pList != null && pList.Count != 0) adapter.Store(storageKey, pList); return pList; } return pList; }
public static Dictionary<int, String> GetRegionsByRights(String empNo, Roles role, ICacheStorage adapter) { List<EmployeePermissions> permission = GetEmployeePermissionsByUser(empNo, adapter); if (permission == null) return null; Dictionary<int,String> rights=new Dictionary<int, string>(); foreach (var p in permission) { if(p.Roles==role && !rights.ContainsKey(p.SiteId)) { rights.Add(p.SiteId,p.SiteName); } } return rights; }
public static List<Photos> GetPhotoListByGalleryId(int galleryId, ICacheStorage adapter) { String storageKey = String.Format("Gallery_Photo_{0}", galleryId); List<Photos> photosList = adapter.Retrieve<List<Photos>>(storageKey); if (photosList == null) { var ds = DalPhotoGallery.GetPhotoListByGalleryId(galleryId); photosList = BindModel.GetPhotosForGallery(ds.Tables[0]); if (photosList != null && photosList.Count != 0) adapter.Store(storageKey, photosList); return photosList; } return photosList; }
public static List<Gallery> GetGalleryListBySiteId(int siteId, ICacheStorage adapter) { String storageKey = String.Format("Gallery_{0}", siteId); List<Gallery> galleryList = adapter.Retrieve<List<Gallery>>(storageKey); if (galleryList == null) { var ds = DalPhotoGallery.GetGalleryListBySiteId(siteId); galleryList = BindModel.GetGalleryWithoutPhoto(ds.Tables[0]); if (galleryList != null && galleryList.Count != 0) adapter.Store(storageKey, galleryList); return galleryList; } return galleryList; }
public static List<Marquee> GetMarquee(int siteId, ICacheStorage adapter) { String storageKey = String.Format("Marquee_Site_{0}", siteId); List<Marquee> marqueeToDisplay = adapter.Retrieve<List<Marquee>>(storageKey); if (marqueeToDisplay == null) { List<Marquee> marqueeList = BindModel.GetMarquee(DalMenu.GetActiveMarqueeBySite(siteId)); if (marqueeList != null) { adapter.Store(storageKey, marqueeList); } return marqueeList; } return marqueeToDisplay; }
public static List<Menu> GetMenu(int siteId, ICacheStorage adapter) { String storageKey = String.Format("Menu_Site_{0}", siteId); List<Menu> menuToDisplay = adapter.Retrieve<List<Menu>>(storageKey); if (menuToDisplay == null) { List<Menu> menuList = BindModel.GetMenu(DalMenu.GetActiveMenuByUser(siteId)); if(menuList!=null) { adapter.Store(storageKey, menuList); } return menuList; } return menuToDisplay; }
public static List<Sites> GetActiveSites(ICacheStorage adapter) { String storageKey = String.Format("All_Sites"); List<Sites> sites = adapter.Retrieve<List<Sites>>(storageKey); if (sites == null) { sites= BindModel.GetAllSites(DalMenu.GetActiveSites()); if (sites != null) { adapter.Store(storageKey, sites); } //else //{ // adapter.Store(storageKey, String.Empty); //} return sites; } return sites; }
public User(IUserRepository userRepository, ICacheStorage cacheStorage) : base(userRepository, cacheStorage) { }
public UserService(ICacheStorage cacheStorage) { CacheStorage = cacheStorage; UserRepo = new Repository<User>(); }
/// <summary> /// Method that allows the object to initialize itself. Passes the property map down /// the object hierarchy so that other objects may configure themselves as well.. /// </summary> /// <param name="properties">configuration properties</param> protected override void Initialize(IDictionary cacheClasses, IDictionary properties) { if (properties == null) throw new ArgumentNullException("properties"); try { base.Initialize(cacheClasses, properties); if (System.Configuration.ConfigurationSettings.AppSettings.Get("NCache.EnableGCCollection") != null) { _allowExplicitGCCollection = Convert.ToBoolean(System.Configuration.ConfigurationSettings.AppSettings.Get("NCache.EnableGCCollection")); } if (!properties.Contains("storage")) throw new ConfigurationException("Missing configuration option 'storage'"); if (properties.Contains("scavenging-policy")) { IDictionary evictionProps = properties["scavenging-policy"] as IDictionary; if (evictionProps != null && evictionProps.Contains("eviction-enabled")) if (Convert.ToBoolean(evictionProps["eviction-enabled"]) && Convert.ToDouble(evictionProps["evict-ratio"]) > 0) _evictionPolicy = EvictionPolicyFactory.CreateEvictionPolicy(evictionProps); } else { _evictionPolicy = EvictionPolicyFactory.CreateDefaultEvictionPolicy(); } IDictionary storageProps = properties["storage"] as IDictionary; _cacheStore = CacheStorageFactory.CreateStorageProvider(storageProps, this._context.SerializationContext, _evictionPolicy != null, _context.NCacheLog); _stats.MaxCount = _cacheStore.MaxCount; _stats.MaxSize = _cacheStore.MaxSize; } catch (ConfigurationException e) { if (_context != null) { _context.NCacheLog.Error("LocalCache.Initialize()", e.ToString()); } Dispose(); throw; } catch (Exception e) { if (_context != null) { _context.NCacheLog.Error("LocalCache.Initialize()", e.ToString()); } Dispose(); throw new ConfigurationException("Configuration Error: " + e.ToString(), e); } }
public CacheManagerFeature(ICacheStorage storage, bool isRequestDataSet, object requestData) { _storage = storage ?? throw new ArgumentNullException(nameof(storage)); IsRequestDataSet = isRequestDataSet; RequestData = requestData; }
public ProductService(IProductRepository productRepository, ICacheStorage cacheStorage) { _productRepository = productRepository; _cacheStorage = cacheStorage; }
public AssetService(ICacheStorage cacheStorage) { CacheStorage = cacheStorage; AssetRepo = new Repository<Asset>(); }
public CountryService(ICacheStorage cacheStorage) { CacheStorage = cacheStorage; CountryRepo = new Repository<Country>(); }
public MonthlyFinancialReportQueryService(IQueryDispatcher dispatcher, ICacheStorage cacheStorage) { _dispatcher = dispatcher; _cacheStorage = cacheStorage; }
public SupplierControllerTest() { _cacheStorage = new NoCacheStorage<string>(); }
public Interface(IAuthentificator authentificator, ICacheStorage cacheStorage, IEventoClient eventoClient) { this.authentificator = authentificator; this.cacheStorage = cacheStorage; this.eventoClient = eventoClient; }
/// <summary> /// Instantiates the cache with the provided cache storage. /// </summary> /// <param name="storage">The cache storage.</param> public Cache(ICacheStorage <T> storage) { Storage = storage ?? throw new ArgumentNullException(nameof(storage)); }
/// <summary> /// 向缓存区中写入信息 /// </summary> /// <param name="content"></param> public abstract void Write(WebPageContext context, Stream content, ICacheStorage storage);
/// <summary> /// 读取缓存区中的流信息 /// </summary> /// <returns></returns> public abstract Stream Read(WebPageContext context, ICacheStorage storage);
public abstract bool IsExpired(WebPageContext context, ICacheStorage storage);
public OrganizationService(ICacheStorage cacheStorage) { CacheStorage = cacheStorage; OrganizationRepo = new Repository<Organization>(); }
public TimeoutCache(ICacheStorage <Entry, T> storage, EntryFactory entryFactory, TimeSpan timeout) { _storage = storage; _entryFactory = entryFactory; _timeout = timeout; }
public void Delete(WebPageContext context, ICacheStorage storage) { }
public FeedProcessingCachingStrategy(ILockServer lockServer, CachingHelper cachingHelper, CachingSettings cachingSettings, IVkGroupRepository groupRepository, IConfigurationProvider configurationProvider, IDateTimeHelper dateTimeHelper, ICacheStorage cacheStorage) { this.cachingHelper = cachingHelper; this.cachingSettings = cachingSettings; this.groupRepository = groupRepository; this.configurationProvider = configurationProvider; this.dateTimeHelper = dateTimeHelper; this.cacheStorage = cacheStorage; this.lockServer = lockServer; this.log = LogManager.GetLogger(); }
public static String GetMenu(int siteId, ICacheStorage adapter, Languages language) { List<Menu> menuList = BllMenu.GetMenu(siteId, adapter); StringWriter stringWriter = new StringWriter(); using (HtmlTextWriter writer = new HtmlTextWriter(stringWriter)) { writer.RenderBeginTag(HtmlTextWriterTag.Ul); // 1 for (int i = 0; i < menuList.Count; i++) { if (!menuList[i].IsAdded) { writer.RenderBeginTag(HtmlTextWriterTag.Li); // 2 AddOnClickOnNoLink(writer, menuList[i]); writer.RenderBeginTag(HtmlTextWriterTag.A); //3 writer.Write(language == Languages.Hindi ? menuList[i].TextHindi : menuList[i].TextEnglish); writer.RenderEndTag(); // End of tag 3 menuList[i].IsAdded = true; AddChild(writer, menuList[i], menuList, language); writer.RenderEndTag(); // End of tag 2 } } writer.RenderEndTag(); //End of Ul tag 1 } foreach (Menu t in menuList) { t.IsAdded = false; } return stringWriter.ToString(); }
public SaleOrderBusiness() { saleOrderDAO = new SaleOrderDAO(); _cacheStorage = new RedisStorage(); }
public PostFacade(IRestClient jsonPlaceholderRestClient, ICacheStorage redisCacheStorage, IConfiguration configuration) => (_jsonPlaceholderRestClient, _redisCacheStorage, _configuration) = (jsonPlaceholderRestClient, redisCacheStorage, configuration);
public Task <T> RegisterRequestAndReturnTask <T>(string key, Func <Task <T> > dataSourceFunc, ICacheStorage cacheStorage, TimeSpan expirationTimeSpan) { var task = _concurrentTasksManager.RunTask(key, dataSourceFunc); AttachTask(task, key, cacheStorage, expirationTimeSpan); return(task); }
protected BaseController(IDbContextFactory contextFactory, ICacheStorage<string> cacheStorage, ILogger logger) { _contextFactory = contextFactory; _cacheStorage = cacheStorage; _logger = logger; }
public RabbitProductController(ICacheStorage cacheStorage) : base() { _cacheStorage = cacheStorage; }
public UserFacade(IRestClient jsonPlaceholderRestClient, ICacheStorage redisCacheStorage, IPostFacade postFacade, IConfiguration configuration) => (_jsonPlaceholderRestClient, _redisCacheStorage, _postFacade, _configuration)
public Stream Read(WebPageContext context, ICacheStorage storage) { return(null); }
public RateService(ICacheStorage cacheStorage) { RateCategoryRepo = new Repository<RateCategory>(); }
public Caching(ICacheStorage storage) { _storage = storage; }
public UserContext(IHttpContextAccessor HttpContextAccessor, IUserService UserService, ICacheStorage CacheStorage) { HttpContext HttpContext = HttpContextAccessor.HttpContext; this.HttpContext = HttpContext; string UserId = HttpContext.User.Identity.GetUserId(); if (!String.IsNullOrEmpty(UserId)) { string CacheKey = CacheKeys.ArtifexUser.UserEntity + UserId; this.CurrentUser = CacheStorage.Retrieve <ArtifexUser>(CacheKey); if (this.CurrentUser == null) { this.CurrentUser = UserService.GetUserById(Convert.ToInt32(UserId)); CacheStorage.Store(CacheKey, this.CurrentUser); } if (this.CurrentUser == null) { throw new UnauthorizedAccessException(); } } }
protected CacheSectionFactory(string key, string sectionKey) : base(key) { _sectionKey = sectionKey; _sectionCacheStorage = new MemoryStorage <List <string> >(); }
public PathFinderCacheDecorator(IPathFinder pathFinder, ICacheStorage<List<CPos>> cacheStorage) { this.pathFinder = pathFinder; this.cacheStorage = cacheStorage; }
public PathFinderUnitPathCacheDecorator(IPathFinder pathFinder, ICacheStorage <List <CPos> > cacheStorage) { this.pathFinder = pathFinder; this.cacheStorage = cacheStorage; }
//依赖注入 public ProductService(IProductRepository productRepository,ICacheStorage cacheStorage) { _productRepository = productRepository; _cacheStorage = cacheStorage; }
public PostCodeProcessor(IPostCodeRestClient postCodeRestClient, ICacheStorage cacheStorage, IConfiguration configuration) => (_postCodeApiClient, _cacheStorage, _configuration) = (postCodeRestClient, cacheStorage, configuration);
public HomeController(IDbContextFactory contextFactory, ICacheStorage<string> cacheStorage, ILogger logger) : base(contextFactory, cacheStorage, logger) { }
public BlogCategoryService(IBlogCategoryRepository repository, ICacheStorage cache, IUnitOfWork uow) { _repository = repository; _cache = cache; _uow = uow; }
public static String GetMarquee(int siteId, ICacheStorage adapter) { List<Marquee> marqueeList = BllMenu.GetMarquee(siteId, adapter); if (marqueeList == null) return String.Empty; StringWriter stringWriter = new StringWriter(); using (HtmlTextWriter writer = new HtmlTextWriter(stringWriter)) { writer.AddAttribute(HtmlTextWriterAttribute.Class, "js-hidden"); writer.AddAttribute(HtmlTextWriterAttribute.Id, "js-news"); writer.RenderBeginTag(HtmlTextWriterTag.Ul); // 1 foreach (Marquee t in marqueeList) { writer.AddAttribute(HtmlTextWriterAttribute.Class, "news-item"); writer.RenderBeginTag(HtmlTextWriterTag.Li); // 2 writer.Write(t.DisplayText); writer.RenderEndTag(); // End of tag 2 } writer.RenderEndTag(); //End of Ul tag 1 } return stringWriter.ToString(); }
public HotelService(ICacheStorage cacheStorage) { CacheStorage = cacheStorage; HotelRepo = new Repository<Hotel>(); }
public void Write(WebPageContext context, Stream content, ICacheStorage storage) { }
public MemberAdvancedSearchCache(ICacheStorage cacheStorage) { this.cacheStorage = cacheStorage; }
public CacheStorageTest() { _dbFileName = $"{nameof(CacheStorageTest)}.temp.db"; _cacheStorage = new CacheStorage(CreateContext, new JsonCacheFormatter()); }
public UserService(IUserRepository userRepository, ICacheStorage cacheStorage) { _userRepository = userRepository; _cacheStorage = cacheStorage; }
public CmsService(ICmsRepository cmsRepository, ICacheStorage cacheStorage) { _cmsRepository = cmsRepository; _cacheStorage = cacheStorage; }
public bool IsExpired(WebPageContext context, ICacheStorage storage) { return(true); }