Ejemplo n.º 1
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.º 2
0
 /// <summary>
 /// 添加记录
 /// </summary>
 public override void OKExecute()
 {
     try
     {
         FundsRegulatoryClient.SqlTransSvr.FundPayment fptemp = new FundsRegulatoryClient.SqlTransSvr.FundPayment();
         string strAskMessage = "付款凭证编号:" + df.PaymentID + "\r\n应支付款金额:" + df.PaymentAmount + "\r\n收款人账号:" + df.ReceiverAccount + "\r\n收款人名称:" + df.ReceiverName +
                                "\r\n付款人账号:" + df.PayAccount + "\r\n付款人名称:" + df.PayName;
         if (VMHelp.AskMessage(strAskMessage + "\r\n确认进行冲正?"))
         {
             fptemp.BusinessCode     = CurrentObj.BusinessCode = FinancialRegulation.Tools.PublicData.ReverseFund;
             fptemp.PaymentID        = CurrentObj.PaymentID = df.PaymentID;
             fptemp.BankSerialNumber = CurrentObj.ReverseSerialNum = df.SerialNumber;//本系统产生的流水号
             fptemp.ReceiveBank      = CurrentObj.ReverseBank = df.PaymentBank;
             fptemp.BankSiteID       = CurrentObj.BankSiteID = df.BankSiteID;
             fptemp.BankTellerID     = CurrentObj.BankTellerID = df.BankTellerID;
             fptemp.PayID            = df.PayID;
             fptemp.FirmName         = df.FirmName;
             CurrentObj.BankCode     = df.BankCode;
             CurrentObj.ReverseType  = Tools.PublicData.ReversePay;//支付冲正
             response = SendMessage <Response06>(CurrentObj, VMHelp.PointCode, VMHelp.UserCode);
             if (response.ReturnCode != Tools.PublicData.ResponseSuccess)
             {
                 VMHelp.ShowMessage(HelpClass.Current.MsgDIC[response.ReturnCode], false); return;
             }
             fptemp.PayState     = df.PayState = Tools.PublicData.ReverseA;
             fptemp.ReverseTime  = df.ReverseTime = DateTime.Now;
             fptemp.ReverseInstr = df.ReverseInstr = CurrentObj.ReverseInstr;
             fptemp.BankSiteID   = VMHelp.PointCode;
             fptemp.BankTellerID = VMHelp.UserCode;
             fptemp.BusinessCode = df.BusinessCode = FinancialRegulation.Tools.PublicData.ReverseFund;
             // fptemp.PayID = df.PayID;
             //if (!deClient.Update(df))
             //{
             //    VMHelp.ShowMessage("支付数据更新失败",false);
             //    return;
             //}
             FundsRegulatoryClient.JG_AccountManageSrv.JG_AccountManageInfo ami = new FundsRegulatoryClient.JG_AccountManageSrv.JG_AccountManageInfo();
             ami.AM_JgAccount = df.PayAccount;
             ObservableCollection <FundsRegulatoryClient.JG_AccountManageSrv.JG_AccountManageInfo> acc = accountClient.Select(ami);
             FundsRegulatoryClient.InterestService.DayBalance db = new FundsRegulatoryClient.InterestService.DayBalance();
             db.DB_ID   = acc[0].AM_ID;
             db.DB_Time = DateTime.Parse(DateTime.Now.ToShortDateString());
             ObservableCollection <FundsRegulatoryClient.InterestService.DayBalance> dblist = new ObservableCollection <FundsRegulatoryClient.InterestService.DayBalance>();
             dblist = InterestClient.SelectJG_DayBalanceInfo(db);
             if (dblist.Count < 1)
             {
                 VMHelp.ShowMessage("支付失败,数据无今日余额", false);
                 return;
             }
             FundsRegulatoryClient.SqlTransSvr.DayBalance temp = new FundsRegulatoryClient.SqlTransSvr.DayBalance();
             temp.DB_Balance      = dblist[0].DB_Balance;
             temp.DB_InterestRate = dblist[0].DB_InterestRate;
             temp.DB_Balance      = temp.DB_Balance + df.PaymentAmount;
             temp.ID      = dblist[0].ID;
             temp.DB_ID   = acc[0].AM_ID;
             temp.DB_Time = DateTime.Parse(DateTime.Now.ToShortDateString());
             if (!TranClient.Update_DbAndPF(temp, fptemp, 2))
             {
                 VMHelp.ShowMessage("失败原因:\r\n 1、支付表状态更新失败 \r\n 2、当日余额更新失败", false);
                 return;
             }
             //if (!InterestClient.UpdateJG_DayBalanceInfo(db))
             //{
             //    VMHelp.ShowMessage("今日余额更新失败", false);
             //    return;
             //}
             VMHelp.ShowMessage(true);
             windowOK();
         }
     }
     catch (Exception e)
     {
         SendExcetpion(e);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 添加记录
        /// </summary>
        public override void OKExecute()
        {
            try
            {
                FundsRegulatoryClient.SqlTransSvr.DepositFund dftemp = new FundsRegulatoryClient.SqlTransSvr.DepositFund();
                string strAskMessage = "缴款凭证编号:" + df.DepositNum + "\r\n缴款类型:" + VMHelp.GetMoneyType(df.DepositType) + "\r\n缴款金额:" + df.DepositAmount + "\r\n购房人名称:" + df.PurchaserName + "\r\n购房人证件号:" + df.PurchaserID;
                if (VMHelp.AskMessage(strAskMessage + "\r\n确认进行冲正?"))
                {
                    dftemp.BusinessCode    = CurrentObj.BusinessCode = FinancialRegulation.Tools.PublicData.ReverseFund;
                    dftemp.DepositNum      = CurrentObj.PaymentID = df.DepositNum;
                    dftemp.DeSerialNumber  = CurrentObj.ReverseSerialNum = df.SerialNumber;//本系统产生的流水号
                    dftemp.BankName        = CurrentObj.ReverseBank = df.BankName;
                    dftemp.FirmName        = df.FirmName;
                    dftemp.BankSiteID      = CurrentObj.BankSiteID = df.BankSiteID;
                    dftemp.BankTellerID    = CurrentObj.BankTellerID = df.BankTellerID;
                    dftemp.ID              = df.ID;
                    dftemp.BankSiteID      = VMHelp.PointCode;
                    dftemp.BankTellerID    = VMHelp.UserCode;
                    CurrentObj.BankCode    = df.BankCode;
                    CurrentObj.ReverseType = Tools.PublicData.ReverseDeposit;                           //存款冲正
                    response = SendMessage <Response06>(CurrentObj, VMHelp.PointCode, VMHelp.UserCode); //发送Messageresponse.ReturnCode =="03"
                    //if (response.ReturnCode != Tools.PublicData.ResponseSuccess && response.ReturnCode == Tools.PublicData.ReverseSucces)
                    //{ VMHelp.ShowMessage("原交易不存在无法冲正", false); return; }
                    //if (response.ReturnCode == Tools.PublicData.DepositSuccess && !VMHelp.AskMessage("缴款书已完成缴费,是否存数据库?"))
                    //{
                    //    return;
                    //}
                    //返回码为失败时
                    if (response.ReturnCode != Tools.PublicData.ResponseSuccess)
                    {
                        VMHelp.ShowMessage(HelpClass.Current.MsgDIC[response.ReturnCode], false); return;
                    }

                    dftemp.DepositState = df.DepositState = Tools.PublicData.ReverseA;
                    dftemp.ReverseTime  = df.ReverseTime = DateTime.Now;
                    dftemp.ReverseInstr = df.ReverseInstr = CurrentObj.ReverseInstr;
                    dftemp.BusinessCode = df.BusinessCode = FinancialRegulation.Tools.PublicData.ReverseFund;

                    FundsRegulatoryClient.JG_AccountManageSrv.JG_AccountManageInfo ami = new FundsRegulatoryClient.JG_AccountManageSrv.JG_AccountManageInfo();
                    ami.AM_JgAccount = df.DepositAccount;
                    ObservableCollection <FundsRegulatoryClient.JG_AccountManageSrv.JG_AccountManageInfo> acc = accountClient.Select(ami);
                    FundsRegulatoryClient.InterestService.DayBalance db = new FundsRegulatoryClient.InterestService.DayBalance();
                    db.DB_ID   = acc[0].AM_ID;
                    db.DB_Time = DateTime.Parse(DateTime.Now.ToShortDateString());
                    ObservableCollection <FundsRegulatoryClient.InterestService.DayBalance> dblist = new ObservableCollection <FundsRegulatoryClient.InterestService.DayBalance>();
                    dblist = InterestClient.SelectJG_DayBalanceInfo(db);
                    if (dblist.Count < 1)
                    {
                        VMHelp.ShowMessage("冲正失败,数据无今日余额", false);
                        return;
                    }
                    FundsRegulatoryClient.SqlTransSvr.DayBalance temp = new FundsRegulatoryClient.SqlTransSvr.DayBalance();
                    temp.DB_Balance      = dblist[0].DB_Balance;
                    temp.DB_InterestRate = dblist[0].DB_InterestRate;
                    temp.DB_Balance      = temp.DB_Balance - df.DepositAmount;
                    temp.ID      = dblist[0].ID;
                    temp.DB_ID   = acc[0].AM_ID;
                    temp.DB_Time = DateTime.Parse(DateTime.Now.ToShortDateString());
                    if (!TranClient.Update_DbAndDF(temp, dftemp, 2))
                    {
                        VMHelp.ShowMessage("失败原因:\r\n 1、存款表状态更新失败 \r\n 2、当日余额更新失败", false);
                        return;
                    }
                    VMHelp.ShowMessage(true);
                    windowOK();
                }
            }
            catch (Exception e)
            {
                SendExcetpion(e);
            }
        }