spAddUpdate_Workflow
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@PKID | int | INOUT | |
@Name | nvarchar(50) | IN | |
@Description | nvarchar(256) | IN | |
@IsDefault | bit | IN | |
@ContentTypesID | int | IN |
Definition
Copy
CREATE procedure [dbo].[spAddUpdate_Workflow]
(
@PKID int output ,
@Name nvarchar(50),
@Description nvarchar(256),
@IsDefault bit,
@ContentTypesID int
)
AS
if exists(select null from dbo.vwSiteContent sc, dbo.Workflow w where sc.[WorkflowID]=@PKID and sc.[Status] in (0,1) and sc.ContentTypesID=w.ContentTypesID and w.ContentTypesID<>@ContentTypesID)
begin
raiserror('Unable to change Part Type for this Workflow - There are draft/pending parts associated with it.',16,1)
return 0
end
begin transaction
if @IsDefault=1
update dbo.Workflow set [IsDefault]=0 where [ContentTypesID]=@ContentTypesID
if (@PKID<=0)
begin
insert into dbo.Workflow
(
[Name],
[Description],
[IsDefault],
[ContentTypesID]
)
values
(
@Name,
@Description,
@IsDefault,
@ContentTypesID
)
select @PKID = @@Identity
end
else
begin
update dbo.Workflow set
[Name] =@Name ,
[Description] =@Description ,
[IsDefault] =@IsDefault ,
[ContentTypesID] =@ContentTypesID
where ID=@PKID
end
commit transaction