Ejemplo n.º 1
0
        /// <summary>
        /// 华夏银行签约,他行开户
        /// </summary>
        /// <param name="userid">用户ID</param>
        /// <param name="OpenBank">他行开户信息</param>
        /// <returns>签约结果</returns>
        public ResultDesc ContactToHuaxiaOhterBank(string userid, OpenBankInfo OpenBank)
        {
            ResultDesc rsdc = new ResultDesc();

            TradeUser TdUser = new TradeUser();
            try
            {
                #region 判断用户ID是否为空

                if(string.IsNullOrEmpty(userid))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "用户ID不能为空";
                    return rsdc;
                }
                #endregion
                TdUser = ComFunction.GetTradeUserByUserid(userid);
                //Fundinfo Fdinfo = ComFunction.GetFdinfo(string.Format("select * from Trade_FundInfo where userid='{0}' and state<>'4'", userid));
                string codeDesc = string.Empty;
                string subUser = string.Empty;
                //调用华夏银行子帐户同步接口
                if (!ComFunction.ContactToHuaxiaOhterBank(TdUser, OpenBank, ref codeDesc, ref subUser))
                {
                    rsdc.Result = false;
                    rsdc.Desc = string.Format("华夏银行签约,他行开户时,失败,华夏返回消息:{0}", codeDesc);
                    return rsdc;
                }

                //SQL语句
                List<string> sqlList = new List<string>();
                string sql1 = string.Format("update Trade_FundInfo set state='{0}',ConBankType='1',ConTime='{1}',BankAccount='{2}',AccountName='{3}',BankCard='{4}',OpenBank='{5}',OpenBankAddress='{6}',subUser='******' where userid='{7}' and state<>'{8}'",
                    2, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), OpenBank.BankAccount, OpenBank.AccountName, OpenBank.BankCard, OpenBank.OpenBank, OpenBank.OpenBankAddress, userid, 4, subUser);
                sqlList.Add(sql1);//0代表未签约 1表示审核中 2表示签约成功 3 表示失败 4表示已解约

                if (!ComFunction.SqlTransaction(sqlList))
                {
                     LogNet4.WriteMsg(string.Format("华夏银行签约,他行开户成功,但是SQL语句执行失败,SQL语句是:{0}",sql1));
                }
                rsdc.Result = true;
                rsdc.Desc = "华夏银行签约,他行开户时,成功";
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "华夏银行签约,他行开户时,失败";
            }
            return rsdc;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 签约华夏银行 他行开户
        /// </summary>
        /// <param name="TdUser">用户信息</param>
        /// <param name="openbank">开户行信息</param>
        /// <param name="codeDesc">签约结果代码描述</param>
        /// <param name="subUser">子账号</param>
        /// <returns>成功返回true 失败返回fasle</returns>
        public static bool ContactToHuaxiaOhterBank(TradeUser TdUser, OpenBankInfo openbank, ref string codeDesc, ref string subUser)
        {
            bool IsSuc = false;
            IntersServerImplClient ic = new IntersServerImplClient();
            try
            {
                StringBuilder inXml = new StringBuilder();
                inXml.Append("<HXBB2B>");
                inXml.Append("<MessageData>");

                inXml.Append("<Base>");
                inXml.Append("<Version>1.0</Version>");
                inXml.Append("<SignFlag>0</SignFlag>");
                inXml.Append("<Language>GB2312</Language>");
                inXml.Append("</Base>");

                inXml.Append("<ReqHeader>");
                inXml.AppendFormat("<ClientTime>{0}</ClientTime>", DateTime.Now.ToString("yyyyMMddHHmmss"));
                inXml.Append("<MerchantNo>600014</MerchantNo>");
                inXml.Append("</ReqHeader>");

                inXml.Append("<DataBody>");
                inXml.AppendFormat("<MerTxSerNo>{0}</MerTxSerNo>", TdUser.CashUser);
                inXml.Append("<TrnxCode>DZ020</TrnxCode>");
                inXml.Append("<AccountInfos>");
                inXml.Append("<AccountInfo>");

                inXml.AppendFormat("<MerAccountNo>{0}</MerAccountNo>", GetTanUser(TdUser.TanUser));
                inXml.AppendFormat("<AccountName>{0}</AccountName>", TdUser.UserName);
                inXml.AppendFormat("<AccountProp>{0}</AccountProp>", "0" == TdUser.AccountType ? 1 : 0);//华夏银行接口中,0表示企业1表示个人
                inXml.AppendFormat("<RelatingAcct>{0}</RelatingAcct>", openbank.BankCard);
                inXml.AppendFormat("<RelatingAcctName>{0}</RelatingAcctName>", openbank.AccountName);
                inXml.Append("<InterBankFlag>1</InterBankFlag>");
                inXml.AppendFormat("<RelatingAcctBank>{0}</RelatingAcctBank>", openbank.OpenBank);
                inXml.AppendFormat("<RelatingAcctBankAddr>{0}</RelatingAcctBankAddr>", openbank.OpenBankAddress);
                inXml.AppendFormat("<RelatingAcctBankCode>{0}</RelatingAcctBankCode>", openbank.BankAccount);
                inXml.Append("<Amt></Amt>");
                inXml.Append("<AmtUse></AmtUse>");
                inXml.AppendFormat("<PersonName>{0}</PersonName>", string.IsNullOrEmpty(TdUser.LinkMan) ? string.Empty : TdUser.LinkMan);
                inXml.AppendFormat("<OfficeTel>{0}</OfficeTel>", string.IsNullOrEmpty(TdUser.TelNum) ? string.Empty : TdUser.TelNum);
                inXml.AppendFormat("<MobileTel>{0}</MobileTel>", string.IsNullOrEmpty(TdUser.PhoneNum) ? string.Empty : TdUser.PhoneNum);
                inXml.AppendFormat("<Addr>{0}</Addr>", string.IsNullOrEmpty(TdUser.LinkAdress) ? string.Empty : TdUser.LinkAdress);
                inXml.Append("<ZipCode></ZipCode>");
                inXml.AppendFormat("<LawName>{0}</LawName>", string.IsNullOrEmpty(TdUser.CorporationName) ? string.Empty : TdUser.CorporationName);
                inXml.AppendFormat("<LawType>{0}</LawType>", "1" == TdUser.CardType ? 1 : 6);
                //华夏证件类型:
                //1 – 个人身份证
                //2 – 军人证、警官证
                //3 – 临时证件
                //4 – 户口本
                //5 – 护照
                //6 – 其他

                inXml.AppendFormat("<LawNo>{0}</LawNo>", string.IsNullOrEmpty(TdUser.CardNum) ? string.Empty : TdUser.CardNum);
                inXml.Append("<NoteFlag>1</NoteFlag>");
                inXml.AppendFormat("<NotePhone>{0}</NotePhone>", string.IsNullOrEmpty(TdUser.PhoneNum) ? string.Empty : TdUser.PhoneNum);
                inXml.AppendFormat("<EMail>{0}</EMail>", string.IsNullOrEmpty(TdUser.Email) ? string.Empty : TdUser.Email);
                inXml.AppendFormat("<CheckFlag>{0}</CheckFlag>", "1" == TdUser.AccountType ? 1 : 0);

                inXml.Append("</AccountInfo>");
                inXml.Append("</AccountInfos>");
                inXml.Append("</DataBody>");

                inXml.Append("</MessageData>");
                inXml.Append("</HXBB2B>");
                com.individual.helper.LogNet4.WriteMsg("华夏银行他行签约,请求的Xml报文:" + inXml.ToString());
                string outXml = ic.Process(inXml.ToString());
                com.individual.helper.LogNet4.WriteMsg("华夏银行他行签约,响应的Xml报文:" + outXml);
                XmlDocument xmldoc = new XmlDocument();
                xmldoc.LoadXml(outXml);
                if (HuaxiaSuc == xmldoc.SelectSingleNode("HXBB2B/MessageData/ResHeader/Status/Code").InnerText)
                {
                    subUser = xmldoc.SelectSingleNode("HXBB2B/MessageData/DataBody/AccountInfos/AccountInfo/AccountNo").InnerText;
                    IsSuc = true;
                }
                codeDesc = xmldoc.SelectSingleNode("HXBB2B/MessageData/ResHeader/Status/Message").InnerText;
                ic.Close();
            }
            catch (Exception ex)
            {
                ic.Abort();
                throw new Exception(ex.Message, ex);
            }

            return IsSuc;
        }