예제 #1
0
        public List <ActionPower> GetBusPower(string userNo, byte issupper)
        {
            string             conn            = ConfigurationManager.ConnectionStrings["Gungnir_AlwaysOnRead"].ConnectionString;
            IConnectionManager connManager     = new ConnectionManager(SecurityHelp.IsBase64Formatted(conn) ? SecurityHelp.DecryptAES(conn) : conn);
            IDBScopeManager    dbscope         = new DBScopeManager(connManager);
            PowerHandle        pHandle         = new PowerHandle(dbscope);
            List <ActionPower> actionPowerList = new List <ActionPower>();

            try
            {
                //var cache = CacheFactory.Create(CacheType.CouchBase);
                //var key = EnOrDeHelper.GetMd5(userNo + "power!@#$", Encoding.UTF8);
                //cache.TryGet(key, out actionPowerList);

                //if (actionPowerList != null && actionPowerList.Count != 0)
                //    return actionPowerList;
                var key = EnOrDeHelper.GetMd5(userNo + "power!@#$", Encoding.UTF8);
                using (var client = CacheHelper.CreateCacheClient("Setting"))
                {
                    return((client.GetOrSet(key, () => pHandle.GetBusPower(userNo, issupper),
                                            new TimeSpan(1, 0, 0)))?.Value ?? new List <ActionPower>());
                }
            }
            catch
            {
                actionPowerList = pHandle.GetBusPower(userNo, issupper);
            }
            return(actionPowerList);
        }
 public PowerManagerReader()
 {
     handler = new PowerHandle(dbScopeManager);
 }
예제 #3
0
 public PowerManage()
 {
     handler      = new PowerHandle(dbScopeManager);
     powerHandler = new PowerHandle(powerBbScopeManager);
 }