USP_DATAFORMTEMPLATE_EDITLOAD_EVENTRESOURCE

The load procedure used by the edit dataform template "Event Resource Edit 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.
@RESOURCEID uniqueidentifier INOUT Resource
@QUANTITYNEEDED int INOUT Quantity needed
@ISPERTICKETITEM bit INOUT Is per ticket item
@PERTICKETQUANTITY int INOUT Per ticket quantity needed
@FORMATTEDPERTICKETQUANTITY nvarchar(25) INOUT Per ticket quantity needed
@IGNORECONFLICTS bit INOUT Ignore conflicts when saving
@EVENTID uniqueidentifier INOUT
@STARTDATETIME datetime INOUT
@ENDDATETIME datetime INOUT
@EVENTNAME nvarchar(100) INOUT

Definition

Copy

                CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDITLOAD_EVENTRESOURCE
                (
                    @ID uniqueidentifier,
                    @DATALOADED bit = 0 output,
                    @TSLONG bigint = 0 output,
                    @RESOURCEID uniqueidentifier = null output,
                    @QUANTITYNEEDED int = null output,
                    @ISPERTICKETITEM bit = null output,
                    @PERTICKETQUANTITY int = null output,
                    @FORMATTEDPERTICKETQUANTITY nvarchar(25) = null output,
                    @IGNORECONFLICTS bit = null output,
                    @EVENTID uniqueidentifier = null output,
                    @STARTDATETIME datetime = null output,
                    @ENDDATETIME datetime = null output,
                    @EVENTNAME nvarchar(100) = null output
                )
                as

                    set nocount on;

                    -- be sure to set these, in case the select returns no rows
                    set @DATALOADED = 0
                    set @TSLONG = 0

                    -- populate the output parameters, which correspond to fields on the form.  Note that
                    -- we set @DATALOADED = 1 to indicate that the load was successful.  Otherwise, the system
                    -- will display a "no data loaded" message.  Also note that we fetch the TSLONG so that concurrency
                    -- can be considered.
                    select
                        @DATALOADED = 1,
                        @TSLONG = EVENTRESOURCE.TSLONG,
                        @RESOURCEID = EVENTRESOURCE.RESOURCEID, 
                        @QUANTITYNEEDED = EVENTRESOURCE.QUANTITYNEEDED,
                        @ISPERTICKETITEM = RESOURCE.ISPERTICKETITEM,
                        @PERTICKETQUANTITY = EVENTRESOURCE.PERTICKETQUANTITY,
                        @FORMATTEDPERTICKETQUANTITY = RESOURCE.FORMATTEDPERTICKETQUANTITY,
                        @EVENTID = EVENTRESOURCE.EVENTID
                    from dbo.EVENTRESOURCE
                        inner join RESOURCE on EVENTRESOURCE.RESOURCEID = RESOURCE.ID
                    where EVENTRESOURCE.ID = @ID

                    select
                        @STARTDATETIME = STARTDATETIME,
                        @ENDDATETIME = ENDDATETIME,
                        @EVENTNAME = NAME
                    from dbo.EVENT
                    where ID = @EVENTID

                    set @IGNORECONFLICTS = 0;

                    return 0;