/// <summary> /// 将IDataReader的当前记录读取到ConfigCrowdmoraleEntity 对象 /// </summary> /// <param name="reader"></param> /// <returns></returns> public ConfigCrowdmoraleEntity LoadSingleRow(IDataReader reader) { var obj = new ConfigCrowdmoraleEntity(); obj.Idx = (System.Int32)reader["Idx"]; obj.CostMorela = (System.Int32)reader["CostMorela"]; return(obj); }
/// <summary> /// GetById /// </summary> /// <param name="idx">idx</param> /// <returns>ConfigCrowdmoraleEntity</returns> /// <remarks>2016-08-15 16:41:51</remarks> public ConfigCrowdmoraleEntity GetById(System.Int32 idx) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("P_ConfigCrowdmorale_GetById"); database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, idx); ConfigCrowdmoraleEntity 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-08-15 16:41:51</remarks> public bool Update(ConfigCrowdmoraleEntity entity, DbTransaction trans) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_ConfigCrowdmorale_Update"); database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx); database.AddInParameter(commandWrapper, "@CostMorela", DbType.Int32, entity.CostMorela); 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-08-15 16:41:51</remarks> public bool Update(ConfigCrowdmoraleEntity 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:41:51</remarks> public bool Insert(ConfigCrowdmoraleEntity entity) { return(Insert(entity, null)); }
public static bool Update(ConfigCrowdmoraleEntity configCrowdmoraleEntity, DbTransaction trans = null, string zoneId = "") { var provider = new ConfigCrowdmoraleProvider(zoneId); return(provider.Update(configCrowdmoraleEntity, trans)); }