USP_EVENTLODGINGLOCATIONS_DELETE

Executes the "Event Lodging Options: 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_EVENTLODGINGLOCATIONS_DELETE
                        (
                        @ID uniqueidentifier,
                        @CHANGEAGENTID uniqueidentifier
                        )

                        as begin

                        declare @EVENTLODGINGROOMIDCOUNT as int
                        select 
                        @EVENTLODGINGROOMIDCOUNT = COUNT(ID) 
                        from REGISTRANTLODGING 
                        where EVENTLODGINGID = @ID

                        if @EVENTLODGINGROOMIDCOUNT > 0
                            raiserror('ERR_REGISTRANT_IS_ASSIGNED_ROOM', 13, 1);

                        declare @contextCache varbinary(128);
                        --cache current context information

                        set @contextCache = CONTEXT_INFO();
                        --set CONTEXT_INFO to @CHANGEAGENTID

                        set CONTEXT_INFO @CHANGEAGENTID;

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

                        delete from EVENTLODGINGROOMINSTANCE where EVENTLODGINGID = @ID
                        delete from EVENTLODGINGROOM where EVENTLODGINGID = @ID

                        --reset CONTEXT_INFO to previous value

                        if not @contextCache is null
                            set CONTEXT_INFO @contextCache;


                        exec USP_EVENTLODGING_DELETEBYID_WITHCHANGEAGENTID @ID, @CHANGEAGENTID
                        return 0;

                        end