Beispiel #1
0
 public LibHandle(LibHandeleType type, string userId, string roleId)
 {
     _Handle          = Guid.NewGuid().ToString();
     this._Type       = type;
     this._UserId     = userId;
     this._CreateTime = DateTime.Now;
     this._RoleId     = roleId;
 }
Beispiel #2
0
 public LibHandle(LibHandeleType type, string userId, string personId, string personName, string roleId, string loginIp)
 {
     _Handle          = Guid.NewGuid().ToString();
     this._Type       = type;
     this._UserId     = userId;
     this._PersonId   = personId;
     this._PersonName = personName;
     this._CreateTime = DateTime.Now;
     this._RoleId     = roleId;
     this._LoginIp    = loginIp;
 }
Beispiel #3
0
        public LibHandle IsExistsHandle(LibHandeleType handleType, string userId, bool checkHandleType = true)
        {
            LibHandle            destHandle = null;
            IEnumerator <string> enumerator = _Default.GetKeys();

            while (enumerator.MoveNext())
            {
                LibHandle handle = this.Get <LibHandle>(enumerator.Current);
                if (handle != null && string.Compare(userId, handle.UserId, false) == 0
                    &&
                    (checkHandleType == false || handleType == handle.Type)
                    )
                {
                    destHandle = handle;
                    break;
                }
            }
            return(destHandle);
        }
Beispiel #4
0
        public LibHandle GetHandle(string handle, LibHandeleType handleType, string userId, string personId, string personName, string roleId, string loginIp)
        {
            LibHandle libHandle = null;

            if (!string.IsNullOrEmpty(handle))
            {
                libHandle = this.Get <LibHandle>(handle);
            }
            if (libHandle == null && !string.IsNullOrEmpty(userId))
            {
                //CacheItemPolicy policy = new CacheItemPolicy();
                //policy.SlidingExpiration = ; //20分钟内不访问自动剔除,前端每15分钟定时取一下handle表示在用
                libHandle = new LibHandle(handleType, userId, personId, personName, roleId);

                libHandle.LogIp = loginIp;//Zhangkj20161219 增加LoginIp

                //policy.RemovedCallback += CacheEntryRemovedCallback;
                this.Set(libHandle.Handle, libHandle);

                RaiseNewLogin(libHandle);
            }
            return(libHandle);
        }
Beispiel #5
0
 public LibHandle GetHandle(string handle, LibHandeleType handleType, string userId, string personId, string personName, string roleId)
 {
     return(GetHandle(handle, handleType, userId, personId, personName, roleId, string.Empty));
 }