USP_DATAFORMTEMPLATE_EDIT_SPONSORSHIPLOCATION_2

The save procedure used by the edit dataform template "Sponsorship Location Edit Form".

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN The input ID parameter indicating the ID of the record being edited.
@CHANGEAGENTID uniqueidentifier IN Input parameter indicating the ID of the change agent invoking the procedure.
@NAME nvarchar(100) IN Name
@TYPE uniqueidentifier IN Type
@DESIGNATION uniqueidentifier IN Designation
@COMMENT nvarchar(255) IN Comments
@LOOKUPID nvarchar(100) IN Lookup ID
@FIELDOFFICEID uniqueidentifier IN Field office
@DISPLAYONLINE bit IN Show this location to online users

Definition

Copy


CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDIT_SPONSORSHIPLOCATION_2 (
    @ID uniqueidentifier,
    @CHANGEAGENTID uniqueidentifier = null,
    @NAME nvarchar(100),
    @TYPE uniqueidentifier,
    @DESIGNATION uniqueidentifier,
  @COMMENT nvarchar(255),
  @LOOKUPID nvarchar(100),
    @FIELDOFFICEID uniqueidentifier,
  @DISPLAYONLINE bit
)
as

    set nocount on;

    if @CHANGEAGENTID is null  
        exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output

    declare @CURRENTDATE datetime
    set @CURRENTDATE = getdate()

    begin try
        -- handle updating the data

        update dbo.SPONSORSHIPLOCATION set
            NAME = @NAME,
            SPONSORSHIPLOCATIONTYPECODEID = @TYPE,
            DESIGNATIONID = @DESIGNATION,
            CHANGEDBYID = @CHANGEAGENTID,
            DATECHANGED = @CURRENTDATE,
      COMMENT = @COMMENT,
      CUSTOMIDENTIFIER = @LOOKUPID,
            FIELDOFFICEID = @FIELDOFFICEID,
      DISPLAYONLINE = @DISPLAYONLINE
        where ID = @ID
    end try
    begin catch
        exec dbo.USP_RAISE_ERROR
        return 1
    end catch

return 0;