USP_DATAFORMTEMPLATE_ADDLOAD_PROGRAMCOPY

The load procedure used by the edit dataform template "Program Copy"

Parameters

Parameter Parameter Type Mode Description
@OLDPROGRAMID uniqueidentifier IN Input parameter indicating the context ID for the record being added.
@CURRENTAPPUSERID uniqueidentifier IN Input parameter indicating the ID of the current user.
@SINGLELOCATION uniqueidentifier INOUT Location
@LOCATIONS xml INOUT Location
@HOLDLISTID uniqueidentifier INOUT Holds
@CAPACITY int INOUT Capacity
@ISDAILYADMISSION bit INOUT Is daily admission
@PROGRAMCATEGORYCODEID uniqueidentifier INOUT Category

Definition

Copy


CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADDLOAD_PROGRAMCOPY
(
    @OLDPROGRAMID uniqueidentifier,
    @CURRENTAPPUSERID uniqueidentifier,
    @SINGLELOCATION uniqueidentifier = null output,
    @LOCATIONS xml=null output,
    @HOLDLISTID uniqueidentifier = null output,
    @CAPACITY int = null output,
    @ISDAILYADMISSION bit = null output,
    @PROGRAMCATEGORYCODEID uniqueidentifier = null output
)
as
    set nocount on;

    declare @DATALOADED bit;
    set @DATALOADED = 0;

    select
        @HOLDLISTID = HOLDLISTID,
        @CAPACITY = CAPACITY,
        @ISDAILYADMISSION = ISDAILYADMISSION,
        @PROGRAMCATEGORYCODEID = PROGRAMCATEGORYCODEID,
        @DATALOADED = 1
    from
        dbo.PROGRAM
    where
        ID = @OLDPROGRAMID

    if @DATALOADED <> 1
    begin
        raiserror('Record not found.',13,1)
        return 1;
    end

    select top(1) @SINGLELOCATION = EVENTLOCATIONID from dbo.PROGRAMLOCATION
    where PROGRAMID = @OLDPROGRAMID
    order by SEQUENCE;

    set @LOCATIONS = dbo.UFN_PROGRAM_GETSEQUENCEDLOCATIONS_TOITEMLISTXML(@OLDPROGRAMID);

    return 0;