/// <summary>
        /// 柜员认证
        /// </summary>
        /// <param name="orgNO">机构号</param>
        /// <param name="tellerNO">柜员号</param>
        /// <param name="password">密码</param>
        /// <param name="encryptPwd">加密后密码</param>
        /// <param name="codemsg">编码串</param>
        /// <returns></returns>
        public static Guid AuthTeller(String orgNO, String tellerNO, string passwords, byte[] encryptPwd, ref byte[] codemsg)
        {
            EncryptTellerAuth tellerLogin = new EncryptTellerAuth(tellerNO, orgNO, DateTime.Now, passwords);
            tellerLogin.TellerData.RQhdrHandler.SYS_TXID = "106330"; // 认证,主机启动原交易码
            tellerLogin.TellerData.RQhdrHandler.TX_MODE = "0";

            tellerLogin.TellerData.RQhdrHandler.SRV_JNO = CommonDataHelper.SpaceString(12);
            tellerLogin.TellerData.RQhdrHandler.SRV_REV_JNO = CommonDataHelper.SpaceString(12);
            tellerLogin.TellerData.RQhdrHandler.HOST_JNO = CommonDataHelper.SpaceString(11);

            tellerLogin.TellerEncrypt.RespPin = encryptPwd;
            tellerLogin.TellerData.RQDTL.SignType = "1";
            tellerLogin.TellerData.RQDTL.PIN_BLK = tellerLogin.TellerEncrypt.RespPin;
            tellerLogin.AfterEncrypt = true;

            return MsgTransfer.CodeMsgToBinary(tellerLogin, ref codemsg);
        }
        public static Guid EncryptPassword(EncryptTellerAuth encryptTeller, ref byte[] codemsg)
        {
            if (encryptTeller != null)
            {
                encryptTeller.AfterEncrypt = false;
            }

            return MsgTransfer.CodeMsgToBinary(encryptTeller, ref codemsg);
        }
        /// <summary>
        /// 机构柜员认证
        /// </summary>
        /// <param name="tellerLogin"></param>
        /// <param name="codemsg"></param>
        /// <returns></returns>
        public static Guid AuthTeller(EncryptTellerAuth tellerLogin, ref byte[] codemsg)
        {
            tellerLogin.TellerData.RQhdrHandler.SYS_TXID = "106330"; // 认证,主机启动原交易码
            tellerLogin.TellerData.RQhdrHandler.TX_MODE = "0";

            tellerLogin.TellerData.RQhdrHandler.SRV_JNO = CommonDataHelper.SpaceString(12);
            tellerLogin.TellerData.RQhdrHandler.SRV_REV_JNO = CommonDataHelper.SpaceString(12);
            tellerLogin.TellerData.RQhdrHandler.HOST_JNO = CommonDataHelper.SpaceString(11);

            tellerLogin.TellerData.RQDTL.PIN_BLK = tellerLogin.TellerEncrypt.RespPin;
            tellerLogin.TellerData.RQDTL.SignType = "1"; //密码方式
            tellerLogin.AfterEncrypt = true;

            return MsgTransfer.CodeMsgToBinary(tellerLogin, ref codemsg);
        }
        private String TestForLogin(StringBuilder result, EncryptTellerAuth respData)
        {
            if (respData == null)
            {
                return result.ToString();
            }

            //if (!String.IsNullOrEmpty(respData.RPhdrHandler.SEQ_NO))
            //{
            //    result.AppendFormat("此交易流水号:{0}", respData.RPhdrHandler.SEQ_NO);
            //    result.AppendLine();
            //}

            if (respData.TellerData.OmsgHandler.NUM_ENT > 0)
            {
                result.AppendFormat("OMSG:{0} item(s)", respData.OmsgHandler.NUM_ENT);
                result.AppendLine();
                foreach (OMSG_Item_Handler omsgItem in respData.OmsgHandler.OMSGItemList)
                {
                    result.AppendFormat("MOD_ID:{0};MSG_NO:{1};MSG_TYPE:{2};MSG_TEXT:{3};", omsgItem.MOD_ID, omsgItem.MSG_NO, omsgItem.MSG_TYPE, omsgItem.MSG_TEXT);
                    result.AppendLine();
                }
            }
            if (!String.IsNullOrEmpty(respData.TellerData.OData.DUE_DATE))
            {
                result.Append("ODATA:");
                result.AppendLine();
                result.Append(respData.TellerData.OData.DUE_DATE);
                result.AppendLine();
            }
            if (!String.IsNullOrEmpty(respData.SyserrHandler.Message))
            {
                result.AppendFormat("SYSERR:{0}", respData.TellerData.SyserrHandler.Message);
            }

            return result.ToString();
        }
        /// <summary>
        /// 密码加密
        /// </summary>
        /// <param name="tellerLogin"></param>
        /// <param name="codemsg"></param>
        /// <returns></returns>
        public static Guid EncryptPassword(String orgNO, String tellerNO, String password, ref byte[] codemsg)
        {
            EncryptTellerAuth tellerLogin = new EncryptTellerAuth(tellerNO, orgNO, DateTime.Now, password);
            tellerLogin.AfterEncrypt = false;

            return MsgTransfer.CodeMsgToBinary(tellerLogin, ref codemsg);
        }
        private void TellerLogin2(EncryptTellerAuth data)
        {
            if (data != null)
            {
                Guid msgID = MsgTransferUtility.AuthTeller(data.TellerData.RQDTL.ORG_NO, data.TellerData.RQDTL.STF_NO, data.TellerEncrypt.ReqPin, data.TellerEncrypt.RespPin, ref uLongText);
                //Guid msgID = MsgTransferUtility.AuthTeller(data, ref uLongText);
                MessageData msgdata = new MessageData { MessageID = msgID, FirstTime = DateTime.Now, TragetPlatform = PlatformType.Core, ReSentTime = 0 };
                msgdata.ReqPackageList.Enqueue(new PackageData(1, uLongText));
                msgdata.IsMultiPackage = false;

                DispatchMsg(msgdata);
            }
        }
        /// <summary>
        /// 柜员认证
        /// </summary>
        /// <param name="orgNO">机构号</param>
        /// <param name="tellerNO">柜员号</param>
        /// <param name="password">密码</param>
        /// <param name="encryptPwd">加密后密码</param>
        /// <param name="codemsg">编码串</param>
        /// <returns></returns>
        public static Guid AuthTeller(String orgNO, String tellerNO, string password, byte[] encryptPwd, ref byte[] codemsg)
        {
            EncryptTellerAuth tellerLogin = new EncryptTellerAuth(tellerNO, orgNO, DateTime.Now, password);
            tellerLogin.TellerData.RQhdrHandler.SYS_TXID = "106330"; // 认证,主机启动原交易码
            tellerLogin.TellerData.RQhdrHandler.TX_MODE = "0";

            tellerLogin.TellerData.RQhdrHandler.SRV_JNO = CommonDataHelper.SpaceString(12);
            tellerLogin.TellerData.RQhdrHandler.SRV_REV_JNO = CommonDataHelper.SpaceString(12);
            tellerLogin.TellerData.RQhdrHandler.HOST_JNO = CommonDataHelper.SpaceString(11);

            tellerLogin.TellerEncrypt.RespPin = encryptPwd;
            tellerLogin.TellerData.RQDTL.SignType = "1";
            tellerLogin.TellerData.RQDTL.PIN_BLK = tellerLogin.TellerEncrypt.RespPin;
            tellerLogin.AfterEncrypt = true;
            try
            {
                return PreProcessReqMsg(tellerLogin, ref codemsg);
            }
            catch (Exception ex)
            {
                throw new Exception(MESSAGE_ENCODE_EXCEPTION, ex);
            }

        }
 public static Guid EncryptPassword(EncryptTellerAuth encryptTeller, ref byte[] codemsg)
 {
     return PreProcessEncryptMsg(encryptTeller, ref codemsg);
 }
 /// <summary>
 /// 密码加密
 /// </summary>
 /// <param name="tellerLogin"></param>
 /// <param name="codemsg"></param>
 /// <returns></returns>
 public static Guid EncryptPassword(String orgNO, String tellerNO, String password, ref byte[] codemsg)
 {
     EncryptTellerAuth tellerLogin = new EncryptTellerAuth(tellerNO, orgNO, DateTime.Now, password);
     tellerLogin.AfterEncrypt = false;
     try
     {
         return PreProcessEncryptMsg(tellerLogin, ref codemsg);
     }
     catch (Exception ex)
     {
         throw new Exception(MESSAGE_ENCODE_EXCEPTION, ex);
     }
 }
        public static Guid PreProcessEncryptMsg(EncryptTellerAuth data, ref byte[] codemsg)
        {
            data.AfterEncrypt = false;
            codemsg = data.TellerEncrypt.ToBytes();
            Guid msgID = Guid.NewGuid();
            // 写数据库
            // ....

            // 插入已发送列表
            InsertMsgList(msgID, data);
            return msgID;
        }