UFN_AUCTIONITEM_AUCTIONVALIDFORDESIGNATION
Ensures that an auction item has a valid auction event and designation combination based on site.
Return
Return Type |
---|
bit |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@TYPECODE | tinyint | IN | |
@EVENTAUCTIONID | uniqueidentifier | IN | |
@REVENUEAUCTIONDONATIONID | uniqueidentifier | IN |
Definition
Copy
CREATE function dbo.UFN_AUCTIONITEM_AUCTIONVALIDFORDESIGNATION
(
@TYPECODE tinyint,
@EVENTAUCTIONID uniqueidentifier,
@REVENUEAUCTIONDONATIONID uniqueidentifier
)
returns bit
as begin
declare @VALID bit = 0;
if @TYPECODE = 0 and @EVENTAUCTIONID is not null
begin
declare @DESIGNATIONID uniqueidentifier = null;
select @DESIGNATIONID = REVENUESPLIT.DESIGNATIONID from dbo.REVENUESPLIT
where REVENUESPLIT.REVENUEID = @REVENUEAUCTIONDONATIONID;
declare @DESIGNATIONSITEID uniqueidentifier = null;
select @DESIGNATIONSITEID = dbo.UFN_SITEID_MAPFROM_DESIGNATIONID(@DESIGNATIONID)
if @DESIGNATIONSITEID is null and not exists(select 1 from EVENTSITE where EVENTID = @EVENTAUCTIONID)
set @VALID = 1;
if @VALID <> 1 and exists(select 1 from EVENTSITE where EVENTID = @EVENTAUCTIONID and SITEID = @DESIGNATIONSITEID)
set @VALID = 1;
end
else
set @VALID = 1;
return @VALID
end