/// <summary> /// 带事务的Update /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2016/1/14 12:48:32</remarks> public bool Update(ConfigDecomposeEntity entity, DbTransaction trans) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_ConfigDecompose_Update"); database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx); database.AddInParameter(commandWrapper, "@CardLevel", DbType.Int32, entity.CardLevel); database.AddInParameter(commandWrapper, "@Coin", DbType.Int32, entity.Coin); database.AddInParameter(commandWrapper, "@CritiRate", DbType.Int32, entity.CritiRate); database.AddInParameter(commandWrapper, "@EquipmentRate", DbType.Int32, entity.EquipmentRate); database.AddInParameter(commandWrapper, "@EquipmentLotteryId", DbType.Int32, entity.EquipmentLotteryId); int results = 0; if (trans != null) { results = database.ExecuteNonQuery(commandWrapper, trans); } else { results = database.ExecuteNonQuery(commandWrapper); } return(Convert.ToBoolean(results)); }
/// <summary> /// 将IDataReader的当前记录读取到ConfigDecomposeEntity 对象 /// </summary> /// <param name="reader"></param> /// <returns></returns> public ConfigDecomposeEntity LoadSingleRow(IDataReader reader) { var obj = new ConfigDecomposeEntity(); obj.Idx = (System.Int32)reader["Idx"]; obj.CardLevel = (System.Int32)reader["CardLevel"]; obj.Coin = (System.Int32)reader["Coin"]; obj.CritiRate = (System.Int32)reader["CritiRate"]; obj.EquipmentRate = (System.Int32)reader["EquipmentRate"]; obj.EquipmentLotteryId = (System.Int32)reader["EquipmentLotteryId"]; return(obj); }
/// <summary> /// GetById /// </summary> /// <param name="idx">idx</param> /// <returns>ConfigDecomposeEntity</returns> /// <remarks>2016/1/14 12:48:32</remarks> public ConfigDecomposeEntity GetById(System.Int32 idx) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("P_ConfigDecompose_GetById"); database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, idx); ConfigDecomposeEntity obj = null; using (IDataReader reader = database.ExecuteReader(commandWrapper)) { if (reader.Read()) { obj = LoadSingleRow(reader); } } return(obj); }
public static bool Update(ConfigDecomposeEntity configDecomposeEntity, DbTransaction trans = null, string zoneId = "") { var provider = new ConfigDecomposeProvider(zoneId); return(provider.Update(configDecomposeEntity, trans)); }
/// <summary> /// Update /// </summary> /// <param name="entity"></param> /// <returns></returns> /// <remarks>2016/1/14 12:48:32</remarks> public bool Update(ConfigDecomposeEntity entity) { return(Update(entity, null)); }
/// <summary> /// Insert /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2016/1/14 12:48:32</remarks> public bool Insert(ConfigDecomposeEntity entity) { return(Insert(entity, null)); }