USP_DATAFORMTEMPLATE_ADD_ORDERPATRON

The save procedure used by the add dataform template "Order Patron Add Data Form".

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier INOUT The output parameter indicating the ID of the record added.
@ORDERID uniqueidentifier IN OrderID
@CONSTITUENTID uniqueidentifier IN Constituent ID
@CURRENTAPPUSERID uniqueidentifier IN Input parameter indicating the ID of the current user.
@CHANGEAGENTID uniqueidentifier IN Input parameter indicating the ID of the change agent invoking the procedure.

Definition

Copy


                    CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_ORDERPATRON
                    (
                        @ID uniqueidentifier = null output,
                        @ORDERID uniqueidentifier = null,
                        @CONSTITUENTID uniqueidentifier = null,
                        @CURRENTAPPUSERID uniqueidentifier,
                        @CHANGEAGENTID uniqueidentifier = null
                    )
                    as
                        set nocount on;

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

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

                        begin try
                            exec dbo.USP_SALESORDER_ADDPATRON
                                @ORDERID,
                                @CONSTITUENTID,
                                @CURRENTAPPUSERID,
                                @CHANGEAGENTID,
                                @CURRENTDATE;
                        end try

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

                        return 0;