spAdd_CalendarEvtCategoryPick
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@iEvtCalID | int | IN | |
@guidCategoryID | uniqueidentifier | IN |
Definition
Copy
CREATE PROCEDURE [dbo].[spAdd_CalendarEvtCategoryPick]
(
@iEvtCalID int,
@guidCategoryID uniqueidentifier
)
AS
set nocount on
begin
INSERT INTO [dbo].[CalendarEvtCategoryPicks]
(
EventCalendarID,
CategoryCodeTableEntryID
)
VALUES
(
@iEvtCalID,
@guidCategoryID
)
SELECT @@Identity
--set default object security for newly uploaded images
declare @CURRENTDATE datetime = getdate()
declare @CHANGEAGENTID uniqueidentifier
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output
declare @OBJECTTASKID uniqueidentifier
set @OBJECTTASKID = (select ID from dbo.CMSOBJECTTASK where ENUMID = 0)
insert into CMSEVERYONESECURITYPRIVS(SECUREDOBJECTGUID, SECUREDOBJECTTYPEID, OBJECTTASKID, VALUE, ADDEDBYID, CHANGEDBYID, DATEADDED, DATECHANGED)
select p.CalendarCategoryPicksID, 31, @OBJECTTASKID, 1, @CHANGEAGENTID, @CHANGEAGENTID, @CURRENTDATE, @CURRENTDATE
from dbo.[CalendarEvtCategoryPicks] p
left outer join (select * from dbo.CMSEVERYONESECURITYPRIVS where OBJECTTASKID = @OBJECTTASKID and SECUREDOBJECTTYPEID = 31)CESP on CESP.SECUREDOBJECTGUID = p.CalendarCategoryPicksID
where CESP.ID is null and p.EventCalendarID = @iEvtCalID and p.CategoryCodeTableEntryID = @guidCategoryID
set @OBJECTTASKID = (select ID from dbo.CMSOBJECTTASK where ENUMID = 9)
insert into CMSEVERYONESECURITYPRIVS(SECUREDOBJECTGUID, SECUREDOBJECTTYPEID, OBJECTTASKID, VALUE, ADDEDBYID, CHANGEDBYID, DATEADDED, DATECHANGED)
select p.CalendarCategoryPicksID, 31, @OBJECTTASKID, 0, @CHANGEAGENTID, @CHANGEAGENTID, @CURRENTDATE, @CURRENTDATE
from dbo.[CalendarEvtCategoryPicks] p
left outer join (select * from dbo.CMSEVERYONESECURITYPRIVS where OBJECTTASKID = @OBJECTTASKID and SECUREDOBJECTTYPEID = 31)CESP on CESP.SECUREDOBJECTGUID = p.CalendarCategoryPicksID
where CESP.ID is null and p.EventCalendarID = @iEvtCalID and p.CategoryCodeTableEntryID = @guidCategoryID
end