USP_JOBOCCURRENCE_DELETE
Executes the "Job Occurrence: Delete" record operation.
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | Input parameter indicating the ID of the record being deleted. |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the delete. |
Definition
Copy
CREATE procedure dbo.USP_JOBOCCURRENCE_DELETE
(
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier
)
as
set nocount on;
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
if exists(select top 1 VOLUNTEERASSIGNMENT.ID
from VOLUNTEERASSIGNMENT
where VOLUNTEERASSIGNMENT.JOBOCCURRENCEID = @ID)
begin
raiserror('Job occurrences with job assignments cannot be deleted.', 13, 1);
return 0;
end
if exists(select top 1 TIMESHEET.ID
from TIMESHEET
where TIMESHEET.JOBOCCURRENCEID = @ID)
begin
raiserror('Job occurrences with timesheets recorded cannot be deleted.', 13, 1);
return 0;
end
exec dbo.USP_JOBOCCURRENCE_DELETEBYID_WITHCHANGEAGENTID @ID, @CHANGEAGENTID;
return 0;