Ejemplo n.º 1
0
 public Response08(byte[] MessageInfo)
 {
     this.ByteMessageInfo = MessageInfo;
     this.MessageInfo     = Encod.GetString(MessageInfo);
     SetStruct();
     SetValue();
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 字符串转换为对象
 /// </summary>
 public override void SetValue()
 {
     if (MessageInfo != null && MessageInfo != "")
     {
         this.PackageLength = Encod.GetString(ByteMessageInfo, 0, PakageLengthDic["PackageLength"]);
         this.BusinessCode  = Encod.GetString(ByteMessageInfo, PakageLengthDic["PackageLength"], PakageLengthDic["BusinessCode"]);
         this.ReturnCode    = Encod.GetString(ByteMessageInfo, PakageLengthDic["PackageLength"] + PakageLengthDic["BusinessCode"], PakageLengthDic["ReturnCode"]);
         if ("00".Equals(ReturnCode))
         {
             int start = PakageLengthDic["PackageLength"] + PakageLengthDic["BusinessCode"] + PakageLengthDic["ReturnCode"];
             this.PaymentID        = Encod.GetString(ByteMessageInfo, start, PakageLengthDic["PaymentID"]);
             start                 = start + PakageLengthDic["PaymentID"];
             this.PaymentAmount    = decimal.Parse(Encod.GetString(ByteMessageInfo, start, PakageLengthDic["PaymentAmount"]));
             start                 = start + PakageLengthDic["PaymentAmount"];
             this.ReceiverAccount  = Encod.GetString(ByteMessageInfo, start, PakageLengthDic["ReceiverAccount"]);
             start                 = start + PakageLengthDic["ReceiverAccount"];
             this.ReceiverName     = Encod.GetString(ByteMessageInfo, start, PakageLengthDic["ReceiverName"]);
             start                 = start + PakageLengthDic["ReceiverName"];
             this.ReceiverBankName = Encod.GetString(ByteMessageInfo, start, PakageLengthDic["ReceiverBankName"]);
             start                 = start + PakageLengthDic["ReceiverBankName"];
             this.PayerAccount     = Encod.GetString(ByteMessageInfo, start, PakageLengthDic["PayerAccount"]);
             start                 = start + PakageLengthDic["PayerAccount"];
             this.PayerName        = Encod.GetString(ByteMessageInfo, start, PakageLengthDic["PayerName"]);
             start                 = start + PakageLengthDic["PayerName"];
             this.PayBank          = Encod.GetString(ByteMessageInfo, start, PakageLengthDic["PayBank"]);
             start                 = start + PakageLengthDic["PayBank"];
             this.PaymentInstr     = Encod.GetString(ByteMessageInfo, start, PakageLengthDic["PaymentInstr"]);
             start                 = start + PakageLengthDic["PaymentInstr"];
             this.ProjectID        = Encod.GetString(ByteMessageInfo, start, PakageLengthDic["ProjectID"]);
         }
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 字符串转换为对象
 /// </summary>
 public override void SetValue()
 {
     if (MessageInfo != null && MessageInfo != "")
     {
         //this.PackageLength = MessageInfo.Substring(0, PakageLengthDic["PackageLength"]);
         this.PackageLength = Encod.GetString(ByteMessageInfo, 0, PakageLengthDic["PackageLength"]);
         //this.BusinessCode = MessageInfo.Substring(PakageLengthDic["PackageLength"], PakageLengthDic["BusinessCode"]);
         this.BusinessCode = Encod.GetString(ByteMessageInfo, PakageLengthDic["PackageLength"], PakageLengthDic["BusinessCode"]);
         this.ReturnCode   = Encod.GetString(ByteMessageInfo, PakageLengthDic["PackageLength"] + PakageLengthDic["BusinessCode"], PakageLengthDic["ReturnCode"]);
         if ("00".Equals(ReturnCode))
         {
             int start = PakageLengthDic["PackageLength"] + PakageLengthDic["BusinessCode"] + PakageLengthDic["ReturnCode"];
             this.DepositID      = Encod.GetString(ByteMessageInfo, start, PakageLengthDic["DepositID"]);
             start               = start + PakageLengthDic["DepositID"];
             this.DepositAccount = Encod.GetString(ByteMessageInfo, start, PakageLengthDic["DepositAccount"]);
             start               = start + PakageLengthDic["DepositAccount"];
             this.FirmName       = Encod.GetString(ByteMessageInfo, start, PakageLengthDic["FirmName"]);
             start               = start + PakageLengthDic["FirmName"];
             this.DepositType    = Encod.GetString(ByteMessageInfo, start, PakageLengthDic["DepositType"]);
             start               = start + PakageLengthDic["DepositType"];
             this.DepositAmount  = decimal.Parse(Encod.GetString(ByteMessageInfo, start, PakageLengthDic["DepositAmount"]));
             start               = start + PakageLengthDic["DepositAmount"];
             this.PurchaserName  = Encod.GetString(ByteMessageInfo, start, PakageLengthDic["PurchaserName"]).Split(' ')[0];//多个购房人时为第一顺位购房人
             start               = start + PakageLengthDic["PurchaserName"];
             this.PurchaserID    = Encod.GetString(ByteMessageInfo, start, PakageLengthDic["PurchaserID"]);
             start               = start + PakageLengthDic["PurchaserID"];
             this.ProjectCode    = Encod.GetString(ByteMessageInfo, start, PakageLengthDic["ProjectCode"]);
         }
     }
 }
Ejemplo n.º 4
0
        private const int OutTimeConn = 10000; //连接时间超时  5秒

        public BaseResponse SendMessage(BaseRequest bmr, string WebsiteCode, string TellerCode)
        {
            TimeoutObject.Reset();
            BaseResponse result = null;

            _socket.BeginConnect(new IPEndPoint(IPAddress.Parse(RemoteIP), RemotePort), delegate(IAsyncResult ar) { TimeoutObject.Set(); }, _socket);
            if (TimeoutObject.WaitOne(OutTimeConn, false))
            {
                _socket.ReceiveTimeout = OutTime;
                _socket.SendTimeout    = OutTime;
                string str = bmr.ObjectToMessage();
                _socket.Send(Encod.GetBytes(str));
                len = _socket.Receive(buffer);

                if (len > 0)
                {
                    string strbuff = Encod.GetString(buffer);
                    switch (bmr.BusinessCode)
                    {
                    case "01": result = new Response01(buffer); break;

                    case "02": result = new Response02(buffer); break;

                    case "03": result = new Response03(buffer); break;

                    case "04": result = new Response04(buffer); break;

                    case "05": result = new Response05(buffer); break;

                    case "06": result = new Response06(buffer); break;

                    case "07": result = new Response07(buffer); break;

                    case "08": result = new Response08(buffer); break;

                    case "09": result = new Response09(buffer); break;

                    default: return(null);
                    }
                }
                bmr.SaveMessage(WebsiteCode, TellerCode);
                if (result != null)
                {
                    result.BankCode = bmr.BankCode;
                    result.SaveMessage(WebsiteCode, TellerCode);
                }
                return(result);
            }
            else
            {
                if (_socket.Connected)
                {
                    _socket.Shutdown(SocketShutdown.Both);
                    _socket.Close();
                }
                throw new Exception("所提供的服务器连接超时");
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 字符串转换为对象
 /// </summary>
 public override void SetValue()
 {
     if (MessageInfo != null && MessageInfo != "")
     {
         this.PackageLength = Encod.GetString(ByteMessageInfo, 0, PakageLengthDic["PackageLength"]);
         this.BusinessCode  = Encod.GetString(ByteMessageInfo, PakageLengthDic["PackageLength"], PakageLengthDic["BusinessCode"]);
         this.ReturnCode    = Encod.GetString(ByteMessageInfo, PakageLengthDic["PackageLength"] + PakageLengthDic["BusinessCode"], PakageLengthDic["ReturnCode"]);
     }
 }