USP_DATAFORMTEMPLATE_ADD_SPONSORSHIPLOCATION
The save procedure used by the add dataform template "Sponsorship Location Add Form".
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | INOUT | The output parameter indicating the ID of the record added. |
@PARENTLOCATIONID | 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. |
@NAME | nvarchar(100) | IN | Name |
@SPONSORSHIPLOCATIONTYPECODEID | uniqueidentifier | IN | Type |
@DESIGNATIONID | uniqueidentifier | IN | Designation |
@COMMENT | nvarchar(255) | IN | Comments |
@FIELDOFFICEID | uniqueidentifier | IN | Field office |
@DISPLAYONLINE | bit | IN | Show this location to online users |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_SPONSORSHIPLOCATION
(
@ID uniqueidentifier = null output,
@PARENTLOCATIONID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier = null,
@NAME nvarchar(100) = '',
@SPONSORSHIPLOCATIONTYPECODEID uniqueidentifier = null,
@DESIGNATIONID uniqueidentifier = null,
@COMMENT nvarchar(255) = null,
@FIELDOFFICEID uniqueidentifier = null,
@DISPLAYONLINE bit = 1
)
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.SPONSORSHIPLOCATION (
ID,
NAME,
SPONSORSHIPLOCATIONTYPECODEID,
HIERARCHYPATH,
DESIGNATIONID,
ADDEDBYID,
CHANGEDBYID,
DATEADDED,
DATECHANGED,
COMMENT,
FIELDOFFICEID,
STATUSCODE,
DISPLAYONLINE
)
values (
@ID,
@NAME,
@SPONSORSHIPLOCATIONTYPECODEID,
dbo.UFN_SPONSORSHIPLOCATION_GETNEWDESCENDANTVALUE(@PARENTLOCATIONID),
@DESIGNATIONID,
@CHANGEAGENTID,
@CHANGEAGENTID,
@CURRENTDATE,
@CURRENTDATE,
@COMMENT,
@FIELDOFFICEID,
isnull((select STATUSCODE
from dbo.SPONSORSHIPLOCATION
where ID = @PARENTLOCATIONID),0),
@DISPLAYONLINE
)
end try
begin catch
exec dbo.USP_RAISE_ERROR
return 1
end catch
return 0