USP_DESIGNATION_CMS_DELETE

Executes the "Designation Donation BasicCms Page: Delete" record operation.

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN Input parameter indicating the ID of the record being deleted.
@CHANGEAGENTID uniqueidentifier IN Input parameter indicating the ID of the change agent invoking the delete.

Definition

Copy


CREATE procedure dbo.USP_DESIGNATION_CMS_DELETE
(
    @ID uniqueidentifier,
    @CHANGEAGENTID uniqueidentifier
)
as begin
    -- use the system generated delete routine to allow proper recording of the deleting agent

    --exec USP_TABLE1_DELETEBYID_WITHCHANGEAGENTID @ID, @CHANGEAGENTID

    --would do the above but there's no audit table for formerly-Shelby tables


    declare @DESIGNATIONTABLECATALOGID uniqueidentifier
    set @DESIGNATIONTABLECATALOGID = 'AEBA8FD5-42B6-4D37-93EB-8916BEC1385A'

    declare @MicrositePageID uniqueidentifier
    declare @SitePagesID int
    declare @SiteContentID int
    select 
        @MicrositePageID = ID, 
        @SitePagesID = SITEPAGESID, 
        @SiteContentID = PRIMARYCONTENTID 
    from dbo.MICROSITEPAGE 
    where TABLECATALOGID = @DESIGNATIONTABLECATALOGID 
        and OBJECTID = @ID 

    /*
    declare @SiteContentTitle nvarchar(256)
    select @SiteContentTitle = Title from dbo.SiteContent where ID = @SiteContentID 
    declare @EmailTemplateID int
    select @EmailTemplateID = ID from dbo.EmailTemplate where Name like Left(@SiteContentTitle, 92) + '%'
    */

    /*
    print @id
    print @MicrositePageID 
    print @SitePagesID
    print @SiteContentID
    print @SiteContentTitle
    print @EmailTemplateID
    */

    update dbo.VanityURL set RealmID=0, PageID=NULL, TargetURL = (select value from MicrositeSetting where MICROSITESETTING = 1), DATECHANGED = GetDate() where PageID=@SitePagesID
    update dbo.MICROSITEPAGE set EXCLUDED = 1 where ID = @MicrositePageID
    /*
    delete from MICROSITEPAGE where SITEPAGESID = @SitePagesID and PRIMARYCONTENTID = @SiteContentID --exec USP_MICROSITEPAGE_DELETEBYID_WITHCHANGEAGENTID @MicrositePageID, @CHANGEAGENTID todo what's with the null guid value for ID?
    delete from DonationDesignations where BackOfficeIDGUID = @ID and ClientDonationsID = @SiteContentID 
    delete from SiteContent where ID = @SiteContentID 
    delete from SitePages where ID = @SitePagesID 
    exec spDelete_EmailTemplate @EmailTemplateID, 1 --todo is 1 supervisor, is that okay to use?
    */

    return 0;
end