USP_DATAFORMTEMPLATE_EDIT_AUCTIONITEMBATCHROW_2

The save procedure used by the edit dataform template "Auction Item 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.
@SEQUENCE int IN Sequence
@CONSTITUENTID uniqueidentifier IN Constituent
@CONSTITUENTLOOKUPID uniqueidentifier IN Lookup ID
@NEWCONSTITUENT xml IN New constituent
@NAME nvarchar(100) IN Item name
@AUCTIONITEMCATEGORYID uniqueidentifier IN Category
@AUCTIONITEMSUBCATEGORYID uniqueidentifier IN Subcategory
@DESCRIPTION nvarchar(255) IN Description
@EVENTAUCTIONID uniqueidentifier IN Auction
@DESIGNATIONID uniqueidentifier IN Designation
@VALUE money IN Value
@MINIMUMBID money IN Minimum bid
@DONATIONDATE date IN Donation date
@EXPIRATIONDATE date IN Expiration date
@GIVENANONYMOUSLY bit IN Given anonymously
@PDACCOUNTSYSTEMID uniqueidentifier IN Account system
@POSTDATE datetime IN Post date
@POSTSTATUSCODE tinyint IN Post status
@CHANGEAGENTID uniqueidentifier IN Input parameter indicating the ID of the change agent invoking the procedure.
@TRANSACTIONCURRENCYID uniqueidentifier IN Transaction currency
@BASECURRENCYID uniqueidentifier IN Base currency
@BASEEXCHANGERATEID uniqueidentifier IN Base exchange rate
@EXCHANGERATE decimal(20, 8) IN Exchange rate
@CURRENTAPPUSERID uniqueidentifier IN Input parameter indicating the ID of the current user.

Definition

Copy


                    CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDIT_AUCTIONITEMBATCHROW_2
                    (
                        @ID uniqueidentifier,
                        @SEQUENCE int,

                        @CONSTITUENTID uniqueidentifier,
                        @CONSTITUENTLOOKUPID uniqueidentifier,
                        @NEWCONSTITUENT xml,

                        @NAME nvarchar(100),
                        @AUCTIONITEMCATEGORYID uniqueidentifier,
                        @AUCTIONITEMSUBCATEGORYID uniqueidentifier,
                        @DESCRIPTION nvarchar(255),
                        @EVENTAUCTIONID uniqueidentifier,
                        @DESIGNATIONID uniqueidentifier,
                        @VALUE money,
                        @MINIMUMBID money,
                        @DONATIONDATE date,
                        @EXPIRATIONDATE date,
                        @GIVENANONYMOUSLY bit
                        @PDACCOUNTSYSTEMID uniqueidentifier,
                        @POSTDATE datetime,
                        @POSTSTATUSCODE tinyint,

                        @CHANGEAGENTID uniqueidentifier,

                        @TRANSACTIONCURRENCYID uniqueidentifier,
                        @BASECURRENCYID uniqueidentifier,
                        @BASEEXCHANGERATEID uniqueidentifier,
                        @EXCHANGERATE decimal(20,8),
                        @CURRENTAPPUSERID uniqueidentifier
                    )
                    as
                    set nocount on;

                    begin try
                        if @CHANGEAGENTID is null
                            exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
                        declare @CHANGEDATE datetime = getdate();

                        if @CONSTITUENTID is null
                            set @CONSTITUENTID = @CONSTITUENTLOOKUPID;

                        if @DESCRIPTION is null
                            set @DESCRIPTION = N'';

                        if @VALUE is null
                            set @VALUE = 0;

                        if @MINIMUMBID is null
                            set @MINIMUMBID = 0;

                        if @POSTSTATUSCODE is null
                            set @POSTSTATUSCODE = 1;

                        if @PDACCOUNTSYSTEMID is null
                            set @PDACCOUNTSYSTEMID = dbo.UFN_PDACCOUNTSYSTEM_GETDEFAULTSYSTEMIDSFORUSER(@CURRENTAPPUSERID)

                        -- Get base currency from account system's currency set, if available; from user's default set otherwise.

                        if @BASECURRENCYID is null
                        begin
                            declare @CURRENCYSETID uniqueidentifier
                            select @CURRENCYSETID = CURRENCYSETID
                            from dbo.PDACCOUNTSYSTEM
                            where ID = @PDACCOUNTSYSTEMID

                            select 
                                @BASECURRENCYID = CURRENCYSET.BASECURRENCYID
                            from 
                                dbo.CURRENCYSET
                            where 
                                CURRENCYSET.ID = coalesce(@CURRENCYSETID,dbo.UFN_CURRENCYSET_GETAPPUSERDEFAULTCURRENCYSET())
                        end

                        if @EXCHANGERATE is null
                            set @EXCHANGERATE = 0;

                        update dbo.BATCHAUCTIONITEM
                            set SEQUENCE = @SEQUENCE,
                                CONSTITUENTID = @CONSTITUENTID,
                                NAME = @NAME,
                                AUCTIONITEMCATEGORYID = @AUCTIONITEMCATEGORYID,
                                AUCTIONITEMSUBCATEGORYID = @AUCTIONITEMSUBCATEGORYID,
                                DESCRIPTION = @DESCRIPTION,
                                EVENTAUCTIONID = @EVENTAUCTIONID,
                                DESIGNATIONID = @DESIGNATIONID,
                                VALUE = @VALUE,
                                MINIMUMBID = @MINIMUMBID,
                                DONATIONDATE = @DONATIONDATE,
                                EXPIRATIONDATE = @EXPIRATIONDATE,
                                GIVENANONYMOUSLY = @GIVENANONYMOUSLY,
                                PDACCOUNTSYSTEMID = @PDACCOUNTSYSTEMID,
                                POSTDATE = @POSTDATE,
                                POSTSTATUSCODE = @POSTSTATUSCODE,
                                TRANSACTIONCURRENCYID = @TRANSACTIONCURRENCYID
                                BASECURRENCYID = @BASECURRENCYID,
                                BASEEXCHANGERATEID = @BASEEXCHANGERATEID,
                                EXCHANGERATE = @EXCHANGERATE,
                                CHANGEDBYID = @CHANGEAGENTID,
                                DATECHANGED = @CHANGEDATE
                        where ID = @ID;

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