USP_DATAFORMTEMPLATE_EDITLOAD_DAILYSALEITEMMEMBERSHIP
The load procedure used by the edit dataform template "Daily Sale Item Membership 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. |
@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. |
@MEMBERSHIPPROGRAMID | uniqueidentifier | INOUT | Program |
@MEMBERSHIPLEVELID | uniqueidentifier | INOUT | Level |
@MEMBERSHIPLEVELTERMID | uniqueidentifier | INOUT | Term |
@MEMBERSHIPLEVELTYPECODEID | uniqueidentifier | INOUT | Type |
@ISACTIVE | bit | INOUT | Mark button active |
@DESCRIPTIONFIELD1 | nvarchar(20) | INOUT | Row 1 |
@DESCRIPTIONFIELD2 | nvarchar(20) | INOUT | Row 2 |
@DESCRIPTIONFIELD3 | nvarchar(20) | INOUT | Row 3 |
@DESCRIPTIONFIELD1TYPECODE | tinyint | INOUT | Row 1 |
@DESCRIPTIONFIELD2TYPECODE | tinyint | INOUT | Row 2 |
@DESCRIPTIONFIELD3TYPECODE | tinyint | INOUT | Row 3 |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDITLOAD_DAILYSALEITEMMEMBERSHIP(
@ID uniqueidentifier,
@CURRENTAPPUSERID uniqueidentifier,
@DATALOADED bit = 0 output,
@TSLONG bigint = 0 output,
@MEMBERSHIPPROGRAMID uniqueidentifier = null output,
@MEMBERSHIPLEVELID uniqueidentifier = null output,
@MEMBERSHIPLEVELTERMID uniqueidentifier = null output,
@MEMBERSHIPLEVELTYPECODEID uniqueidentifier = null output,
@ISACTIVE bit = null output,
@DESCRIPTIONFIELD1 nvarchar(20) = null output,
@DESCRIPTIONFIELD2 nvarchar(20) = null output,
@DESCRIPTIONFIELD3 nvarchar(20) = null output,
@DESCRIPTIONFIELD1TYPECODE tinyint = null output,
@DESCRIPTIONFIELD2TYPECODE tinyint = null output,
@DESCRIPTIONFIELD3TYPECODE tinyint = null output
)
as
set nocount on;
set @DATALOADED = 0
set @TSLONG = 0
select
@DATALOADED = 1,
@TSLONG = DSIM.TSLONG,
@MEMBERSHIPPROGRAMID = DSIM.MEMBERSHIPPROGRAMID,
@MEMBERSHIPLEVELID = DSIM.MEMBERSHIPLEVELID,
@MEMBERSHIPLEVELTERMID = DSIM.MEMBERSHIPLEVELTERMID,
@MEMBERSHIPLEVELTYPECODEID = DSIM.MEMBERSHIPLEVELTYPECODEID,
@ISACTIVE = DSI.ISACTIVE,
@DESCRIPTIONFIELD1 = DSI.DESCRIPTIONFIELD1,
@DESCRIPTIONFIELD2 = DSI.DESCRIPTIONFIELD2,
@DESCRIPTIONFIELD3 = DSI.DESCRIPTIONFIELD3,
@DESCRIPTIONFIELD1TYPECODE = DSI.DESCRIPTIONFIELD1TYPECODE,
@DESCRIPTIONFIELD2TYPECODE = DSI.DESCRIPTIONFIELD2TYPECODE,
@DESCRIPTIONFIELD3TYPECODE = DSI.DESCRIPTIONFIELD3TYPECODE
from dbo.DAILYSALEITEM DSI
inner join dbo.DAILYSALEITEMMEMBERSHIP DSIM on DSI.ID = DSIM.ID
where DSI.ID = @ID
declare @MEMBERSHIPPROGRAMS table(ID uniqueidentifier,LABEL nvarchar(100))
insert into @MEMBERSHIPPROGRAMS exec dbo.USP_SIMPLEDATALIST_MEMBERSHIPPROGRAM @CURRENTAPPUSERID
if not exists(select 1 from @MEMBERSHIPPROGRAMS where ID = @MEMBERSHIPPROGRAMID)
begin
set @MEMBERSHIPPROGRAMID = null
set @MEMBERSHIPLEVELID = null
set @MEMBERSHIPLEVELTERMID = null
set @MEMBERSHIPLEVELTYPECODEID = null
end
if @MEMBERSHIPPROGRAMID is not null
begin
declare @MEMBERSHIPLEVELS table(ID uniqueidentifier,LABEL nvarchar(100))
insert into @MEMBERSHIPLEVELS exec dbo.USP_SIMPLEDATALIST_MEMBERSHIPLEVEL @MEMBERSHIPPROGRAMID
if not exists(select 1 from @MEMBERSHIPLEVELS where ID = @MEMBERSHIPLEVELID)
begin
set @MEMBERSHIPLEVELID = null
set @MEMBERSHIPLEVELTERMID = null
set @MEMBERSHIPLEVELTYPECODEID = null
end
end
if @MEMBERSHIPLEVELID is not null
begin
declare @MEMBERSHIPLEVELTERMS table(ID uniqueidentifier,LABEL nvarchar(100))
insert into @MEMBERSHIPLEVELTERMS exec dbo.USP_SIMPLEDATALIST_MEMBERSHIPLEVELTERM @MEMBERSHIPLEVELID
if not exists(select 1 from @MEMBERSHIPLEVELTERMS where ID = @MEMBERSHIPLEVELTERMID)
begin
set @MEMBERSHIPLEVELTERMID = null
end
end
return 0;