Exemplo n.º 1
0
 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();
 }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
 /// <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;
 }
Exemplo n.º 7
0
 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;
 }
Exemplo n.º 8
0
 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;
 }
Exemplo n.º 9
0
        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;
        }
Exemplo n.º 10
0
        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;
        }
Exemplo n.º 11
0
 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;
 }
Exemplo n.º 12
0
        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;
        }
Exemplo n.º 13
0
        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;
        }
Exemplo n.º 14
0
        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;
        }
Exemplo n.º 15
0
        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;
        }
Exemplo n.º 16
0
        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;
        }
Exemplo n.º 17
0
 public User(IUserRepository userRepository, ICacheStorage cacheStorage)
     : base(userRepository, cacheStorage)
 {
 }
Exemplo n.º 18
0
        public UserService(ICacheStorage cacheStorage)
        {
            CacheStorage = cacheStorage;

            UserRepo = new Repository<User>();
        }
Exemplo n.º 19
0
        /// <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);
            }
        }
Exemplo n.º 20
0
 public CacheManagerFeature(ICacheStorage storage, bool isRequestDataSet, object requestData)
 {
     _storage         = storage ?? throw new ArgumentNullException(nameof(storage));
     IsRequestDataSet = isRequestDataSet;
     RequestData      = requestData;
 }
Exemplo n.º 21
0
 public ProductService(IProductRepository productRepository, ICacheStorage cacheStorage)
 {
     _productRepository = productRepository;
     _cacheStorage      = cacheStorage;
 }
Exemplo n.º 22
0
        public AssetService(ICacheStorage cacheStorage)
        {
            CacheStorage = cacheStorage;

            AssetRepo = new Repository<Asset>();
        }
Exemplo n.º 23
0
        public CountryService(ICacheStorage cacheStorage)
        {
            CacheStorage = cacheStorage;

            CountryRepo = new Repository<Country>();
        }
Exemplo n.º 24
0
 public MonthlyFinancialReportQueryService(IQueryDispatcher dispatcher, ICacheStorage cacheStorage)
 {
     _dispatcher   = dispatcher;
     _cacheStorage = cacheStorage;
 }
 public SupplierControllerTest()
 {
     _cacheStorage = new NoCacheStorage<string>();
 }
Exemplo n.º 26
0
 public Interface(IAuthentificator authentificator, ICacheStorage cacheStorage, IEventoClient eventoClient)
 {
     this.authentificator = authentificator;
     this.cacheStorage    = cacheStorage;
     this.eventoClient    = eventoClient;
 }
Exemplo n.º 27
0
 /// <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));
 }
Exemplo n.º 28
0
 /// <summary>
 /// 向缓存区中写入信息
 /// </summary>
 /// <param name="content"></param>
 public abstract void Write(WebPageContext context, Stream content, ICacheStorage storage);
Exemplo n.º 29
0
 /// <summary>
 /// 读取缓存区中的流信息
 /// </summary>
 /// <returns></returns>
 public abstract Stream Read(WebPageContext context, ICacheStorage storage);
Exemplo n.º 30
0
 public abstract bool IsExpired(WebPageContext context, ICacheStorage storage);
Exemplo n.º 31
0
        public OrganizationService(ICacheStorage cacheStorage)
        {
            CacheStorage = cacheStorage;

            OrganizationRepo = new Repository<Organization>();
        }
Exemplo n.º 32
0
 public TimeoutCache(ICacheStorage <Entry, T> storage, EntryFactory entryFactory, TimeSpan timeout)
 {
     _storage      = storage;
     _entryFactory = entryFactory;
     _timeout      = timeout;
 }
Exemplo n.º 33
0
 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();
 }
Exemplo n.º 35
0
        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();
        }
Exemplo n.º 36
0
 public SaleOrderBusiness()
 {
     saleOrderDAO  = new SaleOrderDAO();
     _cacheStorage = new RedisStorage();
 }
