USP_DATAFORMTEMPLATE_ADD_GRADINGSCALEFACULTY
The save procedure used by the add dataform template "Grading Scale Faculty Add Form".
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | INOUT | The output parameter indicating the ID of the record added. |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the procedure. |
@CURRENTAPPUSERID | uniqueidentifier | IN | Input parameter indicating the ID of the current user. |
@NAME | nvarchar(60) | IN | Name |
@DESCRIPTION | nvarchar(150) | IN | Description |
@GRADES | xml | IN | Grades |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_GRADINGSCALEFACULTY
(
@ID uniqueidentifier = null output,
@CHANGEAGENTID uniqueidentifier = null,
@CURRENTAPPUSERID uniqueidentifier = null,
@NAME nvarchar(60) = '',
@DESCRIPTION nvarchar(150) = '',
@GRADES xml = null
)
as
set nocount on;
if @ID is null
set @ID = newid()
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output
declare @CURRENTDATE datetime
set @CURRENTDATE = getdate()
declare @FACULTYID uniqueidentifier
set @FACULTYID = (select APPUSER.CONSTITUENTID
from dbo.APPUSER
where APPUSER.ID = @CURRENTAPPUSERID)
begin try
-- handle inserting the data
insert into dbo.GRADINGSCALE
(ID, NAME, DESCRIPTION, FACULTYID, ADDEDBYID, CHANGEDBYID, DATEADDED, DATECHANGED)
values
(@ID, @NAME, @DESCRIPTION, @FACULTYID, @CHANGEAGENTID, @CHANGEAGENTID, @CURRENTDATE, @CURRENTDATE)
exec dbo.USP_GRADINGSCALE_GETGRADES_UPDATEFROMXML @ID, @GRADES, @CHANGEAGENTID
if dbo.UFN_GRADINGSCALEGRADE_RANGESOVERLAP(@ID) = 1
raiserror('CK_GRADINGSCALEGRADE_RANGESOVERLAP', 13, 1);
end try
begin catch
exec dbo.USP_RAISE_ERROR
return 1
end catch
return 0