USP_DATAFORMTEMPLATE_EDITLOAD_PROGRAM
The load procedure used by the edit dataform template "Program Edit Form"
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | The input ID parameter used to load the fields defined on the form. |
@CURRENTAPPUSERID | uniqueidentifier | IN | Input parameter indicating the ID of the current user. |
@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. |
@NAME | nvarchar(100) | INOUT | Name |
@DESCRIPTION | nvarchar(255) | INOUT | Description |
@LOCATIONS | xml | INOUT | Location |
@CAPACITY | int | INOUT | Capacity |
@ISDAILYADMISSION | bit | INOUT | Is daily admission |
@ONSALEINFORMATION | xml | INOUT | Available for sale |
@PROGRAMCATEGORYCODEID | uniqueidentifier | INOUT | Category |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDITLOAD_PROGRAM
(
@ID uniqueidentifier,
@CURRENTAPPUSERID uniqueidentifier,
@DATALOADED bit = 0 output,
@TSLONG bigint = 0 output,
@NAME nvarchar(100) = null output,
@DESCRIPTION nvarchar(255) = null output,
@LOCATIONS xml=null output,
@CAPACITY integer=null output,
@ISDAILYADMISSION bit = null output,
@ONSALEINFORMATION xml = null output,
@PROGRAMCATEGORYCODEID uniqueidentifier = null output
)
as
set nocount on;
set @DATALOADED = 0
set @TSLONG = 0
select
@DATALOADED = 1,
@TSLONG = TSLONG,
@NAME = NAME,
@DESCRIPTION = DESCRIPTION,
@CAPACITY=CAPACITY,
@ISDAILYADMISSION = ISDAILYADMISSION,
@PROGRAMCATEGORYCODEID = PROGRAM.PROGRAMCATEGORYCODEID
from dbo.PROGRAM
where ID = @ID;
set @LOCATIONS = dbo.UFN_PROGRAM_GETSEQUENCEDLOCATIONS_TOITEMLISTXML(@ID);
if @ISDAILYADMISSION = 1
begin
set @ONSALEINFORMATION =
(
select
SALESMETHOD.ID as SALESMETHODID,
SALESMETHOD.TYPECODE as SALESMETHODTYPECODE,
SALESMETHOD.TYPE as SALESMETHODTYPE,
case when exists (select 1 from dbo.PROGRAMSALESMETHOD where SALESMETHOD.ID = PROGRAMSALESMETHOD.SALESMETHODID and
PROGRAMSALESMETHOD.PROGRAMID = @ID) then 1 else 0 end ISAVAILABLE,
case when exists (select 1 from dbo.[DAILYSALEITEMPROGRAM] where [DAILYSALEITEMPROGRAM].[PROGRAMID] = @ID)
then 1
else 0
end as [ISASSOCIATEDWITHDAILYSALESITEM]
from dbo.SALESMETHOD
where SALESMETHOD.ISACTIVE = 1
for xml raw ('ITEM'), type, elements, root('ONSALEINFORMATION'), BINARY BASE64
)
end
return 0;