USP_MEMBERSHIPPROGRAM_BASICCMS_DELETE
Executes the "Membership Program BasicCms Page: Offline" 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_MEMBERSHIPPROGRAM_BASICCMS_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 @MEMBERSHIPPROGRAMTABLECATALOGID uniqueidentifier
set @MEMBERSHIPPROGRAMTABLECATALOGID = '8281FD87-4CAF-4C5F-835F-54E82B5A8DFC'
declare @MicrositePageID uniqueidentifier
declare @SitePagesID int
declare @SiteContentID int
select
@MicrositePageID = ID,
@SitePagesID = SITEPAGESID,
@SiteContentID = PRIMARYCONTENTID
from dbo.MICROSITEPAGE
where TABLECATALOGID = @MEMBERSHIPPROGRAMTABLECATALOGID
and OBJECTID = @ID
/*
print @id
print @MicrositePageID
print @SitePagesID
print @SiteContentID
*/
update dbo.VanityURL set RealmID=0, PageID=NULL, TargetURL = (select value from dbo.MICROSITESETTING where MICROSITESETTING = 1) where PageID = @SitePagesID
update dbo.MICROSITEPAGE set EXCLUDED = 1 where ID = @MicrositePageID
--Take the membership levels offline
delete dbo.[MICROSITEMEMBERSHIPLEVEL]
where exists(
select 1
from dbo.[MEMBERSHIPLEVEL]
where
[MEMBERSHIPLEVEL].[ID] = [MICROSITEMEMBERSHIPLEVEL].[ID] and
[MEMBERSHIPLEVEL].[MEMBERSHIPPROGRAMID] = @ID
)
return 0;
end