USP_SPONSORSHIP_CANCELTRANSFER
Cancel a sponsorship with a pending transfer.
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ORIGINALSPONSORSHIPID | uniqueidentifier | IN | |
@PENDINGSPONSORSHIPID | uniqueidentifier | IN | |
@SPONSORSHIPREASONID | uniqueidentifier | IN | |
@CHANGEAGENTID | uniqueidentifier | IN | |
@ACTIONCODE | tinyint | IN |
Definition
Copy
CREATE procedure dbo.USP_SPONSORSHIP_CANCELTRANSFER (
@ORIGINALSPONSORSHIPID uniqueidentifier,
@PENDINGSPONSORSHIPID uniqueidentifier,
@SPONSORSHIPREASONID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier = null,
@ACTIONCODE tinyint = 2
)
as
begin
set nocount on;
declare @CURRENTDATE datetime;
set @CURRENTDATE = getdate();
declare @ENDDATE date;
set @ENDDATE = @CURRENTDATE;
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
begin try
---------------------------------------------------------------------
-- Close out the pending transfer first.
exec dbo.USP_SPONSORSHIP_INACTIVATE
@PENDINGSPONSORSHIPID,
null,
1,
@CHANGEAGENTID
---------------------------------------------------------------------
-- Close the commitment.
exec dbo.USP_SPONSORSHIP_CLOSECOMMITMENT
@ORIGINALSPONSORSHIPID,
@ENDDATE,
@ACTIONCODE,
@SPONSORSHIPREASONID,
null,
@PENDINGSPONSORSHIPID,
@CHANGEAGENTID
end try
begin catch
exec dbo.USP_RAISE_ERROR;
return 1;
end catch
return 0
end