// ------------------------------------------------------------------ /// <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; } } }
/// <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 ) ); } } }