Cgw.External.GatewayExternal.CheckSession C# (CSharp) Method

CheckSession() private method

检查Session
private CheckSession ( ) : SmcErr
return Cgw.SmcError.SmcErr
        private SmcErr CheckSession()
        {
            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
            SmcErr err = new CgwError();
            CGWSession CgwSession = null;
            if (OperationContext.Current != null)
            {
                string strSessionId = OperationContext.Current.SessionId;
                err = SessionManage.Instance().GetSessionsBySessionId(strSessionId, out CgwSession);

                if (err.IsSuccess() == false || CgwSession == null)
                {
                    err.SetErrorNo(CgwError.ERR_CGW_BUSINESS_SESSION_NULL);
                }
                else
                {
                    //更新Session最后访问时间
                    CgwSession.LastVisitedTime = DateTime.Now;
                    logEx.Trace("Current SessionId is:{0}, LastVisitedTime is :{1}", strSessionId, CgwSession.LastVisitedTime.ToLongTimeString());
                }
            }
            else
            {
                err.SetErrorNo(CgwError.ERR_CGW_BUSINESS_CURRENTSESSION_NULL);
            }

            return err;
        }