USP_REGISTRANTTRAVEL_DELETE

Executes the "Registrant Travel: Delete" record operation.

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN Input parameter indicating the ID of the record being deleted.
@CHANGEAGENTID uniqueidentifier IN Input parameter indicating the ID of the change agent invoking the delete.

Definition

Copy


CREATE procedure dbo.USP_REGISTRANTTRAVEL_DELETE
(
    @ID uniqueidentifier,
    @CHANGEAGENTID uniqueidentifier
)
as begin
    set nocount on;

    -- Lodging information is unique to a constituent and a main event coupling, 

    -- not to a registrant record.

    declare @REGISTRANTTRAVELID as uniqueidentifier;
    select
        @REGISTRANTTRAVELID = REGISTRANTTRAVEL.ID
    from
        dbo.REGISTRANTTRAVEL
        inner join dbo.REGISTRANT on REGISTRANT.CONSTITUENTID = REGISTRANTTRAVEL.REGISTRANTCONSTITUENTID
        inner join dbo.EVENT on REGISTRANT.EVENTID = EVENT.ID
    where
        REGISTRANT.ID = @ID
        and (EVENT.ID = REGISTRANTTRAVEL.MAINEVENTID or EVENT.MAINEVENTID = REGISTRANTTRAVEL.MAINEVENTID);

    -- use the system generated delete routine to allow proper recording of the deleting agent

    begin try
        exec USP_REGISTRANTTRAVEL_DELETEBYID_WITHCHANGEAGENTID @REGISTRANTTRAVELID, @CHANGEAGENTID
    end try

    begin catch
        exec dbo.USP_RAISE_ERROR;
        return 1;
    end catch

    return 0;

end