/// <summary>
        /// 根据品种涨跌幅标识得到一个对象实体
        /// </summary>
        /// <param name="BreedClassHighLowID">品种涨跌幅标识</param>
        /// <returns></returns>
        public ManagementCenter.Model.XH_SpotHighLowValue GetModelByBCHighLowID(int BreedClassHighLowID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append(
                "select HightLowValueID,FundYestClosePriceScale,RightHighLowScale,NormalValue,StValue,BreedClassHighLowID from XH_SpotHighLowValue ");
            strSql.Append(" where BreedClassHighLowID=@BreedClassHighLowID ");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "BreedClassHighLowID", DbType.Int32, BreedClassHighLowID);
            ManagementCenter.Model.XH_SpotHighLowValue model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
            }
            return(model);
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(ManagementCenter.Model.XH_SpotHighLowValue model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into XH_SpotHighLowValue(");
            strSql.Append(
                "FundYestClosePriceScale,RightHighLowScale,NormalValue,StValue,BreedClassHighLowID)");

            strSql.Append(" values (");
            strSql.Append(
                "@FundYestClosePriceScale,@RightHighLowScale,@NormalValue,@StValue,@BreedClassHighLowID)");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            //  db.AddInParameter(dbCommand, "HightLowValueID", DbType.Int32, model.HightLowValueID);
            db.AddInParameter(dbCommand, "FundYestClosePriceScale", DbType.Decimal, model.FundYestClosePriceScale);
            db.AddInParameter(dbCommand, "RightHighLowScale", DbType.Decimal, model.RightHighLowScale);
            db.AddInParameter(dbCommand, "NormalValue", DbType.Decimal, model.NormalValue);
            db.AddInParameter(dbCommand, "StValue", DbType.Decimal, model.StValue);
            db.AddInParameter(dbCommand, "BreedClassHighLowID", DbType.Int32, model.BreedClassHighLowID);
            db.ExecuteNonQuery(dbCommand);
        }
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public ManagementCenter.Model.XH_SpotHighLowValue ReaderBind(IDataReader dataReader)
        {
            ManagementCenter.Model.XH_SpotHighLowValue model = new ManagementCenter.Model.XH_SpotHighLowValue();
            object ojb;

            ojb = dataReader["HightLowValueID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.HightLowValueID = (int)ojb;
            }
            ojb = dataReader["FundYestClosePriceScale"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.FundYestClosePriceScale = (decimal)ojb;
            }
            ojb = dataReader["RightHighLowScale"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.RightHighLowScale = (decimal)ojb;
            }
            ojb = dataReader["NormalValue"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.NormalValue = (decimal)ojb;
            }
            ojb = dataReader["StValue"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.StValue = (decimal)ojb;
            }
            ojb = dataReader["BreedClassHighLowID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.BreedClassHighLowID = (int)ojb;
            }
            return(model);
        }
 /// <summary>
 /// 更新涨跌幅取值
 /// </summary>
 /// <param name="model">涨跌幅取值实体</param>
 /// <returns></returns>
 public bool Update(ManagementCenter.Model.XH_SpotHighLowValue model)
 {
     return(Update(model, null, null));
 }
        /// <summary>
        /// 更新涨跌幅取值
        /// </summary>
        /// <param name="model">涨跌幅取值实体</param>
        /// <param name="tran"></param>
        /// <param name="db"></param>
        /// <returns></returns>
        public bool Update(ManagementCenter.Model.XH_SpotHighLowValue model, DbTransaction tran, Database db)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update XH_SpotHighLowValue set ");
            strSql.Append("FundYestClosePriceScale=@FundYestClosePriceScale,");
            strSql.Append("RightHighLowScale=@RightHighLowScale,");
            strSql.Append("NormalValue=@NormalValue,");
            strSql.Append("StValue=@StValue");
            //strSql.Append("BreedClassHighLowID=@BreedClassHighLowID");
            //strSql.Append(" where HightLowValueID=@HightLowValueID ");
            strSql.Append(" where BreedClassHighLowID=@BreedClassHighLowID ");
            if (db == null)
            {
                db = DatabaseFactory.CreateDatabase();
            }
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            // db.AddInParameter(dbCommand, "HightLowValueID", DbType.Int32, model.HightLowValueID);
            if (model.FundYestClosePriceScale == AppGlobalVariable.INIT_DECIMAL)
            {
                db.AddInParameter(dbCommand, "FundYestClosePriceScale", DbType.Decimal, DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "FundYestClosePriceScale", DbType.Decimal, model.FundYestClosePriceScale);
            }
            if (model.RightHighLowScale == AppGlobalVariable.INIT_DECIMAL)
            {
                db.AddInParameter(dbCommand, "RightHighLowScale", DbType.Decimal, DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "RightHighLowScale", DbType.Decimal, model.RightHighLowScale);
            }
            if (model.NormalValue == AppGlobalVariable.INIT_DECIMAL)
            {
                db.AddInParameter(dbCommand, "NormalValue", DbType.Decimal, DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "NormalValue", DbType.Decimal, model.NormalValue);
            }
            if (model.StValue == AppGlobalVariable.INIT_DECIMAL)
            {
                db.AddInParameter(dbCommand, "StValue", DbType.Decimal, DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "StValue", DbType.Decimal, model.StValue);
            }
            //db.AddInParameter(dbCommand, "FundYestClosePriceScale", DbType.Decimal, model.FundYestClosePriceScale);
            //db.AddInParameter(dbCommand, "RightHighLowScale", DbType.Decimal, model.RightHighLowScale);
            //db.AddInParameter(dbCommand, "NormalValue", DbType.Decimal, model.NormalValue);
            //db.AddInParameter(dbCommand, "StValue", DbType.Decimal, model.StValue);
            db.AddInParameter(dbCommand, "BreedClassHighLowID", DbType.Int32, model.BreedClassHighLowID);
            //db.ExecuteNonQuery(dbCommand);
            if (tran == null)
            {
                db.ExecuteNonQuery(dbCommand);
            }
            else
            {
                db.ExecuteNonQuery(dbCommand, tran);
            }
            return(true);
        }
 /// <summary>
 /// 添加现货涨跌幅(重载,无事务)
 /// </summary>
 /// <param name="model">现货涨跌幅实体</param>
 /// <returns></returns>
 public int AddXHSpotHighLowValue(ManagementCenter.Model.XH_SpotHighLowValue model)
 {
     return(AddXHSpotHighLowValue(model, null, null));
 }
        //================================  修改后的  方法 ================================

        #region 添加现货涨跌幅

        /// <summary>
        /// 添加现货涨跌幅
        /// </summary>
        /// <param name="model">现货涨跌幅实体</param>
        /// <param name="tran">事务</param>
        /// <param name="db">创建数据</param>
        /// <returns></returns>
        public int AddXHSpotHighLowValue(ManagementCenter.Model.XH_SpotHighLowValue model, DbTransaction tran,
                                         Database db)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into XH_SpotHighLowValue(");
            strSql.Append(
                "FundYestClosePriceScale,RightHighLowScale,NormalValue,StValue,BreedClassHighLowID)");

            strSql.Append(" values (");
            strSql.Append(
                "@FundYestClosePriceScale,@RightHighLowScale,@NormalValue,@StValue,@BreedClassHighLowID)");
            strSql.Append(";select @@IDENTITY");
            if (db == null)
            {
                db = DatabaseFactory.CreateDatabase();
            }
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            // db.AddInParameter(dbCommand, "HightLowValueID", DbType.Int32, model.HightLowValueID);
            if (model.FundYestClosePriceScale == AppGlobalVariable.INIT_DECIMAL)
            {
                db.AddInParameter(dbCommand, "FundYestClosePriceScale", DbType.Decimal, DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "FundYestClosePriceScale", DbType.Decimal, model.FundYestClosePriceScale);
            }
            if (model.RightHighLowScale == AppGlobalVariable.INIT_DECIMAL)
            {
                db.AddInParameter(dbCommand, "RightHighLowScale", DbType.Decimal, DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "RightHighLowScale", DbType.Decimal, model.RightHighLowScale);
            }
            if (model.NormalValue == AppGlobalVariable.INIT_DECIMAL)
            {
                db.AddInParameter(dbCommand, "NormalValue", DbType.Decimal, DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "NormalValue", DbType.Decimal, model.NormalValue);
            }
            if (model.StValue == AppGlobalVariable.INIT_DECIMAL)
            {
                db.AddInParameter(dbCommand, "StValue", DbType.Decimal, DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "StValue", DbType.Decimal, model.StValue);
            }
            db.AddInParameter(dbCommand, "BreedClassHighLowID", DbType.Int32, model.BreedClassHighLowID);
            //db.ExecuteNonQuery(dbCommand);
            //int result;
            object obj;

            if (tran == null)
            {
                obj = db.ExecuteScalar(dbCommand);
            }
            else
            {
                obj = db.ExecuteScalar(dbCommand, tran);
            }

            if (obj == null || string.IsNullOrEmpty(obj.ToString()))
            {
                return(AppGlobalVariable.INIT_INT);
            }
            else
            {
                return(int.Parse(obj.ToString()));
            }
        }