spDelete_SiteStylesheets

Parameters

Parameter Parameter Type Mode Description
@PKID int IN
@CurrentUsersID int IN

Definition

Copy

        CREATE procedure [dbo].[spDelete_SiteStylesheets]
    (
@PKID int,
    @CurrentUsersID    int
)

as

declare @Guid uniqueidentifier


if (exists (select top 1 ID from dbo.SiteLayouts where StylesheetId=@PKID))

    begin

        raiserror ('Unable to delete style sheet - This style sheet is in use by one or more layouts',16,1)

        return 0

    end



if (exists (select top 1 ID from dbo.THEMESTYLESHEET where STYLESHEETID=@PKID))

    begin

        raiserror ('Unable to delete style sheet - This style sheet is in use',16,1)

        return 0

    end



begin transaction

    --Update SiteStylesheets set Deleted = 1 where ID = @PKID

    select @Guid = Guid from SiteStylesheets where ID = @PKID

    exec spAuditThis @CurrentUsersID, 3, @Guid, 30

    delete from dbo.SiteStylesheets where ID = @PKID


    exec spDelete_ObjectSecurity @Guid

commit