USP_DATAFORMTEMPLATE_ADD_STORY
The save procedure used by the add dataform template "Story 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. |
@REGISTRANTID | uniqueidentifier | IN | Registrant |
@EVENTID | uniqueidentifier | IN | Event |
@STORYTEXT | nvarchar(4000) | IN | Storytext |
@FAFIMAGESID | uniqueidentifier | IN | Fafimagesid |
@IMAGECODE | tinyint | IN | Image |
@TEAMFUNDRAISINGTEAMID | uniqueidentifier | IN | Team |
@TYPECODE | tinyint | IN | Type |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_STORY
(
@ID uniqueidentifier = null output,
@CHANGEAGENTID uniqueidentifier = null,
@REGISTRANTID uniqueidentifier = null,
@EVENTID uniqueidentifier = null,
@STORYTEXT nvarchar(4000) = '',
@FAFIMAGESID uniqueidentifier = null,
@IMAGECODE tinyint = 0,
@TEAMFUNDRAISINGTEAMID uniqueidentifier = null,
@TYPECODE tinyint = 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()
begin try
-- handle inserting the data
insert into dbo.STORY
(ID, REGISTRANTID, EVENTID, STORYTEXT, FAFIMAGESID, IMAGECODE, TEAMFUNDRAISINGTEAMID, TYPECODE, ADDEDBYID, CHANGEDBYID, DATEADDED, DATECHANGED)
values
(@ID, @REGISTRANTID, @EVENTID, @STORYTEXT, @FAFIMAGESID, @IMAGECODE, @TEAMFUNDRAISINGTEAMID, @TYPECODE, @CHANGEAGENTID, @CHANGEAGENTID, @CURRENTDATE, @CURRENTDATE)
end try
begin catch
exec dbo.USP_RAISE_ERROR
return 1
end catch
-- Event level story change, clear front end event level data caching
if (@REGISTRANTID=null and @TEAMFUNDRAISINGTEAMID=null)
exec dbo.USP_FAFDATACACHE_CLEAR @EVENTID=@EVENTID
return 0