UFN_AUCTION_DESIGNATIONISVALID

Validates the site of the given designation to the site list of the given auction.

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@AUCTIONID uniqueidentifier IN
@DESIGNATIONID uniqueidentifier IN

Definition

Copy


create function dbo.UFN_AUCTION_DESIGNATIONISVALID
(
    @AUCTIONID uniqueidentifier,
    @DESIGNATIONID uniqueidentifier
)
returns bit
with execute as caller
as begin

    declare @VALID bit = 1;

    declare @DESIGNATIONSITEID uniqueidentifier;
    select @DESIGNATIONSITEID = dbo.UFN_SITEID_MAPFROM_DESIGNATIONID(@DESIGNATIONID)

    if (@DESIGNATIONSITEID is null and exists(select 1 from dbo.EVENTSITE where EVENTID = @AUCTIONID))
        or
        (@DESIGNATIONSITEID is not null and not exists(select 1 from dbo.EVENTSITE where EVENTID = @AUCTIONID and SITEID = @DESIGNATIONSITEID))
        set @VALID = 0;

    return @VALID;

end