USP_DATAFORMTEMPLATE_EDIT_MEMBERSHIPCANCELLATIONREASON
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | |
@CHANGEAGENTID | uniqueidentifier | IN | |
@REASONCODE | uniqueidentifier | IN |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDIT_MEMBERSHIPCANCELLATIONREASON
(
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier = null,
@REASONCODE uniqueidentifier
)
as
set nocount on;
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output
declare @CURRENTDATE datetime
set @CURRENTDATE = getdate()
begin try
-- Ensure membershiphasn't already been cancelled.
if exists (select 1 from dbo.MEMBERSHIP where ID = @ID and STATUSCODE = 1)
raiserror('BBERR_MEMBERSHIP_ALREADYCANCELLED',13,1);
exec dbo.USP_MEMBERSHIP_CANCEL @ID, @CHANGEAGENTID, @REASONCODE;
end try
begin catch
exec dbo.USP_RAISE_ERROR
return 1
end catch
return 0;