/// <summary>
 /// Convert MoneyInventory to FundInformation.
 /// </summary>
 /// <param name="moneyInfo">MoneyInventory</param>
 /// <returns>FundInformation</returns>
 internal static FundInformation ToFundInformation(MoneyInventory moneyInfo)
 {
     return(new FundInformation
     {
         AccountBalance = moneyInfo.FdInfo.Money,
         FrozenDeposit = moneyInfo.FdInfo.FrozenMoney,
         OccupiedDeposit = moneyInfo.FdInfo.OccMoney,
         DongJieMoney = moneyInfo.FdInfo.DongJieMoney,
     });
 }
 /// <summary>
 /// 获取用户资金信息
 /// </summary>
 /// <param name="accountName">用户账号</param>
 /// <param name="loginId">登录ID</param>
 /// <param name="fund">ref  FundInformation</param>
 /// <returns>ErrType</returns>
 public ErrType GetMoneyInventoryEx(string accountName, string loginId, ref FundInformation fund)
 {
     try
     {
         MoneyInventory moneyInfo = TradeService.GetMoneyInventoryEx(accountName, loginId);
         fund = TradeConverter.ToFundInformation(moneyInfo);
         return(moneyInfo.Result ? GeneralErr.Success : new ErrType(ERR.ERROR, moneyInfo.Desc));
     }
     catch (Exception ex)
     {
         FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, ex.Message);
         return(new ErrType(ERR.EXEPTION, ErrorText.GetClientFundsInfo));
     }
 }
Пример #3
0
        public String AnalysisXml(string ReqXml)
        {
            string ResXml  = string.Empty;
            string ReqCode = string.Empty;

            try
            {
                System.Xml.XmlDocument xmldoc = new System.Xml.XmlDocument();
                xmldoc.LoadXml(ReqXml);

                //请求指令
                ReqCode = xmldoc.SelectSingleNode("JTW91G/MsgData/ReqHeader/ReqCode").InnerText;

                Trade.CTrade trade = new Trade.CTrade();

                string         LoginID      = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/LoginId").InnerText;
                string         TradeAccount = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/TradeAccount").InnerText;
                MoneyInventory miy          = trade.GetMoneyInventory(LoginID);
                if (!miy.Result)
                {
                    string CodeDesc   = ResCode.UL005Desc;
                    string ReturnCode = GssGetCode.GetCode(miy.ReturnCode, miy.Desc, ref CodeDesc);
                    ResXml = GssResXml.GetResXml(ReqCode, ReturnCode, CodeDesc, string.Format("<DataBody></DataBody>"));
                }
                else
                {
                    StringBuilder strb = new StringBuilder();
                    strb.Append("<FundInfo>");
                    strb.AppendFormat("<CashUser>{0}</CashUser>", miy.FdInfo.CashUser);
                    strb.AppendFormat("<SubUser>{0}</SubUser>", miy.FdInfo.SubUser);
                    strb.AppendFormat("<TanUser>{0}</TanUser>", miy.FdInfo.TanUser);
                    strb.AppendFormat("<State>{0}</State>", miy.FdInfo.State);
                    strb.AppendFormat("<Money>{0}</Money>", miy.FdInfo.Money);
                    strb.AppendFormat("<OccMoney>{0}</OccMoney>", miy.FdInfo.OccMoney);
                    strb.AppendFormat("<FrozenMoney>{0}</FrozenMoney>", miy.FdInfo.FrozenMoney);
                    strb.AppendFormat("<ConBankType>{0}</ConBankType>", miy.FdInfo.ConBankType);
                    strb.AppendFormat("<OpenBank>{0}</OpenBank>", miy.FdInfo.OpenBank);
                    strb.AppendFormat("<BankAccount>{0}</BankAccount>", miy.FdInfo.BankAccount);
                    strb.AppendFormat("<AccountName>{0}</AccountName>", miy.FdInfo.AccountName);
                    strb.Append("</FundInfo>");

                    strb.Append("<Storages>");

                    //strb.Append("<Storage>");
                    //strb.Append("<Key>XAU</Key>");
                    //strb.Append("<Name>黄金</Name>");
                    //strb.AppendFormat("<Value>{0}</Value>", miy.StorageQuantity.xau);
                    //strb.Append("</Storage>");

                    //strb.Append("<Storage>");
                    //strb.Append("<Key>XAG</Key>");
                    //strb.Append("<Name>白银</Name>");
                    //strb.AppendFormat("<Value>{0}</Value>", miy.StorageQuantity.xag);
                    //strb.Append("</Storage>");

                    //strb.Append("<Storage>");
                    //strb.Append("<Key>XPT</Key>");
                    //strb.Append("<Name>铂金</Name>");
                    //strb.AppendFormat("<Value>{0}</Value>", miy.StorageQuantity.xpt);
                    //strb.Append("</Storage>");

                    //strb.Append("<Storage>");
                    //strb.Append("<Key>XPD</Key>");
                    //strb.Append("<Name>钯金</Name>");
                    //strb.AppendFormat("<Value>{0}</Value>", miy.StorageQuantity.xpd);
                    //strb.Append("</Storage>");

                    strb.Append("</Storages>");
                    //响应消息体
                    string DataBody = string.Format("<DataBody>{0}</DataBody>", strb);

                    ResXml = GssResXml.GetResXml(ReqCode, ResCode.UL004, ResCode.UL004Desc, DataBody);
                }
            }
            catch (Exception ex)
            {
                com.individual.helper.LogNet4.WriteErr(ex);

                //业务处理失败
                ResXml = GssResXml.GetResXml(ReqCode, ResCode.UL005, ResCode.UL005Desc, string.Format("<DataBody></DataBody>"));
            }
            return(ResXml);
        }
