spGetEmailSignOnControls

Parameters

Parameter Parameter Type Mode Description
@ContentID int IN

Definition

Copy


CREATE procedure dbo.spGetEmailSignOnControls
       @ContentID int      
       AS
       begin

       if not exists(select 1 from dbo.SignOnControls where ContentID = @ContentID and FieldId in (2,3,4,5,6,7,8,23,255,116,21,9,52,10,120,1027, 1020,1025,1026))

         begin

          SELECT a.[FieldID],a.[ParentFieldID],Case a.[FieldID] When 23 Then 'Email Address' when 5 then 'Title' when 116 then 'Address' when 6 then 'Suffix' when 120 then 'Lookup ID' when 21 then 'Phone Number' when 1027 then 'Educational Institution' Else
 a.[FieldName] end as FieldName,a.[CodeTableID],a.[AttribTypeID],a.[DataType],a.[UseShortDescription],

          NULL, NULL,NULL, Case a.[FieldID] When 23 Then 'Email Address' when 5 then 'Title' when 116 then 'Address' when 6 then 'Suffix'  when 120 then 'ID' when 21 then 'Phone Number' when 1027 then 'Educational Institution' Else a.[FieldName] end as Text
, NULL 

          from applicationfields as a

          WHERE  a.fieldid in (2,3,4,5,6,7,8,23,255,116,21,9,52,10,120,1027, 1020,1025,1026)

          order by  case FieldName
          when  'Title 1' then 1 --Title1

          when  'First Name' then 2 --FirstName

          when  'Middle Name' then 3 -- Middle Name

          when  'Nickname' then 4
          when  'Maiden Name' then 5 -- Maiden Name

          when  'Last Name' then 6 -- Last Name


          when  'Suffix 1' then 7
          when  'Preferred Email' then 8-- Email Address

          when  'Confirm Email Address' then 9 -- Confirm Email

          when 'Email Address Type' then 10
          when  'Formatted Address' then 11 -- Address

          when 'Address Type' then 12

          when  'Home Phone' then 13 -- Home Phone


          when  'Gender' then 14 -- Gender


          when  'Class of' then 15 -- Class of


          when  'School Name' then 16 -- Educational institution


          when  'Birth Date' then 17 -- Birth Date


          when  'Constituent ID' then 18  -- ID

          end
         end
       else
         begin

       SELECT a.[FieldID],a.[ParentFieldID],Case a.[FieldID] When 23 Then 'Email Address' when 5 then 'Title' when 6 then 'Suffix' when 116 then 'Address' when 120 then 'Lookup ID' when 21 then 'Phone Number' when 1027 then 'Educational Institution' Else a.
[FieldName] end as FieldName,a.[CodeTableID],a.[AttribTypeID],a.[DataType],a.[UseShortDescription],

       b.[ID] as SignOnID, b.[Required],b.[Display], b.[Text], b.ContentID 

                             from applicationfields as a left outer join SignOnControls  as b

                             on a.fieldID = b.FieldID

                             WHERE  a.fieldid in (2,3,4,5,6,7,8, 23,255,116,21,9,52,10,120,1027, 1020,1025,1026) and (b.ContentID = @ContentID)

                             ORDER BY b.ID ASC
         end
       end