USP_DATAFORM_EDITLOAD_MAILPREFERENCE_2

The load procedure used by the edit dataform template "Mail Preference Edit Form 2"

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.
@CONSTITUENTID uniqueidentifier INOUT Constituent
@ISORG bit INOUT
@MAILTYPECODE tinyint INOUT Mail type
@ACKNOWLEDGEMENTID uniqueidentifier INOUT Selected communication
@CORRESPONDENCEID uniqueidentifier INOUT Selected communication
@PLEDGEREMINDERID uniqueidentifier INOUT Selected communication
@BUSINESSUNITCODEID uniqueidentifier INOUT Business unit
@CATEGORYCODEID uniqueidentifier INOUT Category
@EVENTCATEGORYCODEID uniqueidentifier INOUT Category
@SITEID uniqueidentifier INOUT Site
@CORRESPONDENCECODEID uniqueidentifier INOUT Correspondence code
@RECEIPTTYPECODE int INOUT Receipt type
@SENDMAIL bit INOUT Send mail
@DELIVERYMETHODCODE tinyint INOUT Send by
@CONTACTTYPES xml INOUT
@ADDRESSID uniqueidentifier INOUT Selected address
@EMAILADDRESSID uniqueidentifier INOUT Selected address
@USESEASONALADDRESS bit INOUT Send to seasonal address when valid
@USEPRIMARYADDRESS bit INOUT Send to primary address
@COMMENTS nvarchar(500) INOUT Comments
@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.
@ISGROUP bit INOUT Is group
@GROUPCONTACTS xml INOUT
@USEPRIMARYEMAIL bit INOUT Send to primary email

Definition

Copy


                    CREATE procedure dbo.USP_DATAFORM_EDITLOAD_MAILPREFERENCE_2(
                        @ID uniqueidentifier,
                        @DATALOADED bit = 0 output,
                        @CONSTITUENTID uniqueidentifier = null output,
                        @ISORG bit = null output,
                        @MAILTYPECODE tinyint = null output,
                        @ACKNOWLEDGEMENTID uniqueidentifier = null output,
                        @CORRESPONDENCEID uniqueidentifier = null output,
                        @PLEDGEREMINDERID uniqueidentifier = null output,
                        @BUSINESSUNITCODEID uniqueidentifier = null output,
                        @CATEGORYCODEID uniqueidentifier = null output,
                        @EVENTCATEGORYCODEID uniqueidentifier = null output,
                        @SITEID uniqueidentifier = null output,
                        @CORRESPONDENCECODEID uniqueidentifier = null output,
                        @RECEIPTTYPECODE int = null output,
                        @SENDMAIL bit = null output,
                        @DELIVERYMETHODCODE tinyint = null output,
                        @CONTACTTYPES xml = null output,
                        @ADDRESSID uniqueidentifier = null output,
                        @EMAILADDRESSID uniqueidentifier = null output,
                        @USESEASONALADDRESS bit = null output,
                        @USEPRIMARYADDRESS bit = null output,
                        @COMMENTS nvarchar(500) = null output,                    
                        @TSLONG bigint = 0 output,
                        @ISGROUP bit = null output,
                        @GROUPCONTACTS xml = null output,
                        @USEPRIMARYEMAIL bit = null output
                    )
                    as
                        set nocount on;    

                        begin try

                            select
                                @DATALOADED = 1,
                                @CONSTITUENTID = CONSTITUENTID,
                                @MAILTYPECODE = MAILTYPECODE,
                                @ACKNOWLEDGEMENTID = ACKNOWLEDGEMENTID,
                                @CORRESPONDENCEID = CORRESPONDENCEID,
                                @PLEDGEREMINDERID = PLEDGEREMINDERID,
                                @BUSINESSUNITCODEID = BUSINESSUNITCODEID,
                                @CATEGORYCODEID = CATEGORYCODEID,
                                @EVENTCATEGORYCODEID = EVENTCATEGORYCODEID,
                                @SITEID = SITEID,
                                @CORRESPONDENCECODEID = CORRESPONDENCECODEID,
                                @RECEIPTTYPECODE = RECEIPTTYPECODE,
                                @SENDMAIL = SENDMAIL,
                                @DELIVERYMETHODCODE = DELIVERYMETHODCODE,
                                @CONTACTTYPES = dbo.UFN_MAILPREFERENCE_GETCONTACTTYPES_TOITEMLISTXML(@ID),
                                @ADDRESSID = ADDRESSID,
                                @EMAILADDRESSID = EMAILADDRESSID,
                                @USESEASONALADDRESS = USESEASONALADDRESS,
                                @USEPRIMARYADDRESS = USEPRIMARYADDRESS,
                                @COMMENTS = COMMENTS,
                                @GROUPCONTACTS = dbo.UFN_MAILPREFERENCE_GETGROUPCONTACTS_TOITEMLISTXML(@ID),
                                @USEPRIMARYEMAIL = USEPRIMARYEMAIL
                            from dbo.MAILPREFERENCE
                            where ID=@ID    

                            select 
                                @ISORG=ISORGANIZATION,
                                @ISGROUP=ISGROUP
                            from dbo.CONSTITUENT
                            where ID=@CONSTITUENTID;

                        end try
                        begin catch
                            exec dbo.USP_RAISE_ERROR;
                            return 1;
                        end catch

                        return 0;