USP_DATAFORMTEMPLATE_ADD_BENEFITUNIT
The save procedure used by the add dataform template "Unit Benefit 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. |
@NAME | nvarchar(100) | IN | Name |
@DESCRIPTION | nvarchar(255) | IN | Description |
@BENEFITCATEGORYCODEID | uniqueidentifier | IN | Category |
@VALUE | money | IN | Value |
@SENDBENEFITCODE | tinyint | IN | Send benefit when pledge is |
@SITES | xml | IN | Sites |
@CURRENTAPPUSERID | uniqueidentifier | IN | Input parameter indicating the ID of the current user. |
@BASECURRENCYID | uniqueidentifier | IN | Base currency ID |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_BENEFITUNIT
(
@ID uniqueidentifier = null output,
@CHANGEAGENTID uniqueidentifier = null,
@NAME nvarchar(100) = '',
@DESCRIPTION nvarchar(255) = '',
@BENEFITCATEGORYCODEID uniqueidentifier = null,
@VALUE money = 0,
@SENDBENEFITCODE tinyint = 0,
@SITES xml =null,
@CURRENTAPPUSERID uniqueidentifier = null,
@BASECURRENCYID uniqueidentifier = null
)
as
begin
set nocount on;
declare @CURRENTDATE datetime
IF @ID is null
set @ID = newid()
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output
set @CURRENTDATE = getdate()
begin try
if @BASECURRENCYID is null
set @BASECURRENCYID = dbo.UFN_APPUSER_GETBASECURRENCY(@CURRENTAPPUSERID);
insert into dbo.BENEFIT
(ID,NAME,DESCRIPTION,BENEFITCATEGORYCODEID,VALUE,SENDBENEFITCODE,ADDEDBYID,CHANGEDBYID,DATEADDED,DATECHANGED,BASECURRENCYID)
VALUES
(@ID,@NAME,@DESCRIPTION,@BENEFITCATEGORYCODEID,@VALUE,@SENDBENEFITCODE,@CHANGEAGENTID,@CHANGEAGENTID,@CURRENTDATE,@CURRENTDATE,@BASECURRENCYID)
exec dbo.USP_BENEFITSITE_GETSITES_ADDFROMXML @ID, @SITES, @CHANGEAGENTID;
end try
begin catch
exec dbo.USP_RAISE_ERROR
return 1
end catch
return 0
end