예제 #1
0
        /// <summary>
        /// 添加港股交易规则
        /// </summary>
        /// <param name="model">港股交易规则实体</param>
        /// <param name="tran">事务</param>
        /// <param name="db">db</param>
        /// <returns></returns>
        public bool Add(ManagementCenter.Model.HK_SpotTradeRules model, DbTransaction tran, Database db)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into HK_SpotTradeRules(");
            strSql.Append("FundDeliveryInstitution,StockDeliveryInstitution,MaxLeaveQuantity,MarketUnitID,PriceUnit,BreedClassID)");

            strSql.Append(" values (");
            strSql.Append("@FundDeliveryInstitution,@StockDeliveryInstitution,@MaxLeaveQuantity,@MarketUnitID,@PriceUnit,@BreedClassID)");
            if (db == null)
            {
                db = DatabaseFactory.CreateDatabase();
            }
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "FundDeliveryInstitution", DbType.Int32, model.FundDeliveryInstitution);
            db.AddInParameter(dbCommand, "StockDeliveryInstitution", DbType.Int32, model.StockDeliveryInstitution);
            db.AddInParameter(dbCommand, "MaxLeaveQuantity", DbType.Int32, model.MaxLeaveQuantity);
            db.AddInParameter(dbCommand, "MarketUnitID", DbType.Int32, model.MarketUnitID);
            db.AddInParameter(dbCommand, "PriceUnit", DbType.Int32, model.PriceUnit);
            db.AddInParameter(dbCommand, "BreedClassID", DbType.Int32, model.BreedClassID);
            //db.ExecuteNonQuery(dbCommand);
            if (tran == null)
            {
                db.ExecuteNonQuery(dbCommand);
            }
            else
            {
                db.ExecuteNonQuery(dbCommand, tran);
            }
            return(true);
        }
예제 #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ManagementCenter.Model.HK_SpotTradeRules GetModel(int BreedClassID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select FundDeliveryInstitution,StockDeliveryInstitution,MaxLeaveQuantity,MarketUnitID,PriceUnit,BreedClassID from HK_SpotTradeRules ");
            strSql.Append(" where BreedClassID=@BreedClassID ");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "BreedClassID", DbType.Int32, BreedClassID);
            ManagementCenter.Model.HK_SpotTradeRules model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
            }
            return(model);
        }
예제 #3
0
        /// <summary>
        /// 更新港股交易规则
        /// </summary>
        /// <param name="model">港股交易规则实体</param>
        /// <returns></returns>
        public bool Update(ManagementCenter.Model.HK_SpotTradeRules model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update HK_SpotTradeRules set ");
            strSql.Append("FundDeliveryInstitution=@FundDeliveryInstitution,");
            strSql.Append("StockDeliveryInstitution=@StockDeliveryInstitution,");
            strSql.Append("MaxLeaveQuantity=@MaxLeaveQuantity,");
            strSql.Append("MarketUnitID=@MarketUnitID,");
            strSql.Append("PriceUnit=@PriceUnit");
            strSql.Append(" where BreedClassID=@BreedClassID ");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "FundDeliveryInstitution", DbType.Int32, model.FundDeliveryInstitution);
            db.AddInParameter(dbCommand, "StockDeliveryInstitution", DbType.Int32, model.StockDeliveryInstitution);
            db.AddInParameter(dbCommand, "MaxLeaveQuantity", DbType.Int32, model.MaxLeaveQuantity);
            db.AddInParameter(dbCommand, "MarketUnitID", DbType.Int32, model.MarketUnitID);
            db.AddInParameter(dbCommand, "PriceUnit", DbType.Int32, model.PriceUnit);
            db.AddInParameter(dbCommand, "BreedClassID", DbType.Int32, model.BreedClassID);
            db.ExecuteNonQuery(dbCommand);
            return(true);
        }
예제 #4
0
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public ManagementCenter.Model.HK_SpotTradeRules ReaderBind(IDataReader dataReader)
        {
            ManagementCenter.Model.HK_SpotTradeRules model = new ManagementCenter.Model.HK_SpotTradeRules();
            object ojb;

            ojb = dataReader["FundDeliveryInstitution"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.FundDeliveryInstitution = (int)ojb;
            }
            ojb = dataReader["StockDeliveryInstitution"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.StockDeliveryInstitution = (int)ojb;
            }
            ojb = dataReader["MaxLeaveQuantity"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.MaxLeaveQuantity = (int)ojb;
            }
            ojb = dataReader["MarketUnitID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.MarketUnitID = (int)ojb;
            }
            ojb = dataReader["PriceUnit"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.PriceUnit = (int)ojb;
            }
            ojb = dataReader["BreedClassID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.BreedClassID = (int)ojb;
            }
            return(model);
        }
예제 #5
0
 /// <summary>
 /// 添加港股交易规则
 /// </summary>
 /// <param name="model">港股交易规则实体</param>
 /// <returns></returns>
 public bool Add(ManagementCenter.Model.HK_SpotTradeRules model)
 {
     return(Add(model, null, null));
 }