USP_DATAFORMTEMPLATE_EDITLOAD_ITINERARYITEMCUSTOMRESOLVE

The load procedure used by the edit dataform template "Itinerary Item Conflict Resolve 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.
@ITINERARYID uniqueidentifier INOUT Itinerary ID
@NAME nvarchar(100) INOUT Name
@STARTDATE datetime INOUT Date
@ENDDATE datetime INOUT Date
@STARTTIME UDT_HOURMINUTE INOUT Start time
@ENDTIME UDT_HOURMINUTE INOUT End time
@LOCATIONID uniqueidentifier INOUT Location
@RESOURCES xml INOUT Supplies/Equipment resources
@STAFFRESOURCES xml INOUT Staff resources
@IGNORECONFLICTS bit INOUT Ignore conflicts when saving
@COMPUTEDITEMTYPECODE tinyint INOUT Item type
@ITINERARYCAPACITY int INOUT Itinerary capacity
@LOCATIONPRICE money INOUT Price

Definition

Copy

                    CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDITLOAD_ITINERARYITEMCUSTOMRESOLVE(
                        @ID uniqueidentifier,
                        @DATALOADED bit = 0 output,
                        @TSLONG bigint = 0 output,
                        @ITINERARYID uniqueidentifier = null output,
                        @NAME nvarchar(100) = null output,
                        @STARTDATE datetime = null output,
                        @ENDDATE datetime = null output,
                        @STARTTIME UDT_HOURMINUTE = null output,
                        @ENDTIME UDT_HOURMINUTE = null output,
                        @LOCATIONID uniqueidentifier = null output,
                        @RESOURCES xml = null output,
                        @STAFFRESOURCES xml = null output,
                        @IGNORECONFLICTS bit = null output,
                        @COMPUTEDITEMTYPECODE tinyint = null output,
                        @ITINERARYCAPACITY int = null output,
                        @LOCATIONPRICE money = null output
                    )
                    as

                        set nocount on;

                        set @DATALOADED = 0
                        set @TSLONG = 0

                        select
                            @DATALOADED = 1,
                            @TSLONG = TSLONG,
                            @NAME = NAME,
                            @STARTDATE = STARTDATE,
                            @ENDDATE = ENDDATE,
                            @STARTTIME = STARTTIME,
                            @ENDTIME = ENDTIME,
                            @LOCATIONID = EVENTLOCATIONID,
                            @RESOURCES = dbo.UFN_ITINERARYITEMRESOURCE_GETRESOURCES_TOITEMLISTXML(@ID),
                            @STAFFRESOURCES = dbo.UFN_ITINERARYITEM_GETSTAFFRESOURCES_TOITEMLISTXML(@ID),
                            @ITINERARYID = ITINERARYITEM.ITINERARYID,
                            @IGNORECONFLICTS = 0,
                            @COMPUTEDITEMTYPECODE = case when (not ITINERARYITEM.EVENTID is null) then 0
                                                         when (not ITINERARYITEM.PROGRAMID is null) then 1
                                                         else 2 end

                        from dbo.ITINERARYITEM
                        where ITINERARYITEM.ID = @ID

                        if @DATALOADED = 1
                        begin
                            select @ITINERARYCAPACITY = coalesce(sum(ITINERARYATTENDEE.QUANTITY),0)
                            from dbo.ITINERARYATTENDEE
                            where ITINERARYATTENDEE.ITINERARYID = @ITINERARYID

                            set @LOCATIONPRICE = (select
                                                                            PRICE
                                                                        from dbo.FACILITY
                                                                        where
                                                                            @COMPUTEDITEMTYPECODE = 2 and
                                                                            ID = @LOCATIONID)
                            set @LOCATIONPRICE = cast(coalesce(@LOCATIONPRICE, 0.0) as money);
                        end

                        return 0;