Ejemplo n.º 1
0
        public bool Check(CheckCode code)
        {
            if (code.Key == null || code.Code == null)
            {
                Errors = new ErrorInfo(ErrorDescription.CHECK_CODE_ERROR, ErrorDescription.CHECK_CODE_ERROR_MSG);
                return(false);
            }
            try
            {
                ISessionDaoStub stub    = new SessionDaoStubFac().Get();
                byte[]          content = stub.getSession(3000, code.Key);
                string          codeStr = System.Text.UTF8Encoding.UTF8.GetString(content);
                if (codeStr.Trim().ToLower()
                    .Equals(code.Code.Trim().ToLower()))
                {
                    return(true);
                }
            }
            catch (Exception e)
            {
                //SowayLog.Log.Error("set session fail", e);

                Errors = new ErrorInfo(ErrorDescription.CODE_SYSTEM_ERROR, ErrorDescription.MESSAGE_SYSTEM_ERROR);
            }
            return(false);
        }
Ejemplo n.º 2
0
        protected ChkCodeImg GetCheckCode()
        {
            ChkCodeImg chkImg = CheckCodeFac.GetCheckCode();

            try
            {
                ISessionDaoStub stub = new  SessionDaoStubFac().Get();
                stub.updateSession(3000, chkImg.Key, System.Text.UTF8Encoding.UTF8.GetBytes(chkImg.CheckCode), 60);
            }
            catch (Exception e)
            {
                Errors = new ErrorInfo(ErrorDescription.CODE_SYSTEM_ERROR, ErrorDescription.MESSAGE_SYSTEM_ERROR);
            }

            return(chkImg);
        }