Example #1
0
        /// <summary>
        /// 根据用户ID,密码,账号类别查询账号信息
        /// 因为一个用户可能拥有多个账号所以返回list(如:现货资金帐户-->证券资金帐户,港股资金帐户)
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="pwd">用户密码</param>
        /// <param name="accountTypeClass">账号类别,这里类别不是类型(类型目前数据库有九个,类别有五个,这两个值要区别)</param>
        /// <returns></returns>
        public List <UA_UserAccountAllocationTableInfo> GetUserAccountByUserIDAndPwdAndAccountTypeClass(string userId, string pwd, GTA.VTS.Common.CommonObject.Types.AccountAttributionType accountTypeClass)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select UserAccountDistributeLogo,WhetherAvailable,UserID,AccountTypeLogo from dbo.UA_UserAccountAllocationTable ");
            strSql.Append("  where accounttypelogo in (select accounttypelogo from BD_AccountType where atcid=@atcid) ");
            if (string.IsNullOrEmpty(pwd))
            {
                strSql.Append(" and  userid=@userid ");
            }
            else
            {
                strSql.Append(" and userid in (select userid from dbo.UA_UserBasicInformationTable where Password =@Password and userid=@userid) ");
            }

            List <UA_UserAccountAllocationTableInfo> list = new List <UA_UserAccountAllocationTableInfo>();
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "atcid", DbType.Int32, (int)accountTypeClass);
            if (!string.IsNullOrEmpty(pwd))
            {
                db.AddInParameter(dbCommand, "Password", DbType.String, pwd);
            }
            db.AddInParameter(dbCommand, "userid", DbType.String, userId.Trim());

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    list.Add(ReaderBind(dataReader));
                }
            }
            return(list);
        }
Example #2
0
 /// <summary>
 /// 根据用户ID,账号类别查询账号信息
 /// 因为一个用户可能拥有多个账号所以返回list(如:现货资金帐户-->证券资金帐户,港股资金帐户)
 /// </summary>
 /// <param name="userId">用户ID</param>
 /// <param name="accountTypeClass">账号类别,这里类别不是类型(类型目前数据库有九个,类别有五个,这两个值要区别)</param>
 /// <returns></returns>
 public List <UA_UserAccountAllocationTableInfo> GetUserAccountByUserIDAndPwdAndAccountTypeClass(string userId, GTA.VTS.Common.CommonObject.Types.AccountAttributionType accountTypeClass)
 {
     return(GetUserAccountByUserIDAndPwdAndAccountTypeClass(userId, "", accountTypeClass));
 }