UFN_CONSTITUENT_ISRECOGNITION

Validates whether the constituent appears in any recognition program.

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@CONSTITUENTID uniqueidentifier IN
@CURRENTAPPUSERID uniqueidentifier IN

Definition

Copy


             CREATE function dbo.UFN_CONSTITUENT_ISRECOGNITION
             (
                @CONSTITUENTID uniqueidentifier,
                @CURRENTAPPUSERID uniqueidentifier
            ) 
            returns bit
            with execute as caller
            as begin
        if exists(
              select CONSTITUENTID
              from dbo.CONSTITUENTRECOGNITION
              where CONSTITUENTRECOGNITION.CONSTITUENTID=@CONSTITUENTID
              and (dbo.UFN_SITEALLOWEDFORUSER(@CURRENTAPPUSERID,dbo.UFN_SITEID_MAPFROM_RECOGNITIONPROGRAMID(CONSTITUENTRECOGNITION.RECOGNITIONPROGRAMID)) = 1 or @CURRENTAPPUSERID is null)
              and (CONSTITUENTRECOGNITION.EXPIRATIONDATE >= getdate() or
                   dbo.UFN_RECOGNITIONPROGRAM_GETTYPECODE(CONSTITUENTRECOGNITION.RECOGNITIONPROGRAMID)=1)
             ) return 1;

         return 0;
      end