USP_DATAFORMTEMPLATE_EDIT_RELATIONSHIPMAPINSTANCEPROPERTIES
The save procedure used by the edit dataform template "Relationship Map Instance Properties Edit Data Form".
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | The input ID parameter indicating the ID of the record being edited. |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the procedure. |
@NAME | nvarchar(255) | IN | Name |
@DESCRIPTION | nvarchar(1000) | IN | Description |
@OTHERSCANMODIFY | bit | IN | Allow others to modify this relationship map |
@CURRENTAPPUSERID | uniqueidentifier | IN | Input parameter indicating the ID of the current user. |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDIT_RELATIONSHIPMAPINSTANCEPROPERTIES (
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier = null,
@NAME nvarchar(255),
@DESCRIPTION nvarchar(1000),
@OTHERSCANMODIFY bit,
@CURRENTAPPUSERID uniqueidentifier = null
)
as
set nocount on;
declare @ISSYSADMIN bit;
declare @CURRENTOWNERID uniqueidentifier;
declare @CURRENTOTHERSCANMODIFY bit;
declare @CURRENTDATE datetime;
if not @CURRENTAPPUSERID is null
begin
select @ISSYSADMIN = dbo.UFN_APPUSER_ISSYSADMIN(@CURRENTAPPUSERID);
if @ISSYSADMIN <> 1
begin
select @CURRENTOWNERID = OWNERID, @CURRENTOTHERSCANMODIFY = OTHERSCANMODIFY from dbo.RELATIONSHIPMAPINSTANCE where ID = @ID;
if @CURRENTOTHERSCANMODIFY = 0 and @CURRENTAPPUSERID <> @CURRENTOWNERID
begin
raiserror('ERR_RELATIONSHIPMAPINSTANCE_NOTOWNER', 13, 1);
end;
if @OTHERSCANMODIFY <> @CURRENTOTHERSCANMODIFY and @CURRENTAPPUSERID <> @CURRENTOWNERID
begin
raiserror('ERR_RELATIONSHIPMAPINSTANCE_OTHERSCANMODIFY_NOTOWNER', 13, 1);
end;
end;
end;
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
set @CURRENTDATE = getdate();
begin try
update dbo.RELATIONSHIPMAPINSTANCE set
NAME = @NAME,
DESCRIPTION = @DESCRIPTION,
OTHERSCANMODIFY = @OTHERSCANMODIFY,
CHANGEDBYID = @CHANGEAGENTID,
DATECHANGED = @CURRENTDATE
where ID = @ID
end try
begin catch
exec dbo.USP_RAISE_ERROR;
return 1;
end catch
return 0;