/// <summary>
        /// 带事务的Update
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="trans">The trans.</param>
        /// <returns></returns>
        /// <remarks>2016/6/17 9:47:19</remarks>
        public bool Update(ConfigLeaguestarEntity entity, DbTransaction trans)
        {
            var       database       = new SqlDatabase(this.ConnectionString);
            DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_ConfigLeaguestar_Update");

            database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx);
            database.AddInParameter(commandWrapper, "@LeagueId", DbType.Int32, entity.LeagueId);
            database.AddInParameter(commandWrapper, "@StarNumber", DbType.Int32, entity.StarNumber);
            database.AddInParameter(commandWrapper, "@PrizeLevel", DbType.Int32, entity.PrizeLevel);
            database.AddInParameter(commandWrapper, "@PrizeType", DbType.Int32, entity.PrizeType);
            database.AddInParameter(commandWrapper, "@SubType", DbType.Int32, entity.SubType);
            database.AddInParameter(commandWrapper, "@Count", DbType.Int32, entity.Count);


            int results = 0;

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


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

            obj.Idx        = (System.Int32)reader["Idx"];
            obj.LeagueId   = (System.Int32)reader["LeagueId"];
            obj.StarNumber = (System.Int32)reader["StarNumber"];
            obj.PrizeLevel = (System.Int32)reader["PrizeLevel"];
            obj.PrizeType  = (System.Int32)reader["PrizeType"];
            obj.SubType    = (System.Int32)reader["SubType"];
            obj.Count      = (System.Int32)reader["Count"];

            return(obj);
        }
        /// <summary>
        /// GetById
        /// </summary>
        /// <param name="idx">idx</param>
        /// <returns>ConfigLeaguestarEntity</returns>
        /// <remarks>2016/6/17 9:47:19</remarks>
        public ConfigLeaguestarEntity GetById(System.Int32 idx)
        {
            var database = new SqlDatabase(this.ConnectionString);

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

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


            ConfigLeaguestarEntity obj = null;

            using (IDataReader reader = database.ExecuteReader(commandWrapper))
            {
                if (reader.Read())
                {
                    obj = LoadSingleRow(reader);
                }
            }
            return(obj);
        }
Ejemplo n.º 4
0
        public static bool Update(ConfigLeaguestarEntity configLeaguestarEntity, DbTransaction trans = null, string zoneId = "")
        {
            var provider = new ConfigLeaguestarProvider(zoneId);

            return(provider.Update(configLeaguestarEntity, trans));
        }
 /// <summary>
 /// Update
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 /// <remarks>2016/6/17 9:47:19</remarks>
 public bool Update(ConfigLeaguestarEntity entity)
 {
     return(Update(entity, null));
 }
 /// <summary>
 /// Insert
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="trans">The trans.</param>
 /// <returns></returns>
 /// <remarks>2016/6/17 9:47:19</remarks>
 public bool Insert(ConfigLeaguestarEntity entity)
 {
     return(Insert(entity, null));
 }