Beispiel #1
0
		// ------------------------------------------------------------------

		/// <summary>
		/// Load an object by a given ID.
		/// </summary>
		public static TicketEvent GetByID(
			int id )
		{
			DataRow row = AdoNetSqlHelper.ExecuteRow(
				"GetTicketEventByID",
				new AdoNetSqlParamCollection(
				AdoNetSqlParamCollection.CreateParameter( "@ID", id )
				) );

			if ( row == null )
			{
				return null;
			}
			else
			{
				TicketEvent o = new TicketEvent();
				o.Load( row );

				if ( o.IsEmpty )
				{
					return null;
				}
				else
				{
					return o;
				}
			}
		}
Beispiel #2
0
		/// <summary>
		/// Load all for the given parent.
		/// </summary>
		public static TicketEvent[] GetForTicket(
			Ticket parentObject )
		{
			DataTable table = AdoNetSqlHelper.ExecuteTable(
				"GetTicketEventsByTicketID",
				new AdoNetSqlParamCollection(
				AdoNetSqlParamCollection.CreateParameter( "@ID", parentObject.ID )
				) );

			if ( table == null )
			{
				return null;
			}
			else
			{
				ArrayList result = new ArrayList();

				foreach ( DataRow row in table.Rows )
				{
					TicketEvent o = new TicketEvent();
					o.Load( row );

					if ( !o.IsEmpty )
					{
						result.Add( o );
					}
				}

				if ( result.Count <= 0 )
				{
					return null;
				}
				else
				{
					return (TicketEvent[])result.ToArray(
						typeof( TicketEvent ) );
				}
			}
		}