public PayInfoAddToEditVM(Response04 PayResponse, FundPayment df, ObservableCollection <FundPayment> Models) { this.PayResponse = new Response04(); this.PayResponse = PayResponse; this.df = df; this.Models = Models; }
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("所提供的服务器连接超时"); } }