USP_REGISTRANT_MARKASWILLNOTATTEND

Executes the "Registrant Mark As Will Not Attend" record operation.

Parameters

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

Definition

Copy


CREATE procedure dbo.USP_REGISTRANT_MARKASWILLNOTATTEND
(
    @ID uniqueidentifier,
    @CHANGEAGENTID uniqueidentifier = null
)
as
    set nocount on;

    if @CHANGEAGENTID is null  
        exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;

    declare @CURRENTDATE datetime = getdate();

    --6/6/13 It appears to be impossible to mark "Will not attend" on a walk-in registration

    --since that marks Attended as true and there is no way to un-mark attended,

    --but I'm leaving the logic just in case there's a way to do it.


    update
        dbo.REGISTRANT
    set
        WILLNOTATTEND = 1,
        ATTENDED = case ISWALKIN when 1 then 0 else ATTENDED end,
        USERMARKEDATTENDANCE = case ISWALKIN when 1 then 0 else USERMARKEDATTENDANCE end,
        CHANGEDBYID = @CHANGEAGENTID,
        DATECHANGED = @CURRENTDATE
    where
        REGISTRANT.ID = @ID;

    update
        dbo.EVENTSEATINGSEAT
    set
        REGISTRANTID = null,
        CHANGEDBYID = @CHANGEAGENTID,
        DATECHANGED = @CURRENTDATE
    where
        EVENTSEATINGSEAT.REGISTRANTID = @ID;

    return 0;