USP_DATAFORMTEMPLATE_EDIT_INCENTIVEOPTION

The save procedure used by the edit dataform template "IncentiveOption Edit Data Form".

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN The input ID parameter indicating the ID of the record being edited.
@CHANGEAGENTID uniqueidentifier IN Input parameter indicating the ID of the change agent invoking the procedure.
@EVENTID uniqueidentifier IN Event
@ALLOWPARTICIPANTCHOOSEBENEFITCODE tinyint IN Allow participant to choose benefit code
@ALLOWPARTICIPANTONLYRECEIVEBENEFITLEVELCODE tinyint IN Allow participant to receive benefit level
@ALLOWPARTICIPANTSWAIVEBENEFITS bit IN Allow participant to waive benefits

Definition

Copy

CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDIT_INCENTIVEOPTION(
    @ID uniqueidentifier,
    @CHANGEAGENTID uniqueidentifier = null,
  @EVENTID uniqueidentifier,
  @ALLOWPARTICIPANTCHOOSEBENEFITCODE tinyint,
  @ALLOWPARTICIPANTONLYRECEIVEBENEFITLEVELCODE tinyint,
  @ALLOWPARTICIPANTSWAIVEBENEFITS bit
)
as

    set nocount on;

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

    declare @CURRENTDATE datetime
    set @CURRENTDATE = getdate()

    begin try
        -- handle updating the data
        update dbo.EVENTATTRIBUTES set
        EVENTID = @EVENTID,
             ALLOWPARTICIPANTCHOOSEBENEFITCODE = coalesce(@ALLOWPARTICIPANTCHOOSEBENEFITCODE, 0),
       ALLOWPARTICIPANTONLYRECEIVEBENEFITLEVELCODE = coalesce(@ALLOWPARTICIPANTONLYRECEIVEBENEFITLEVELCODE, 0),
       ALLOWPARTICIPANTSWAIVEBENEFITS= ISNULL(@ALLOWPARTICIPANTSWAIVEBENEFITS, ALLOWPARTICIPANTSWAIVEBENEFITS),
            CHANGEDBYID = @CHANGEAGENTID,  
        DATECHANGED = getdate()

         from dbo.EVENTATTRIBUTES EA(NOLOCK)
         left join dbo.EVENT E (NOLOCK)ON EA.EVENTID = E.ID
         where E.ID = @ID

      EXEC USP_DATAFORMTEMPLATE_EDIT_EVENT_FAF_CONFIG @EVENTID = @EVENTID, @INCENTIVEOPTIONISSET = 1, @CHANGEAGENTID = @CHANGEAGENTID

      exec dbo.USP_FAFDATACACHE_CLEAR @EVENTID=@EVENTID

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

return 0;