/// <summary> /// 带事务的Update /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2015/10/19 10:47:32</remarks> public bool Update(ConfigMallextraEntity entity, DbTransaction trans) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_ConfigMallextra_Update"); database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx); database.AddInParameter(commandWrapper, "@ExtraType", DbType.Int32, entity.ExtraType); database.AddInParameter(commandWrapper, "@UsedCount", DbType.Int32, entity.UsedCount); database.AddInParameter(commandWrapper, "@MallCode", DbType.Int32, entity.MallCode); int results = 0; if (trans != null) { results = database.ExecuteNonQuery(commandWrapper, trans); } else { results = database.ExecuteNonQuery(commandWrapper); } return(Convert.ToBoolean(results)); }
/// <summary> /// 将IDataReader的当前记录读取到ConfigMallextraEntity 对象 /// </summary> /// <param name="reader"></param> /// <returns></returns> public ConfigMallextraEntity LoadSingleRow(IDataReader reader) { var obj = new ConfigMallextraEntity(); obj.Idx = (System.Int32)reader["Idx"]; obj.ExtraType = (System.Int32)reader["ExtraType"]; obj.UsedCount = (System.Int32)reader["UsedCount"]; obj.MallCode = (System.Int32)reader["MallCode"]; return(obj); }
/// <summary> /// GetById /// </summary> /// <param name="idx">idx</param> /// <returns>ConfigMallextraEntity</returns> /// <remarks>2015/10/19 10:47:32</remarks> public ConfigMallextraEntity GetById(System.Int32 idx) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("P_ConfigMallextra_GetById"); database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, idx); ConfigMallextraEntity obj = null; using (IDataReader reader = database.ExecuteReader(commandWrapper)) { if (reader.Read()) { obj = LoadSingleRow(reader); } } return(obj); }
public static bool Update(ConfigMallextraEntity configMallextraEntity, DbTransaction trans = null, string zoneId = "") { var provider = new ConfigMallextraProvider(zoneId); return(provider.Update(configMallextraEntity, trans)); }
/// <summary> /// Update /// </summary> /// <param name="entity"></param> /// <returns></returns> /// <remarks>2015/10/19 10:47:32</remarks> public bool Update(ConfigMallextraEntity 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:47:32</remarks> public bool Insert(ConfigMallextraEntity entity) { return(Insert(entity, null)); }