/// <summary> /// 带事务的Update /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2016/6/3 13:04:02</remarks> public bool Update(ConfigMallgiftbagEntity entity, DbTransaction trans) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_ConfigMallgiftbag_Update"); database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx); database.AddInParameter(commandWrapper, "@MallCode", DbType.Int32, entity.MallCode); database.AddInParameter(commandWrapper, "@PrizeType", DbType.Int32, entity.PrizeType); database.AddInParameter(commandWrapper, "@SubType", DbType.Int32, entity.SubType); database.AddInParameter(commandWrapper, "@ItemCount", DbType.Int32, entity.ItemCount); int results = 0; if (trans != null) { results = database.ExecuteNonQuery(commandWrapper, trans); } else { results = database.ExecuteNonQuery(commandWrapper); } return(Convert.ToBoolean(results)); }
/// <summary> /// 将IDataReader的当前记录读取到ConfigMallgiftbagEntity 对象 /// </summary> /// <param name="reader"></param> /// <returns></returns> public ConfigMallgiftbagEntity LoadSingleRow(IDataReader reader) { var obj = new ConfigMallgiftbagEntity(); obj.Idx = (System.Int32)reader["Idx"]; obj.MallCode = (System.Int32)reader["MallCode"]; obj.PrizeType = (System.Int32)reader["PrizeType"]; obj.SubType = (System.Int32)reader["SubType"]; obj.ItemCount = (System.Int32)reader["ItemCount"]; return(obj); }
/// <summary> /// GetById /// </summary> /// <param name="idx">idx</param> /// <returns>ConfigMallgiftbagEntity</returns> /// <remarks>2016/6/3 13:04:02</remarks> public ConfigMallgiftbagEntity GetById(System.Int32 idx) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("P_ConfigMallgiftbag_GetById"); database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, idx); ConfigMallgiftbagEntity 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>2016/6/3 13:04:02</remarks> public bool Update(ConfigMallgiftbagEntity entity) { return(Update(entity, null)); }
/// <summary> /// Insert /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2016/6/3 13:04:02</remarks> public bool Insert(ConfigMallgiftbagEntity entity) { return(Insert(entity, null)); }
public static bool Update(ConfigMallgiftbagEntity configMallgiftbagEntity, DbTransaction trans = null, string zoneId = "") { var provider = new ConfigMallgiftbagProvider(zoneId); return(provider.Update(configMallgiftbagEntity, trans)); }