/// <summary>
        /// 带事务的Update
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="trans">The trans.</param>
        /// <returns></returns>
        /// <remarks>2016/8/19 14:00:12</remarks>
        public bool Update(ConfigArenaprizeEntity entity, DbTransaction trans)
        {
            var       database       = new SqlDatabase(this.ConnectionString);
            DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_ConfigArenaprize_Update");

            database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx);
            database.AddInParameter(commandWrapper, "@StartRank", DbType.Int32, entity.StartRank);
            database.AddInParameter(commandWrapper, "@EndRank", DbType.Int32, entity.EndRank);
            database.AddInParameter(commandWrapper, "@PrizeType", DbType.Int32, entity.PrizeType);
            database.AddInParameter(commandWrapper, "@PrizeCode", DbType.Int32, entity.PrizeCode);
            database.AddInParameter(commandWrapper, "@PrizeNumber", DbType.Int32, entity.PrizeNumber);


            int results = 0;

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


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

            obj.Idx         = (System.Int32)reader["Idx"];
            obj.StartRank   = (System.Int32)reader["StartRank"];
            obj.EndRank     = (System.Int32)reader["EndRank"];
            obj.PrizeType   = (System.Int32)reader["PrizeType"];
            obj.PrizeCode   = (System.Int32)reader["PrizeCode"];
            obj.PrizeNumber = (System.Int32)reader["PrizeNumber"];

            return(obj);
        }
        /// <summary>
        /// GetById
        /// </summary>
        /// <param name="idx">idx</param>
        /// <returns>ConfigArenaprizeEntity</returns>
        /// <remarks>2016/8/19 14:00:12</remarks>
        public ConfigArenaprizeEntity GetById(System.Int32 idx)
        {
            var database = new SqlDatabase(this.ConnectionString);

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

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


            ConfigArenaprizeEntity 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/8/19 14:00:12</remarks>
 public bool Update(ConfigArenaprizeEntity entity)
 {
     return(Update(entity, null));
 }
 /// <summary>
 /// Insert
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="trans">The trans.</param>
 /// <returns></returns>
 /// <remarks>2016/8/19 14:00:12</remarks>
 public bool Insert(ConfigArenaprizeEntity entity)
 {
     return(Insert(entity, null));
 }
Ejemplo n.º 6
0
        public static bool Update(ConfigArenaprizeEntity configArenaprizeEntity, DbTransaction trans = null, string zoneId = "")
        {
            var provider = new ConfigArenaprizeProvider(zoneId);

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