/// <summary> /// 带事务的Update /// </summary> /// <param name="entity"></param> /// <param name="trans">The trans.</param> /// <returns></returns> /// <remarks>2016/9/26 17:08:01</remarks> public bool Update(ActivityexItemrecordEntity entity, DbTransaction trans = null) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("dbo.P_ActivityexItemrecord_Update"); database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, entity.Idx); database.AddInParameter(commandWrapper, "@ManagerId", DbType.Guid, entity.ManagerId); database.AddInParameter(commandWrapper, "@ZoneActivityId", DbType.Int32, entity.ZoneActivityId); database.AddInParameter(commandWrapper, "@ExcitingId", DbType.Int32, entity.ExcitingId); database.AddInParameter(commandWrapper, "@GroupId", DbType.Int32, entity.GroupId); database.AddInParameter(commandWrapper, "@ItemString", DbType.AnsiString, entity.ItemString); database.AddInParameter(commandWrapper, "@RecordDate", DbType.Date, entity.RecordDate); database.AddInParameter(commandWrapper, "@Status", DbType.Int32, entity.Status); database.AddInParameter(commandWrapper, "@UpdateTime", DbType.DateTime, entity.UpdateTime); database.AddInParameter(commandWrapper, "@RowTime", DbType.DateTime, entity.RowTime); int results = 0; if (trans != null) { results = database.ExecuteNonQuery(commandWrapper, trans); } else { results = database.ExecuteNonQuery(commandWrapper); } entity.Idx = (System.Int32)database.GetParameterValue(commandWrapper, "@Idx"); return(Convert.ToBoolean(results)); }
/// <summary> /// 将IDataReader的当前记录读取到ActivityexItemrecordEntity 对象 /// </summary> /// <param name="reader"></param> /// <returns></returns> public ActivityexItemrecordEntity LoadSingleRow(IDataReader reader) { var obj = new ActivityexItemrecordEntity(); obj.Idx = (System.Int32)reader["Idx"]; obj.ManagerId = (System.Guid)reader["ManagerId"]; obj.ZoneActivityId = (System.Int32)reader["ZoneActivityId"]; obj.ExcitingId = (System.Int32)reader["ExcitingId"]; obj.GroupId = (System.Int32)reader["GroupId"]; obj.ItemString = (System.String)reader["ItemString"]; obj.RecordDate = (System.DateTime)reader["RecordDate"]; obj.Status = (System.Int32)reader["Status"]; obj.UpdateTime = (System.DateTime)reader["UpdateTime"]; obj.RowTime = (System.DateTime)reader["RowTime"]; return(obj); }
/// <summary> /// GetById /// </summary> /// <param name="idx">idx</param> /// <returns>ActivityexItemrecordEntity</returns> /// <remarks>2016/9/26 17:08:01</remarks> public ActivityexItemrecordEntity GetById(System.Int32 idx) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("P_ActivityexItemrecord_GetById"); database.AddInParameter(commandWrapper, "@Idx", DbType.Int32, idx); ActivityexItemrecordEntity obj = null; using (IDataReader reader = database.ExecuteReader(commandWrapper)) { if (reader.Read()) { obj = LoadSingleRow(reader); } } return(obj); }
/// <summary> /// GetByManagerExcitingId /// </summary> /// <param name="managerId">managerId</param> /// <param name="zoneActivityId">zoneActivityId</param> /// <param name="groupId">groupId</param> /// <returns>ActivityexItemrecordEntity</returns> /// <remarks>2016/9/26 17:08:01</remarks> public ActivityexItemrecordEntity GetByManagerExcitingId(System.Guid managerId, System.Int32 zoneActivityId, System.Int32 groupId) { var database = new SqlDatabase(this.ConnectionString); DbCommand commandWrapper = database.GetStoredProcCommand("C_ActivityExItem_GetByManagerExcitingId"); database.AddInParameter(commandWrapper, "@ManagerId", DbType.Guid, managerId); database.AddInParameter(commandWrapper, "@ZoneActivityId", DbType.Int32, zoneActivityId); database.AddInParameter(commandWrapper, "@GroupId", DbType.Int32, groupId); ActivityexItemrecordEntity obj = null; using (IDataReader reader = database.ExecuteReader(commandWrapper)) { if (reader.Read()) { obj = LoadSingleRow(reader); } } return(obj); }
public static bool Update(ActivityexItemrecordEntity activityexItemrecordEntity, DbTransaction trans = null, string zoneId = "") { var provider = new ActivityexItemrecordProvider(zoneId); return(provider.Update(activityexItemrecordEntity, trans)); }