Exemplo n.º 37
0
 public PostFacade(IRestClient jsonPlaceholderRestClient, ICacheStorage redisCacheStorage, IConfiguration configuration)
 => (_jsonPlaceholderRestClient, _redisCacheStorage, _configuration) = (jsonPlaceholderRestClient, redisCacheStorage, configuration);
Exemplo n.º 38
0
        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);
        }
Exemplo n.º 39
0
 protected BaseController(IDbContextFactory contextFactory, ICacheStorage<string> cacheStorage, ILogger logger)
 {
     _contextFactory = contextFactory;
     _cacheStorage = cacheStorage;
     _logger = logger;
 }
Exemplo n.º 40
0
 public RabbitProductController(ICacheStorage cacheStorage) : base()
 {
     _cacheStorage = cacheStorage;
 }
Exemplo n.º 41
0
 public UserFacade(IRestClient jsonPlaceholderRestClient, ICacheStorage redisCacheStorage, IPostFacade postFacade, IConfiguration configuration)
 => (_jsonPlaceholderRestClient, _redisCacheStorage, _postFacade, _configuration)
Exemplo n.º 42
0
 public Stream Read(WebPageContext context, ICacheStorage storage)
 {
     return(null);
 }
Exemplo n.º 43
0
 public RateService(ICacheStorage cacheStorage)
 {
     RateCategoryRepo = new Repository<RateCategory>();
 }
Exemplo n.º 44
0
 public Caching(ICacheStorage storage)
 {
     _storage = storage;
 }
Exemplo n.º 45
0
        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();
                }
            }
        }
Exemplo n.º 46
0
 protected CacheSectionFactory(string key, string sectionKey) : base(key)
 {
     _sectionKey          = sectionKey;
     _sectionCacheStorage = new MemoryStorage <List <string> >();
 }
Exemplo n.º 47
0
 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;
 }
Exemplo n.º 49
0
 //依赖注入
 public ProductService(IProductRepository productRepository,ICacheStorage cacheStorage)
 {
     _productRepository = productRepository;
     _cacheStorage = cacheStorage;
 }
 public PostCodeProcessor(IPostCodeRestClient postCodeRestClient, ICacheStorage cacheStorage, IConfiguration configuration) =>
 (_postCodeApiClient, _cacheStorage, _configuration) = (postCodeRestClient, cacheStorage, configuration);
Exemplo n.º 51
0
 public HomeController(IDbContextFactory contextFactory, ICacheStorage<string> cacheStorage, ILogger logger)
     : base(contextFactory, cacheStorage, logger)
 {
 }
Exemplo n.º 52
0
 public BlogCategoryService(IBlogCategoryRepository repository, ICacheStorage cache, IUnitOfWork uow)
 {
     _repository = repository;
     _cache      = cache;
     _uow        = uow;
 }
Exemplo n.º 53
0
 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();
 }
Exemplo n.º 54
0
        public HotelService(ICacheStorage cacheStorage)
        {
            CacheStorage = cacheStorage;

            HotelRepo = new Repository<Hotel>();
        }
Exemplo n.º 55
0
 public void Write(WebPageContext context, Stream content, ICacheStorage storage)
 {
 }
Exemplo n.º 56
0
 public MemberAdvancedSearchCache(ICacheStorage cacheStorage)
 {
     this.cacheStorage = cacheStorage;
 }
Exemplo n.º 57
0
 public CacheStorageTest()
 {
     _dbFileName   = $"{nameof(CacheStorageTest)}.temp.db";
     _cacheStorage = new CacheStorage(CreateContext, new JsonCacheFormatter());
 }
Exemplo n.º 58
0
 public UserService(IUserRepository userRepository, ICacheStorage cacheStorage)
 {
     _userRepository = userRepository;
     _cacheStorage   = cacheStorage;
 }
Exemplo n.º 59
0
 public CmsService(ICmsRepository cmsRepository, ICacheStorage cacheStorage)
 {
     _cmsRepository = cmsRepository;
     _cacheStorage  = cacheStorage;
 }
Exemplo n.º 60
0
 public bool IsExpired(WebPageContext context, ICacheStorage storage)
 {
     return(true);
 }