USP_DATAFORMTEMPLATE_ADD_PRINTMEMBERSHIPCARDSPROCESS
The save procedure used by the add dataform template "Print Membership Cards Process Add Form".
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | INOUT | The output parameter indicating the ID of the record added. |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the procedure. |
@CURRENTAPPUSERID | uniqueidentifier | IN | Input parameter indicating the ID of the current user. |
@NAME | nvarchar(100) | IN | Name |
@DESCRIPTION | nvarchar(255) | IN | Description |
@MEMBERSHIPPROGRAMID | uniqueidentifier | IN | Membership program |
@MEMBERSHIPLEVELID | uniqueidentifier | IN | Level |
@IDSETREGISTERID | uniqueidentifier | IN | Selection |
@MEMBERSHIPCARDFORMAT | nvarchar(255) | IN | Card format to use |
@CREATEOUTPUTIDSET | bit | IN | Create constituent selection from results |
@OUTPUTIDSETNAME | nvarchar(100) | IN | Selection name |
@OVERWRITEOUTPUTIDSET | bit | IN | Overwrite existing selection |
@LETTERTEMPLATEID | uniqueidentifier | IN | Letter template to use |
@REPORTCATALOGID | uniqueidentifier | IN | Report to use |
@LIMITTO | int | IN | |
@LIMITMEMBERS | bit | IN | Limit to |
@ISHIDDEN | bit | IN |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_PRINTMEMBERSHIPCARDSPROCESS
(
@ID uniqueidentifier = null output,
@CHANGEAGENTID uniqueidentifier = null,
@CURRENTAPPUSERID uniqueidentifier,
@NAME nvarchar(100) = null,
@DESCRIPTION nvarchar(255) = '',
@MEMBERSHIPPROGRAMID uniqueidentifier = null,
@MEMBERSHIPLEVELID uniqueidentifier = null,
@IDSETREGISTERID uniqueidentifier = null,
@MEMBERSHIPCARDFORMAT nvarchar(255) = null,
@CREATEOUTPUTIDSET bit = 0,
@OUTPUTIDSETNAME nvarchar(100) = '',
@OVERWRITEOUTPUTIDSET bit = 0,
@LETTERTEMPLATEID uniqueidentifier = null,
@REPORTCATALOGID uniqueidentifier = null,
@LIMITTO int = 1,
@LIMITMEMBERS bit = 0,
@ISHIDDEN bit = 0
)
as
set nocount on;
if @ID is null
set @ID = newid();
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
declare @CURRENTDATE datetime;
set @CURRENTDATE = getdate();
if @LIMITMEMBERS = 0
set @LIMITTO = 0
if (coalesce(@MEMBERSHIPCARDFORMAT, '') <> '') and @LETTERTEMPLATEID is null
begin
declare @CARDCATALOGID uniqueidentifier
select top 1 @CARDCATALOGID = ID from dbo.REPORTCATALOG where NAME = @MEMBERSHIPCARDFORMAT
if not @CARDCATALOGID is null
set @REPORTCATALOGID = @CARDCATALOGID
end
else
begin
set @REPORTCATALOGID = null
set @MEMBERSHIPCARDFORMAT = ''
end
begin try
insert into dbo.PRINTMEMBERSHIPCARDSPROCESS
(
ID,
[NAME],
[DESCRIPTION],
MEMBERSHIPPROGRAMID,
MEMBERSHIPLEVELID,
IDSETREGISTERID,
MEMBERSHIPCARDFORMAT,
CREATEOUTPUTIDSET,
OUTPUTIDSETNAME,
OVERWRITEOUTPUTIDSET,
LETTERTEMPLATEID,
REPORTCATALOGID,
[LIMITTO],
ISHIDDEN,
ADDEDBYID,
CHANGEDBYID,
DATEADDED,
DATECHANGED
)
values
(
@ID,
@NAME,
@DESCRIPTION,
@MEMBERSHIPPROGRAMID,
@MEMBERSHIPLEVELID,
@IDSETREGISTERID,
@MEMBERSHIPCARDFORMAT,
@CREATEOUTPUTIDSET,
@OUTPUTIDSETNAME,
@OVERWRITEOUTPUTIDSET,
@LETTERTEMPLATEID,
@REPORTCATALOGID,
@LIMITTO,
@ISHIDDEN,
@CHANGEAGENTID,
@CHANGEAGENTID,
@CURRENTDATE,
@CURRENTDATE
)
exec dbo.USP_BUSINESSPROCESSINSTANCE_ADD @CHANGEAGENTID = @CHANGEAGENTID,
@BUSINESSPROCESSCATALOGID = '8debf336-c3c9-4097-80c2-c76c9532486f',
@BUSINESSPROCESSPARAMETERSETID = @ID,
@OWNERID = @CURRENTAPPUSERID;
end try
begin catch
exec dbo.USP_RAISE_ERROR;
return 1;
end catch
return 0;