/// <summary>
        /// 带事务的Update
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="trans">The trans.</param>
        /// <returns></returns>
        /// <remarks>2016/5/24 22:52:47</remarks>
        public bool Update(ConfigPrposellEntity entity, DbTransaction trans)
        {
            var       database       = new SqlDatabase(this.ConnectionString);
            DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_ConfigPrposell_Update");

            database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx);
            database.AddInParameter(commandWrapper, "@ItemType", DbType.Int32, entity.ItemType);
            database.AddInParameter(commandWrapper, "@Quality", DbType.Int32, entity.Quality);
            database.AddInParameter(commandWrapper, "@Coin", DbType.Int32, entity.Coin);


            int results = 0;

            if (trans != null)
            {
                results = database.ExecuteNonQuery(commandWrapper, trans);
            }
            else
            {
                results = database.ExecuteNonQuery(commandWrapper);
            }


            return(Convert.ToBoolean(results));
        }
        /// <summary>
        /// 将IDataReader的当前记录读取到ConfigPrposellEntity 对象
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        public ConfigPrposellEntity LoadSingleRow(IDataReader reader)
        {
            var obj = new ConfigPrposellEntity();

            obj.Idx      = (System.Int32)reader["Idx"];
            obj.ItemType = (System.Int32)reader["ItemType"];
            obj.Quality  = (System.Int32)reader["Quality"];
            obj.Coin     = (System.Int32)reader["Coin"];

            return(obj);
        }
        /// <summary>
        /// GetById
        /// </summary>
        /// <param name="idx">idx</param>
        /// <returns>ConfigPrposellEntity</returns>
        /// <remarks>2016/5/24 22:52:47</remarks>
        public ConfigPrposellEntity GetById(System.Int32 idx)
        {
            var database = new SqlDatabase(this.ConnectionString);

            DbCommand commandWrapper = database.GetStoredProcCommand("P_ConfigPrposell_GetById");

            database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, idx);


            ConfigPrposellEntity obj = null;

            using (IDataReader reader = database.ExecuteReader(commandWrapper))
            {
                if (reader.Read())
                {
                    obj = LoadSingleRow(reader);
                }
            }
            return(obj);
        }
 /// <summary>
 /// Update
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 /// <remarks>2016/5/24 22:52:47</remarks>
 public bool Update(ConfigPrposellEntity entity)
 {
     return(Update(entity, null));
 }
 /// <summary>
 /// Insert
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="trans">The trans.</param>
 /// <returns></returns>
 /// <remarks>2016/5/24 22:52:47</remarks>
 public bool Insert(ConfigPrposellEntity entity)
 {
     return(Insert(entity, null));
 }
Exemplo n.º 6
0
        public static bool Update(ConfigPrposellEntity configPrposellEntity, DbTransaction trans = null, string zoneId = "")
        {
            var provider = new ConfigPrposellProvider(zoneId);

            return(provider.Update(configPrposellEntity, trans));
        }