USP_DATAFORMTEMPLATE_EDIT_TRANSLATIONTABLEGRADE
The save procedure used by the edit dataform template "Translation Table Grade 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. |
@GRADES | xml | IN | Grades |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDIT_TRANSLATIONTABLEGRADE (
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier = null,
@GRADES xml
)
as
set nocount on;
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output
declare @CURRENTDATE datetime
set @CURRENTDATE = getdate()
begin try
-- handle updating the data
-- link translation table to specified grades
exec dbo.USP_TRANSLATIONTABLE_GETGRADE_UPDATEFROMXML @ID, @GRADES, @CHANGEAGENTID;
--These cannot be done with table constraints since all grade rows are not always updated at the same time, and problems can exist until all rows are saved.
--Validate that no grade ranges overlap
if dbo.UFN_TRANSLATIONTABLEGRADE_SCORESOVERLAP(@ID) = 1
raiserror('CK_TRANSLATIONTABLEGRADE_SCORESOVERLAP', 13, 1);
--Validate that there are no gaps between grade ranges
if dbo.UFN_TRANSLATIONTABLEGRADE_RANGEGAPS(@ID) = 1
raiserror('CK_TRANSLATIONTABLEGRADE_RANGEGAPS', 13, 1);
end try
begin catch
exec dbo.USP_RAISE_ERROR
return 1
end catch
return 0;