USP_DATAFORMTEMPLATE_EDIT_RELATIONSHIPMAPINSTANCE
The save procedure used by the edit dataform template "Relationship Map Instance 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. |
@DEFINITIONXML | xml | IN | Definition XML |
@PARAMETERDEFINITIONXML | xml | IN | Parameter definition XML |
@CURRENTAPPUSERID | uniqueidentifier | IN | Input parameter indicating the ID of the current user. |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDIT_RELATIONSHIPMAPINSTANCE (
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier = null,
@DEFINITIONXML xml,
@PARAMETERDEFINITIONXML xml,
@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;
end;
end;
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
set @CURRENTDATE = getdate();
begin try
update dbo.RELATIONSHIPMAPINSTANCE set
DEFINITIONXML = @DEFINITIONXML,
PARAMETERDEFINITIONXML = @PARAMETERDEFINITIONXML,
CHANGEDBYID = @CHANGEAGENTID,
DATECHANGED = @CURRENTDATE
where ID = @ID
end try
begin catch
exec dbo.USP_RAISE_ERROR;
return 1;
end catch
return 0;