USP_GetClientUser_FAFNotificationSubscriptions

Parameters

Parameter Parameter Type Mode Description
@ClientUserID int IN
@EventID uniqueidentifier IN

Definition

Copy


create procedure dbo.USP_GetClientUser_FAFNotificationSubscriptions
(  
    @ClientUserID   int,
    @EventID        uniqueidentifier = null 
)  

AS   

begin
    -- do work

   if Exists(Select 1 from dbo.EVENTEXTENSION where EVENTID = @EventID)
         begin
             SELECT  
                 NS.ID,  NS.UserID,  NS.NotificationID,  NS.ContextID,  NS.[Status],  
                 NS.BackOfficeSystemPeopleID,  NS.BackOfficeSystemsID  
             FROM NotificationSubscription NS
                       inner join dbo.NC_Notification NC on  NC.ID=NS.NotificationID 
                       inner join dbo.EVENTEMAILTEMPLATE ET on NC.ID = ET.NCNOTIFICATIONID
                       inner join dbo.[EVENT] E on ET.EVENTID = E.ID
             where E.ID = @EventID and NS.UserID = @ClientUserID 
         end
   else
         begin
           SELECT  
               ID,  UserID,  NotificationID,  ContextID,  [Status],  
               BackOfficeSystemPeopleID,  BackOfficeSystemsID  
           FROM NotificationSubscription  
           WHERE UserID = @ClientUserID   
         end

   return

end