USP_DATAFORMTEMPLATE_ADD_CONSTITUENTTRIBUTE
The save procedure used by the add dataform template "Constituent Tribute Add Form".
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | INOUT | The output parameter indicating the ID of the record added. |
@CONSTITUENTID | uniqueidentifier | IN | Input parameter indicating the context ID for the record being added. |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the procedure. |
@TRIBUTETYPECODEID | uniqueidentifier | IN | Tribute type |
@TRIBUTETEXT | nvarchar(255) | IN | Tribute text |
@NAMEFORMATFUNCTIONID | uniqueidentifier | IN | Name format |
@DESIGNATIONID | uniqueidentifier | IN | Default designation |
@TRIBUTEEID | uniqueidentifier | IN | Tributee |
@TRIBUTELETTERCODEID | uniqueidentifier | IN | Default tribute letter |
@SITES | xml | IN | Sites |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_CONSTITUENTTRIBUTE
(
@ID uniqueidentifier = null output,
@CONSTITUENTID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier = null,
@TRIBUTETYPECODEID uniqueidentifier,
@TRIBUTETEXT nvarchar(255),
@NAMEFORMATFUNCTIONID uniqueidentifier = null,
@DESIGNATIONID uniqueidentifier = null,
@TRIBUTEEID uniqueidentifier = null,
@TRIBUTELETTERCODEID uniqueidentifier = null,
@SITES xml = null
)
as
set nocount on;
declare @CURRENTDATE datetime;
set @CURRENTDATE = getdate();
begin try
if @ID is null
set @ID = newid();
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
insert into dbo.TRIBUTE
(ID,TRIBUTETYPECODEID,TRIBUTETEXT,TRIBUTEEID,DESIGNATIONID,NAMEFORMATFUNCTIONID,ADDEDBYID,CHANGEDBYID,DATEADDED,DATECHANGED)
values
(@ID,@TRIBUTETYPECODEID,@TRIBUTETEXT,@TRIBUTEEID,@DESIGNATIONID,@NAMEFORMATFUNCTIONID,@CHANGEAGENTID,@CHANGEAGENTID,@CURRENTDATE,@CURRENTDATE);
if (@TRIBUTEEID is not null) and (not exists (select ID from dbo.DECEASEDCONSTITUENT where ID = @TRIBUTEEID))
insert into dbo.TRIBUTEACKNOWLEDGEE
(ID,TRIBUTEID,CONSTITUENTID,TRIBUTELETTERCODEID,SEQUENCE,ADDEDBYID,CHANGEDBYID,DATEADDED,DATECHANGED)
values
(newid(),@ID, @TRIBUTEEID,@TRIBUTELETTERCODEID,1,@CHANGEAGENTID,@CHANGEAGENTID,@CURRENTDATE,@CURRENTDATE);
exec dbo.USP_TRIBUTE_GETSITES_ADDFROMXML @ID, @SITES, @CHANGEAGENTID, @CURRENTDATE
end try
begin catch
exec dbo.USP_RAISE_ERROR;
return 1;
end catch
return 0;