/// <summary> /// 带事务的Update /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2016/3/3 17:18:10</remarks> public bool Update(DicActivitystepEntity entity, DbTransaction trans) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_DicActivitystep_Update"); database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx); database.AddInParameter(commandWrapper, "@ActivityId", DbType.Int32, entity.ActivityId); database.AddInParameter(commandWrapper, "@ActivityStep", DbType.Int32, entity.ActivityStep); database.AddInParameter(commandWrapper, "@Condition", DbType.AnsiString, entity.Condition); database.AddInParameter(commandWrapper, "@Description", DbType.String, entity.Description); int results = 0; if (trans != null) { results = database.ExecuteNonQuery(commandWrapper, trans); } else { results = database.ExecuteNonQuery(commandWrapper); } return(Convert.ToBoolean(results)); }
/// <summary> /// 将IDataReader的当前记录读取到DicActivitystepEntity 对象 /// </summary> /// <param name="reader"></param> /// <returns></returns> public DicActivitystepEntity LoadSingleRow(IDataReader reader) { var obj = new DicActivitystepEntity(); obj.Idx = (System.Int32)reader["Idx"]; obj.ActivityId = (System.Int32)reader["ActivityId"]; obj.ActivityStep = (System.Int32)reader["ActivityStep"]; obj.Condition = (System.String)reader["Condition"]; obj.Description = (System.String)reader["Description"]; return(obj); }
/// <summary> /// GetById /// </summary> /// <param name="idx">idx</param> /// <returns>DicActivitystepEntity</returns> /// <remarks>2016/3/3 17:18:10</remarks> public DicActivitystepEntity GetById(System.Int32 idx) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("P_DicActivitystep_GetById"); database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, idx); DicActivitystepEntity 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/3/3 17:18:10</remarks> public bool Update(DicActivitystepEntity entity) { return(Update(entity, null)); }
/// <summary> /// Insert /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2016/3/3 17:18:10</remarks> public bool Insert(DicActivitystepEntity entity) { return(Insert(entity, null)); }
public static bool Update(DicActivitystepEntity dicActivitystepEntity, DbTransaction trans = null, string zoneId = "") { var provider = new DicActivitystepProvider(zoneId); return(provider.Update(dicActivitystepEntity, trans)); }