USP_DATAFORMTEMPLATE_EDITLOAD_BATCHALERTAPPUSERSETTINGS

The load procedure used by the edit dataform template "Batch Alert Application User Settings Edit Form"

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN The input ID parameter used to load the fields defined on the form.
@ALERTWHENBATCHASSIGNED bit INOUT Send me an alert when a batch has been assigned to me
@EMAILADDRESS UDT_EMAILADDRESS INOUT Send email alerts to
@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.
@DATALOADED bit INOUT Output parameter indicating whether or not data was actually loaded.

Definition

Copy


                    CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDITLOAD_BATCHALERTAPPUSERSETTINGS (
                        @ID uniqueidentifier,
                        @ALERTWHENBATCHASSIGNED bit = null output,
                        @EMAILADDRESS dbo.UDT_EMAILADDRESS = null output,
                        @TSLONG bigint = 0 output,
                        @DATALOADED bit = 0 output
                    ) as begin

                        declare @BATCHALERTTYPEID uniqueidentifier;
                        set @BATCHALERTTYPEID = '9AFE402D-1A7B-43AD-A8EA-15E3E0177273';

                        if exists (select top(1) ID from dbo.APPUSERALERTTYPESETTING where APPUSERID = @ID and ALERTTYPEID = @BATCHALERTTYPEID)            
                            select
                                @ALERTWHENBATCHASSIGNED = ENABLED,
                                @TSLONG = TSLONG,
                                @DATALOADED = 1
                            from
                                dbo.APPUSERALERTTYPESETTING
                            where
                                APPUSERID = @ID
                            and
                                ALERTTYPEID = @BATCHALERTTYPEID;
                        else
                            select
                                @ALERTWHENBATCHASSIGNED = 0,
                                @TSLONG = 0,
                                @DATALOADED = 1;

                        select @EMAILADDRESS = EMAILADDRESS from dbo.APPUSERALERTSETTING where ID = @ID;

                        return 0;
                    end