/// <summary> /// 将IDataReader的当前记录读取到ConfigArenanpcopponentEntity 对象 /// </summary> /// <param name="reader"></param> /// <returns></returns> public ConfigArenanpcopponentEntity LoadSingleRow(IDataReader reader) { var obj = new ConfigArenanpcopponentEntity(); obj.Idx = (System.Int32)reader["Idx"]; obj.Opponent = (System.Int32)reader["Opponent"]; obj.GroupId = (System.Int32)reader["GroupId"]; return(obj); }
/// <summary> /// GetById /// </summary> /// <param name="idx">idx</param> /// <param name="opponent">opponent</param> /// <returns>ConfigArenanpcopponentEntity</returns> /// <remarks>2016/8/22 15:34:11</remarks> public ConfigArenanpcopponentEntity GetById(System.Int32 idx, System.Int32 opponent) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("P_ConfigArenanpcopponent_GetById"); database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, idx); database.AddInParameter(commandWrapper, "@Opponent", DbType.Int32, opponent); ConfigArenanpcopponentEntity obj = null; using (IDataReader reader = database.ExecuteReader(commandWrapper)) { if (reader.Read()) { obj = LoadSingleRow(reader); } } return(obj); }
/// <summary> /// 带事务的Update /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2016/8/22 15:34:11</remarks> public bool Update(ConfigArenanpcopponentEntity entity, DbTransaction trans) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_ConfigArenanpcopponent_Update"); database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx); database.AddInParameter(commandWrapper, "@Opponent", DbType.Int32, entity.Opponent); database.AddInParameter(commandWrapper, "@GroupId", DbType.Int32, entity.GroupId); 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>2016/8/22 15:34:11</remarks> public bool Update(ConfigArenanpcopponentEntity entity) { return(Update(entity, null)); }
/// <summary> /// Insert /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2016/8/22 15:34:11</remarks> public bool Insert(ConfigArenanpcopponentEntity entity) { return(Insert(entity, null)); }
public static bool Update(ConfigArenanpcopponentEntity configArenanpcopponentEntity, DbTransaction trans = null, string zoneId = "") { var provider = new ConfigArenanpcopponentProvider(zoneId); return(provider.Update(configArenanpcopponentEntity, trans)); }