USP_DATAFORMTEMPLATE_EDIT_REVENUEBATCHPRIMARYBUSINESSADDRESSVALIDATION

The save procedure used by the edit dataform template "Revenue Batch Primary Business Address Validation Edit Data 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.
@COUNTRYID uniqueidentifier IN Country
@ADDRESSBLOCK nvarchar(150) IN Address
@CITY nvarchar(50) IN City
@STATEID uniqueidentifier IN State
@POSTCODE nvarchar(12) IN ZIP
@CART nvarchar(10) IN CART
@DPC nvarchar(8) IN DPC
@LOT nvarchar(5) IN LOT
@CERTIFICATIONDATA int IN Certification data
@CONGRESSIONALDISTRICTCODEID uniqueidentifier IN Congressional district
@COUNTYCODEID uniqueidentifier IN County

Definition

Copy


                    CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDIT_REVENUEBATCHPRIMARYBUSINESSADDRESSVALIDATION
                    (
                        @ID uniqueidentifier,
                        @CHANGEAGENTID uniqueidentifier = null,
                        @COUNTRYID uniqueidentifier,
                        @ADDRESSBLOCK nvarchar(150),
                        @CITY nvarchar(50),
                        @STATEID uniqueidentifier,
                        @POSTCODE nvarchar(12),
                        @CART nvarchar(10),
                        @DPC nvarchar(8),
                        @LOT nvarchar(5),
                        @CERTIFICATIONDATA int,
                        @CONGRESSIONALDISTRICTCODEID uniqueidentifier,
                        @COUNTYCODEID uniqueidentifier
                    )
                    as
                        set nocount on;

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

                        declare @CURRENTDATE datetime
                        set @CURRENTDATE = getdate()

                        declare @BATCHREVENUECONSTITUENTID uniqueidentifier
                        select @BATCHREVENUECONSTITUENTID = BATCHREVENUECONSTITUENTRELATION.RELATIONID
                        from dbo.BATCHREVENUE
                        inner join dbo.BATCHREVENUECONSTITUENTRELATION on BATCHREVENUE.CONSTITUENTID = BATCHREVENUECONSTITUENTRELATION.CONSTITUENTID
                        where BATCHREVENUE.ID = @ID

                        begin try
                            update dbo.BATCHREVENUECONSTITUENT set
                                [COUNTRYID] = @COUNTRYID,
                                [ADDRESSBLOCK] = @ADDRESSBLOCK,
                                [CITY] = @CITY,
                                [STATEID] = @STATEID,
                                [POSTCODE] = @POSTCODE,
                                [CART] = @CART,
                                [DPC] = @DPC,
                                [LOT] = @LOT,
                                [CONGRESSIONALDISTRICTCODEID] = @CONGRESSIONALDISTRICTCODEID
                                [CERTIFICATIONDATA] = @CERTIFICATIONDATA,
                                COUNTYCODEID = @COUNTYCODEID,
                                CHANGEDBYID = @CHANGEAGENTID,
                                DATECHANGED = @CURRENTDATE
                            where ID = @BATCHREVENUECONSTITUENTID
                        end try
                        begin catch
                            exec dbo.USP_RAISE_ERROR
                            return 1
                        end catch

                    return 0;