USP_DATAFORMTEMPLATE_EDIT_CONSTITUENTACCOUNT_2

The save procedure used by the edit dataform template "Constituent Financial Account Edit Form 2".

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.
@FINANCIALINSTITUTIONID uniqueidentifier IN Financial institution
@ACCOUNTNUMBER nvarchar(17) IN Account number
@ACCOUNTTYPE tinyint IN Account type
@EFTSTATUSCODE tinyint IN EFT status

Definition

Copy


                    CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDIT_CONSTITUENTACCOUNT_2
                    (
                    @ID uniqueidentifier,
                    @CHANGEAGENTID uniqueidentifier = null,
                    @FINANCIALINSTITUTIONID uniqueidentifier,
                    @ACCOUNTNUMBER nvarchar(17),
                    @ACCOUNTTYPE tinyint,
                    @EFTSTATUSCODE tinyint
                    )
                    as
                        set nocount on;

                        begin try

                            -- Open the symmetric key for encryption

                            exec dbo.USP_GET_KEY_ACCESS;

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

                            declare @CURRENTDATE datetime;
                            set @CURRENTDATE = getdate();

                            update
                                dbo.CONSTITUENTACCOUNT
                            set 
                                FINANCIALINSTITUTIONID = @FINANCIALINSTITUTIONID,
                                ACCOUNTNUMBER = EncryptByKey(Key_GUID('sym_BBInfinity'), @ACCOUNTNUMBER),
                                ACCOUNTNUMBERINDEX = dbo.UFN_GET_MAC_FOR_TEXT(@ACCOUNTNUMBER, 'dbo.CONSTITUENTACCOUNT'),
                                ACCOUNTTYPECODE = @ACCOUNTTYPE,
                                EFTSTATUSCODE = @EFTSTATUSCODE,
                                DATECHANGED = @CURRENTDATE,
                                CHANGEDBYID = @CHANGEAGENTID
                            where
                                ID = @ID;

                            close symmetric key sym_BBInfinity;

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

                        return 0;