Пример #4
0
        /// <summary>
        /// 资金库存信息查询
        /// </summary>
        /// <param name="account">要被查询的账号</param>
        /// <param name="LoginID">登陆标识</param>
        /// <returns>资金库存信息</returns>
        public MoneyInventory GetMoneyInventoryEx(string account, string LoginID)
        {
            MoneyInventory moneyInventory = new MoneyInventory();

            moneyInventory.StorageQuantity = new Storagequantity();
            moneyInventory.FdInfo          = new Fundinfo();

            System.Data.Common.DbDataReader dbreader = null;
            //bool IsGetMoney = false;
            try
            {
                string userId = string.Empty;
                moneyInventory.Result = false;
                //查看 logid在 数据库 存在否
                //if (!ComFunction.ExistUserLoginID(LoginID))
                //{
                //    moneyInventory.Result = false;
                //    moneyInventory.ReturnCode = ResCode.UL003;
                //    moneyInventory.Desc = ResCode.UL003Desc;
                //    return moneyInventory;
                //}
                userId = ComFunction.GetUserId(account);
                if (string.IsNullOrEmpty(userId))//如果用户不存在
                {
                    moneyInventory.Result     = false;
                    moneyInventory.ReturnCode = ResCode.UL005;
                    moneyInventory.Desc       = ResCode.UL005Desc;
                    return(moneyInventory);
                }
                string sql = "select DongJieMoney,money,frozenMoney,OccMoney,state,CashUser,SubUser,TanUser,ConBankType,OpenBank,BankAccount,AccountName,BankCard from Trade_FundInfo where state<>'4' and userId=@userId";

                dbreader = DbHelper.ExecuteReader(sql,
                                                  new System.Data.Common.DbParameter[] { DbHelper.CreateDbParameter(JinTong.Jyrj.Data.DataBase.Type,
                                                                                                                    "@userId", DbParameterType.String, userId, ParameterDirection.Input) });
                while (dbreader.Read())
                {
                    moneyInventory.FdInfo.DongJieMoney = System.DBNull.Value != dbreader["DongJieMoney"] ? Convert.ToDouble(dbreader["DongJieMoney"]) : 0;
                    moneyInventory.FdInfo.Money        = System.DBNull.Value != dbreader["money"] ? Convert.ToDouble(dbreader["money"]) : 0;
                    moneyInventory.FdInfo.FrozenMoney  = System.DBNull.Value != dbreader["frozenMoney"] ? Convert.ToDouble(dbreader["frozenMoney"]) : 0;
                    moneyInventory.FdInfo.OccMoney     = System.DBNull.Value != dbreader["OccMoney"] ? Convert.ToDouble(dbreader["OccMoney"]) : 0;
                    moneyInventory.FdInfo.State        = System.DBNull.Value != dbreader["state"] ? dbreader["state"].ToString() : string.Empty;
                    moneyInventory.FdInfo.CashUser     = System.DBNull.Value != dbreader["CashUser"] ? dbreader["CashUser"].ToString() : string.Empty;
                    moneyInventory.FdInfo.SubUser      = System.DBNull.Value != dbreader["SubUser"] ? dbreader["SubUser"].ToString() : string.Empty;
                    moneyInventory.FdInfo.TanUser      = System.DBNull.Value != dbreader["TanUser"] ? dbreader["TanUser"].ToString() : string.Empty;
                    moneyInventory.FdInfo.ConBankType  = System.DBNull.Value != dbreader["ConBankType"] ? dbreader["ConBankType"].ToString() : string.Empty;
                    moneyInventory.FdInfo.OpenBank     = System.DBNull.Value != dbreader["OpenBank"] ? dbreader["OpenBank"].ToString() : string.Empty;
                    moneyInventory.FdInfo.BankAccount  = System.DBNull.Value != dbreader["BankAccount"] ? dbreader["BankAccount"].ToString() : string.Empty;
                    moneyInventory.FdInfo.AccountName  = System.DBNull.Value != dbreader["AccountName"] ? dbreader["AccountName"].ToString() : string.Empty;
                    moneyInventory.FdInfo.BankCard     = System.DBNull.Value != dbreader["BankCard"] ? dbreader["BankCard"].ToString() : string.Empty;
                    //IsGetMoney = true;
                    break;
                }
                //if (!IsGetMoney)
                //{
                //    return moneyInventory;
                //}
                //查询 库存
                dbreader.Close();
                //sqlcmd.CommandText = "select au,ag,pt,pd from Stock_BZJ where userId=@userId ";
                //sqldr = sqlcmd.ExecuteReader();
                //if (sqldr.Read())
                //{
                //    moneyInventory.StorageQuantity.xau = System.DBNull.Value != sqldr["au"] ? Convert.ToDouble(sqldr["au"]) : 0;

                //    moneyInventory.StorageQuantity.xag = System.DBNull.Value != sqldr["ag"] ? Convert.ToDouble(sqldr["ag"]) : 0;

                //    moneyInventory.StorageQuantity.xpt = System.DBNull.Value != sqldr["pt"] ? Convert.ToDouble(sqldr["pt"]) : 0;

                //    moneyInventory.StorageQuantity.xpd = System.DBNull.Value != sqldr["pd"] ? Convert.ToDouble(sqldr["pd"]) : 0;
                //}
                moneyInventory.Result = true;
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                moneyInventory.Result = false;
            }
            finally
            {
                if (null != dbreader)
                {
                    dbreader.Close();
                    dbreader.Dispose();
                }
            }
            return(moneyInventory);
        }
 /// <summary>
 /// Convert MoneyInventory to FundInformation.
 /// </summary>
 /// <param name="moneyInfo">MoneyInventory</param>
 /// <returns>FundInformation</returns>
 internal static FundInformation ToFundInformation(MoneyInventory moneyInfo)
 {
     return new FundInformation
     {
         AccountBalance = moneyInfo.FdInfo.Money,
         FrozenDeposit = moneyInfo.FdInfo.FrozenMoney,
         OccupiedDeposit = moneyInfo.FdInfo.OccMoney,
         DongJieMoney = moneyInfo.FdInfo.DongJieMoney,
     };
 }