/// <summary>
        /// GetById
        /// </summary>
        /// <param name="idx">idx</param>
        /// <returns>ConfigEquipmentupgradeEntity</returns>
        /// <remarks>2015/10/19 10:45:08</remarks>
        public ConfigEquipmentupgradeEntity GetById(System.Int32 idx)
        {
            var database = new SqlDatabase(this.ConnectionString);

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

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


            ConfigEquipmentupgradeEntity obj = null;

            using (IDataReader reader = database.ExecuteReader(commandWrapper))
            {
                if (reader.Read())
                {
                    obj = LoadSingleRow(reader);
                }
            }
            return(obj);
        }
        /// <summary>
        /// 将IDataReader的当前记录读取到ConfigEquipmentupgradeEntity 对象
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        public ConfigEquipmentupgradeEntity LoadSingleRow(IDataReader reader)
        {
            var obj = new ConfigEquipmentupgradeEntity();

            obj.Idx              = (System.Int32)reader["Idx"];
            obj.EquipQuality     = (System.Int32)reader["EquipQuality"];
            obj.SourceLevel      = (System.Int32)reader["SourceLevel"];
            obj.TargetLevel      = (System.Int32)reader["TargetLevel"];
            obj.FailLevel        = (System.Int32)reader["FailLevel"];
            obj.ProtectedLevel   = (System.Int32)reader["ProtectedLevel"];
            obj.ProtectedConsume = (System.Int32)reader["ProtectedConsume"];
            obj.PropertyNum      = (System.Int32)reader["PropertyNum"];
            obj.Rate             = (System.Int32)reader["Rate"];
            obj.Coin             = (System.Int32)reader["Coin"];
            obj.ItemCode1        = (System.Int32)reader["ItemCode1"];
            obj.ItemCount1       = (System.Int32)reader["ItemCount1"];
            obj.ItemCode2        = (System.Int32)reader["ItemCode2"];
            obj.ItemCount2       = (System.Int32)reader["ItemCount2"];
            obj.ItemCode3        = (System.Int32)reader["ItemCode3"];
            obj.ItemCount3       = (System.Int32)reader["ItemCount3"];

            return(obj);
        }
        /// <summary>
        /// 带事务的Update
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="trans">The trans.</param>
        /// <returns></returns>
        /// <remarks>2015/10/19 10:45:08</remarks>
        public bool Update(ConfigEquipmentupgradeEntity entity, DbTransaction trans)
        {
            var       database       = new SqlDatabase(this.ConnectionString);
            DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_ConfigEquipmentupgrade_Update");

            database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx);
            database.AddInParameter(commandWrapper, "@EquipQuality", DbType.Int32, entity.EquipQuality);
            database.AddInParameter(commandWrapper, "@SourceLevel", DbType.Int32, entity.SourceLevel);
            database.AddInParameter(commandWrapper, "@TargetLevel", DbType.Int32, entity.TargetLevel);
            database.AddInParameter(commandWrapper, "@FailLevel", DbType.Int32, entity.FailLevel);
            database.AddInParameter(commandWrapper, "@ProtectedLevel", DbType.Int32, entity.ProtectedLevel);
            database.AddInParameter(commandWrapper, "@ProtectedConsume", DbType.Int32, entity.ProtectedConsume);
            database.AddInParameter(commandWrapper, "@PropertyNum", DbType.Int32, entity.PropertyNum);
            database.AddInParameter(commandWrapper, "@Rate", DbType.Int32, entity.Rate);
            database.AddInParameter(commandWrapper, "@Coin", DbType.Int32, entity.Coin);
            database.AddInParameter(commandWrapper, "@ItemCode1", DbType.Int32, entity.ItemCode1);
            database.AddInParameter(commandWrapper, "@ItemCount1", DbType.Int32, entity.ItemCount1);
            database.AddInParameter(commandWrapper, "@ItemCode2", DbType.Int32, entity.ItemCode2);
            database.AddInParameter(commandWrapper, "@ItemCount2", DbType.Int32, entity.ItemCount2);
            database.AddInParameter(commandWrapper, "@ItemCode3", DbType.Int32, entity.ItemCode3);
            database.AddInParameter(commandWrapper, "@ItemCount3", DbType.Int32, entity.ItemCount3);


            int results = 0;

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


            return(Convert.ToBoolean(results));
        }
 /// <summary>
 /// Update
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 /// <remarks>2015/10/19 10:45:08</remarks>
 public bool Update(ConfigEquipmentupgradeEntity entity)
 {
     return(Update(entity, null));
 }
 /// <summary>
 /// Insert
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="trans">The trans.</param>
 /// <returns></returns>
 /// <remarks>2015/10/19 10:45:08</remarks>
 public bool Insert(ConfigEquipmentupgradeEntity entity)
 {
     return(Insert(entity, null));
 }
        public static bool Update(ConfigEquipmentupgradeEntity configEquipmentupgradeEntity, DbTransaction trans = null, string zoneId = "")
        {
            var provider = new ConfigEquipmentupgradeProvider(zoneId);

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