USP_DATAFORMTEMPLATE_EDIT_CONSTITUENTADDRESSUPDATEBATCHROW

The save procedure used by the edit dataform template "Constituent Address Update Batch Row Edit Form".

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN The input ID parameter indicating the ID of the record being edited.
@CHANGEAGENTID uniqueidentifier IN Input parameter indicating the ID of the change agent invoking the procedure.
@ADDRESSID uniqueidentifier IN Constituent address
@ADDRESSTYPECODEID uniqueidentifier IN Address type
@COUNTRYID uniqueidentifier IN Country
@ADDRESSBLOCK nvarchar(150) IN Address
@CITY nvarchar(50) IN City
@STATEID uniqueidentifier IN State
@POSTCODE nvarchar(12) IN ZIP
@ISPRIMARY bit IN Set as primary address
@DONOTMAIL bit IN Do not send mail to this address
@UPDATEMATCHINGSPOUSEADDRESSES bit IN Update spouse address
@SEQUENCE int IN Sequence

Definition

Copy

                CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDIT_CONSTITUENTADDRESSUPDATEBATCHROW
                (
                    @ID uniqueidentifier,
                    @CHANGEAGENTID uniqueidentifier,
                    @ADDRESSID uniqueidentifier,
                    @ADDRESSTYPECODEID uniqueidentifier,
                    @COUNTRYID uniqueidentifier,
                    @ADDRESSBLOCK nvarchar(150),
                    @CITY nvarchar(50),
                    @STATEID uniqueidentifier,
                    @POSTCODE nvarchar(12),
                    @ISPRIMARY bit,
                    @DONOTMAIL bit,
                    @UPDATEMATCHINGSPOUSEADDRESSES bit,
                    @SEQUENCE int
                ) as
                    set nocount on;

                    declare @CURRENTDATE datetime;

                    if @CHANGEAGENTID is null
                        exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;

                    set @CURRENTDATE = getdate();

                    begin try                                
                        update
                            dbo.BATCHCONSTITUENTADDRESSUPDATE
                        set
                            [ADDRESSID] = @ADDRESSID,
                            [ADDRESSTYPECODEID] = @ADDRESSTYPECODEID,
                            [COUNTRYID] = @COUNTRYID,
                            [ADDRESSBLOCK] = @ADDRESSBLOCK,
                            [CITY] = @CITY,
                            [STATEID] = @STATEID,
                            [POSTCODE] = @POSTCODE,
                            [ISPRIMARY] = @ISPRIMARY,
                            [DONOTMAIL] = @DONOTMAIL,
                            [UPDATEMATCHINGSPOUSEADDRESSES] = @UPDATEMATCHINGSPOUSEADDRESSES,
                            [SEQUENCE] = @SEQUENCE,
                            [CHANGEDBYID] = @CHANGEAGENTID,
                            [DATECHANGED] = @CURRENTDATE
                        where ID = @ID;
                    end try
                    begin catch
                        exec dbo.USP_RAISE_ERROR;
                        return 1;
                    end catch

                    return 0;