USP_DATAFORMTEMPLATE_EDITLOAD_BLOCK_CLASS_MEETING_TEMPLATE

The load procedure used by the edit dataform template "Class Meeting Template Block Edit Data Form"

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN The input ID parameter used to load the fields defined on the form.
@DATALOADED bit INOUT Output parameter indicating whether or not data was actually loaded.
@TSLONG bigint INOUT Output parameter indicating the TSLONG value of the record being edited. This is used to manage multi-user concurrency issues when multiple users access the same record.
@SESSIONID uniqueidentifier INOUT
@COURSEID uniqueidentifier INOUT
@PATTERNBLOCK nvarchar(100) INOUT Currently assigned
@PATTERNBLOCKID uniqueidentifier INOUT Change to

Definition

Copy


CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDITLOAD_BLOCK_CLASS_MEETING_TEMPLATE(
    @ID uniqueidentifier,
    @DATALOADED bit = 0 output,
    @TSLONG bigint = 0 output,
    @SESSIONID uniqueidentifier = null output,
    @COURSEID uniqueidentifier = null output,
    @PATTERNBLOCK nvarchar(100) = null output,
    @PATTERNBLOCKID uniqueidentifier = null output
)
as
    set nocount on;

    -- be sure to set these, in case the select returns no rows

    set @DATALOADED = 0
    set @TSLONG = 0

    select
        @DATALOADED = 1,
        @TSLONG = CLASS.TSLONG,
        @COURSEID = COURSE.ID,
        @SESSIONID = dbo.UFN_SESSION_GET_FORSCHOOL_BYDATE(COURSE.SCHOOLID, CLASS.STARTDATE, CLASS.ENDDATE)
    from dbo.CLASS
        inner join dbo.COURSE on CLASS.COURSEID = COURSE.ID
    where CLASS.ID = @ID

    select top(1)
        @PATTERNBLOCK = PATTERNBLOCK.NAME    
    from dbo.CLASSMEETINGGROUP
        inner join dbo.PATTERNBLOCK on CLASSMEETINGGROUP.PATTERNBLOCKID = PATTERNBLOCK.ID
    where CLASSMEETINGGROUP.CLASSID = @ID
        and CLASSMEETINGGROUP.PATTERNBLOCKID is not null

    return 0;