UFN_SECURITY_APPUSER_SITEINREVENUE

Returns true if a site is in a revenue.

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@REVENUEID uniqueidentifier IN
@SITEID uniqueidentifier IN

Definition

Copy


            CREATE function [dbo].[UFN_SECURITY_APPUSER_SITEINREVENUE]
            (
            @REVENUEID uniqueidentifier,
            @SITEID uniqueidentifier
            )
            returns bit as

            /*
            Returns true if the given site is in a revenue
            */


            begin

            --this may need to be refactored if performance becomes a problem

            if exists
                (
                    select top 1 ID
                    from dbo.REVENUESPLIT
                    where REVENUEID = @REVENUEID 
                        and
                        (
                            (@SITEID is null and (select count(*) from dbo.UFN_SITEID_MAPFROM_REVENUESPLITID(ID) where SITEID is null) <> 0)
                            or 
                            @SITEID in (select SITEID from dbo.UFN_SITEID_MAPFROM_REVENUESPLITID(ID))
                        )
                )
             return 1;

            return 0;

            end