USP_DATAFORMTEMPLATE_VIEW_FACILITYPRICEFORLOCATION

The load procedure used by the view dataform template "Facility Price For Location View 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.
@PRICE money INOUT Price
@FACILITYPRICEEXISTS bit INOUT Exists

Definition

Copy

            CREATE procedure dbo.USP_DATAFORMTEMPLATE_VIEW_FACILITYPRICEFORLOCATION
            (
                @ID uniqueidentifier,
                @DATALOADED bit = 0 output,
                @PRICE money = null output,
                @FACILITYPRICEEXISTS bit = null output
            )
            as
                set nocount on;

                set @DATALOADED = 0;

                select
                    @DATALOADED = 1
                from dbo.EVENTLOCATION
                where
                    ID = @ID

                if @DATALOADED = 1
                begin
                    set @PRICE = 0.0
                    set @FACILITYPRICEEXISTS = 0

                    select 
                        @FACILITYPRICEEXISTS = 1,
                        @PRICE = coalesce(PRICE,0.0)
                    from dbo.FACILITY
                    where ID = @ID
                end

                return 0;