コード例 #1
0
        /// <summary>
        /// 带事务的Update
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="trans">The trans.</param>
        /// <returns></returns>
        /// <remarks>2015/10/18 15:28:21</remarks>
        public bool Update(ConfigManagerlevelEntity entity, DbTransaction trans)
        {
            var       database       = new SqlDatabase(this.ConnectionString);
            DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_ConfigManagerlevel_Update");

            database.AddInParameter(commandWrapper, "@Level", DbType.Int32, entity.Level);
            database.AddInParameter(commandWrapper, "@Exp", DbType.Int32, entity.Exp);
            database.AddInParameter(commandWrapper, "@SkillCount", DbType.Int32, entity.SkillCount);
            database.AddInParameter(commandWrapper, "@MaxStamina", DbType.Int32, entity.MaxStamina);


            int results = 0;

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


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

            obj.Level      = (System.Int32)reader["Level"];
            obj.Exp        = (System.Int32)reader["Exp"];
            obj.SkillCount = (System.Int32)reader["SkillCount"];
            obj.MaxStamina = (System.Int32)reader["MaxStamina"];

            return(obj);
        }
コード例 #3
0
        /// <summary>
        /// GetById
        /// </summary>
        /// <param name="level">level</param>
        /// <returns>ConfigManagerlevelEntity</returns>
        /// <remarks>2015/10/18 15:28:21</remarks>
        public ConfigManagerlevelEntity GetById(System.Int32 level)
        {
            var database = new SqlDatabase(this.ConnectionString);

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

            database.AddInParameter(commandWrapper, "@Level", DbType.Int32, level);


            ConfigManagerlevelEntity obj = null;

            using (IDataReader reader = database.ExecuteReader(commandWrapper))
            {
                if (reader.Read())
                {
                    obj = LoadSingleRow(reader);
                }
            }
            return(obj);
        }
コード例 #4
0
        public static bool Update(ConfigManagerlevelEntity configManagerlevelEntity, DbTransaction trans = null, string zoneId = "")
        {
            var provider = new ConfigManagerlevelProvider(zoneId);

            return(provider.Update(configManagerlevelEntity, trans));
        }
コード例 #5
0
 /// <summary>
 /// Update
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 /// <remarks>2015/10/18 15:28:21</remarks>
 public bool Update(ConfigManagerlevelEntity entity)
 {
     return(Update(entity, null));
 }
コード例 #6
0
 /// <summary>
 /// Insert
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="trans">The trans.</param>
 /// <returns></returns>
 /// <remarks>2015/10/18 15:28:21</remarks>
 public bool Insert(ConfigManagerlevelEntity entity)
 {
     return(Insert(entity, null));
 }