Exemplo n.º 1
0
        public void ClearLoginCache()
        {
            var clientUserCache = UserCacheManager.GetClientUserCache(Router.NspClientCachePath);

            clientUserCache.Remove(parentForm.GetEndPoint());
            UserCacheManager.SaveChanges(Router.NspClientCachePath, clientUserCache);
        }
Exemplo n.º 2
0
 public static PodTable.Record GetPodByRes(string res)
 {
     if (!UserCacheManager.ContainesKey("USERCEH_NAMECACHE", res))
     {
         var orgRec = PodTable.GetRecord(new SqlCmdText("CEH_NAME = @cehname and PR_DO = ''", new SqlParam("cehname", res)));
         UserCacheManager.Set("USERCEH_NAMECACHE", res, orgRec);
         return(orgRec);
     }
     return(UserCacheManager.Get <PodTable.Record>("USERCEH_NAMECACHE", Text.Convert(res)));
 }
Exemplo n.º 3
0
 public static OrgTable.Record GetOrgByCode(int org)
 {
     if (!UserCacheManager.ContainesKey("USERCONTRACTORCACHE", Text.Convert(org)))
     {
         var orgRec = OrgTable.GetRecord(org);
         UserCacheManager.Set("USERCONTRACTORCACHE", Text.Convert(org), orgRec);
         return(orgRec);
     }
     return(UserCacheManager.Get <OrgTable.Record>("USERCONTRACTORCACHE", Text.Convert(org)));
 }
Exemplo n.º 4
0
        public void CreateLoginCache(string username, string token)
        {
            var clientUserCache = UserCacheManager.GetClientUserCache(Router.NspClientCachePath);
            var item            = new ClientUserCacheItem()
            {
                UserName = username,
                Token    = token
            };

            clientUserCache[parentForm.GetEndPoint()] = item;
            UserCacheManager.SaveChanges(Router.NspClientCachePath, clientUserCache);
        }
             public override void OnAuthorization(HttpActionContext actionContext)
             {
     
                 Dictionary<HttpStatusCode, string> response;
                 if (SkipAuthorization(actionContext))
                 {
                     return;
                 }
     
                 var userSessionManager = new UserCacheManager();
                 if (userSessionManager.ReValidateSession(out response))
                 {
                     base.OnAuthorization(actionContext);
                 }
                 else
                 {
                     ApiResponse apiResponse = new ApiResponse(response.Values.FirstOrDefault());
                     actionContext.Response = actionContext.ControllerContext.Request.CreateResponse(response.Keys.FirstOrDefault(), apiResponse);
                 }
            
 
  }
 public LoadShopCacheManager(UserCacheManager userCache)
 {
     UserCache = userCache;
 }