USP_DATAFORMTEMPLATE_ADD_STUDENTRELATIONCONSTITUENCYSETTING

The save procedure used by the add dataform template "Student Relation Constituency criteria Add Data 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.
@CONSTITUENCYCODEID uniqueidentifier IN Constituency
@RELATEDTOCODE tinyint IN Related to
@RELATIONSHIPTYPES xml IN Relationships that receive this constituency

Definition

Copy


CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_STUDENTRELATIONCONSTITUENCYSETTING
(
    @ID uniqueidentifier = null output,
    @CHANGEAGENTID uniqueidentifier = null,
    @CONSTITUENCYCODEID uniqueidentifier,
    @RELATEDTOCODE tinyint,
    @RELATIONSHIPTYPES xml
)
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.STUDENTRELATIONCONSTITUENCYSETTINGS
        (ID, CONSTITUENCYCODEID, RELATEDTOCODE, ADDEDBYID, CHANGEDBYID, DATEADDED, DATECHANGED)
    values
        (@ID, @CONSTITUENCYCODEID, @RELATEDTOCODE, @CHANGEAGENTID, @CHANGEAGENTID, @CURRENTDATE, @CURRENTDATE)

    exec dbo.USP_STUDENTRELATIONCONSTITUENCY_GETTYPES_ADDFROMXML @ID, @RELATIONSHIPTYPES, @CHANGEAGENTID, @CURRENTDATE;

end try

begin catch
    exec dbo.USP_RAISE_ERROR
    return 1
end catch

return 0