/// <summary> /// 带事务的Update /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2016-08-15 16:43:06</remarks> public bool Update(ConfigCrowdprizeEntity entity, DbTransaction trans) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_ConfigCrowdprize_Update"); database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx); database.AddInParameter(commandWrapper, "@WinType", DbType.Int32, entity.WinType); database.AddInParameter(commandWrapper, "@Coin", DbType.Int32, entity.Coin); database.AddInParameter(commandWrapper, "@Honor", DbType.Int32, entity.Honor); int results = 0; if (trans != null) { results = database.ExecuteNonQuery(commandWrapper, trans); } else { results = database.ExecuteNonQuery(commandWrapper); } return(Convert.ToBoolean(results)); }
/// <summary> /// 将IDataReader的当前记录读取到ConfigCrowdprizeEntity 对象 /// </summary> /// <param name="reader"></param> /// <returns></returns> public ConfigCrowdprizeEntity LoadSingleRow(IDataReader reader) { var obj = new ConfigCrowdprizeEntity(); obj.Idx = (System.Int32)reader["Idx"]; obj.WinType = (System.Int32)reader["WinType"]; obj.Coin = (System.Int32)reader["Coin"]; obj.Honor = (System.Int32)reader["Honor"]; return(obj); }
/// <summary> /// GetById /// </summary> /// <param name="idx">idx</param> /// <returns>ConfigCrowdprizeEntity</returns> /// <remarks>2016-08-15 16:43:06</remarks> public ConfigCrowdprizeEntity GetById(System.Int32 idx) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("P_ConfigCrowdprize_GetById"); database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, idx); ConfigCrowdprizeEntity obj = null; using (IDataReader reader = database.ExecuteReader(commandWrapper)) { if (reader.Read()) { obj = LoadSingleRow(reader); } } return(obj); }
public static bool Update(ConfigCrowdprizeEntity configCrowdprizeEntity, DbTransaction trans = null, string zoneId = "") { var provider = new ConfigCrowdprizeProvider(zoneId); return(provider.Update(configCrowdprizeEntity, trans)); }
/// <summary> /// Update /// </summary> /// <param name="entity"></param> /// <returns></returns> /// <remarks>2016-08-15 16:43:06</remarks> public bool Update(ConfigCrowdprizeEntity entity) { return(Update(entity, null)); }
/// <summary> /// Insert /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2016-08-15 16:43:06</remarks> public bool Insert(ConfigCrowdprizeEntity entity) { return(Insert(entity, null)); }