/// <summary> /// 带事务的Update /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2015/10/19 15:49:01</remarks> public bool Update(ConfigSynthesisEntity entity, DbTransaction trans) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_ConfigSynthesis_Update"); database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx); database.AddInParameter(commandWrapper, "@CardLevel", DbType.Int32, entity.CardLevel); database.AddInParameter(commandWrapper, "@Rate", DbType.Int32, entity.Rate); database.AddInParameter(commandWrapper, "@Coin", DbType.Int32, entity.Coin); database.AddInParameter(commandWrapper, "@CardLibrary", DbType.Int32, entity.CardLibrary); database.AddInParameter(commandWrapper, "@ProtectCode", DbType.Int32, entity.ProtectCode); int results = 0; if (trans != null) { results = database.ExecuteNonQuery(commandWrapper, trans); } else { results = database.ExecuteNonQuery(commandWrapper); } return(Convert.ToBoolean(results)); }
/// <summary> /// 将IDataReader的当前记录读取到ConfigSynthesisEntity 对象 /// </summary> /// <param name="reader"></param> /// <returns></returns> public ConfigSynthesisEntity LoadSingleRow(IDataReader reader) { var obj = new ConfigSynthesisEntity(); obj.Idx = (System.Int32)reader["Idx"]; obj.CardLevel = (System.Int32)reader["CardLevel"]; obj.Rate = (System.Int32)reader["Rate"]; obj.Coin = (System.Int32)reader["Coin"]; obj.CardLibrary = (System.Int32)reader["CardLibrary"]; obj.ProtectCode = (System.Int32)reader["ProtectCode"]; return(obj); }
/// <summary> /// GetById /// </summary> /// <param name="idx">idx</param> /// <returns>ConfigSynthesisEntity</returns> /// <remarks>2015/10/19 15:49:00</remarks> public ConfigSynthesisEntity GetById(System.Int32 idx) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("P_ConfigSynthesis_GetById"); database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, idx); ConfigSynthesisEntity obj = null; using (IDataReader reader = database.ExecuteReader(commandWrapper)) { if (reader.Read()) { obj = LoadSingleRow(reader); } } return(obj); }
/// <summary> /// Update /// </summary> /// <param name="entity"></param> /// <returns></returns> /// <remarks>2015/10/19 15:49:01</remarks> public bool Update(ConfigSynthesisEntity entity) { return(Update(entity, null)); }
/// <summary> /// Insert /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2015/10/19 15:49:01</remarks> public bool Insert(ConfigSynthesisEntity entity) { return(Insert(entity, null)); }
public static bool Update(ConfigSynthesisEntity configSynthesisEntity, DbTransaction trans = null, string zoneId = "") { var provider = new ConfigSynthesisProvider(zoneId); return(provider.Update(configSynthesisEntity, trans)); }