Exemple #1
0
        public override object Do(object obj)
        {
            WSTokenIsExpiredSV bpObj = (WSTokenIsExpiredSV)obj;

            if (bpObj.WSTokenDTO == null)
            {
                throw new BpParameterException("WSTokenIsExpiredSV", "WSTokenDTO");
            }
            WSTokenDTOData wsTokenDTO = bpObj.WSTokenDTO;
            WSToken        wsToken    = WSToken.Finder.Find("TokenStr = @TokenStr", new OqlParam("TokenStr", wsTokenDTO.TokenStr));

            if (wsToken == null)
            {
                return(true);
            }
            if (!wsToken.IsAlive)
            {
                return(true);
            }
            //Token操时秒数
            int      timeoutSecond = WSHelper.GetTokenTimeoutSecond();
            TimeSpan timeout       = TimeSpan.FromSeconds(timeoutSecond);
            DateTime now           = DateTime.Now;
            DateTime d             = wsToken.LastUpdateTime;
            bool     isExpired     = now - d > timeout;

            if (!isExpired)
            {
                return(false);
            }
            using (ISession s = Session.Open())
            {
                wsToken.IsAlive     = false;
                wsToken.InvalidTime = DateTime.Now;
                s.InList(wsToken);
                s.Commit();
            }
            return(true);
        }
Exemple #2
0
        //[OperationBehavior]
        public System.Boolean DoEx(ICommonDataContract commonData, UFIDA.U9.Cust.Pub.WSM.WSTokenSV.WSTokenDTOData wSTokenDTO)
        {
            this.CommonData = commonData;
            try
            {
                BeforeInvoke("UFIDA.U9.Cust.Pub.WSM.WSTokenSV.WSTokenIsExpiredSV");
                WSTokenIsExpiredSV objectRef = new WSTokenIsExpiredSV();
                objectRef.WSTokenDTO = wSTokenDTO;

                //处理返回类型.
                System.Boolean result = objectRef.Do();
                return(result);
            }
            catch (System.Exception e)
            {
                DealException(e);
                throw;
            }
            finally
            {
                FinallyInvoke("UFIDA.U9.Cust.Pub.WSM.WSTokenSV.WSTokenIsExpiredSV");
            }
        }