USP_DATAFORMTEMPLATE_ADD_AUCTIONITEMBATCHROW
The save procedure used by the add dataform template "Auction Item Batch Row Add Form".
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | INOUT | The output parameter indicating the ID of the record added. |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the procedure. |
@BATCHID | uniqueidentifier | IN | Input parameter indicating the context ID for the record being added. |
@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 |
@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_ADD_AUCTIONITEMBATCHROW
(
@ID uniqueidentifier = null output,
@CHANGEAGENTID uniqueidentifier,
@BATCHID uniqueidentifier,
@SEQUENCE int,
@CONSTITUENTID uniqueidentifier = null,
@CONSTITUENTLOOKUPID uniqueidentifier = null,
@NEWCONSTITUENT xml = null,
@NAME nvarchar(100),
@AUCTIONITEMCATEGORYID uniqueidentifier = null,
@AUCTIONITEMSUBCATEGORYID uniqueidentifier = null,
@DESCRIPTION nvarchar(255) = null,
@EVENTAUCTIONID uniqueidentifier = null,
@DESIGNATIONID uniqueidentifier = null,
@VALUE money = 0,
@MINIMUMBID money = 0,
@DONATIONDATE date = null,
@EXPIRATIONDATE date = null,
@GIVENANONYMOUSLY bit = 0,
@PDACCOUNTSYSTEMID uniqueidentifier,
@POSTDATE datetime = null,
@POSTSTATUSCODE tinyint = 1,
@TRANSACTIONCURRENCYID uniqueidentifier = null,
@BASECURRENCYID uniqueidentifier = null,
@BASEEXCHANGERATEID uniqueidentifier = null,
@EXCHANGERATE decimal(20,8) = null,
@CURRENTAPPUSERID uniqueidentifier = null
)
as
set nocount on;
begin try
declare @CHANGEDATE datetime = getdate();
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
if @ID is null
set @ID = newid();
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 @TRANSACTIONCURRENCYID is null
set @TRANSACTIONCURRENCYID = @BASECURRENCYID
if @EXCHANGERATE is null
set @EXCHANGERATE = 0;
if @NEWCONSTITUENT is not null
begin
declare @NEWCONSTITUENTID uniqueidentifier;
if not exists(select ID from dbo.CONSTITUENT where ID = @CONSTITUENTID)
begin
exec dbo.USP_AUCTIONITEMBATCH_ADDNEWCONSTITUENTFROMXML @NEWCONSTITUENT, @CHANGEAGENTID, @NEWCONSTITUENTID output;
set @CONSTITUENTID = @NEWCONSTITUENTID;
end
end
set @CONSTITUENTLOOKUPID = @CONSTITUENTID;
insert into dbo.BATCHAUCTIONITEM(ID, BATCHID, SEQUENCE, CONSTITUENTID, NAME, DESCRIPTION, AUCTIONITEMCATEGORYID, AUCTIONITEMSUBCATEGORYID, EVENTAUCTIONID, DESIGNATIONID,
VALUE, MINIMUMBID, DONATIONDATE, EXPIRATIONDATE, GIVENANONYMOUSLY, PDACCOUNTSYSTEMID, POSTDATE, POSTSTATUSCODE,
TRANSACTIONCURRENCYID, BASECURRENCYID, BASEEXCHANGERATEID, EXCHANGERATE,
ADDEDBYID, CHANGEDBYID, DATEADDED, DATECHANGED)
values(@ID, @BATCHID, @SEQUENCE, @CONSTITUENTID, @NAME, @DESCRIPTION, @AUCTIONITEMCATEGORYID, @AUCTIONITEMSUBCATEGORYID, @EVENTAUCTIONID, @DESIGNATIONID,
@VALUE, @MINIMUMBID, @DONATIONDATE, @EXPIRATIONDATE, @GIVENANONYMOUSLY, @PDACCOUNTSYSTEMID, @POSTDATE, @POSTSTATUSCODE,
@TRANSACTIONCURRENCYID, @BASECURRENCYID, @BASEEXCHANGERATEID, @EXCHANGERATE,
@CHANGEAGENTID, @CHANGEAGENTID, @CHANGEDATE, @CHANGEDATE);
end try
begin catch
exec dbo.USP_RAISE_ERROR;
return 1;
end catch
return 0;