USP_EMAILSCHEDULE_EDITSAVE2

The save procedure used by the edit dataform template "Email Schedule 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.
@EMAILTEMPLATEID int IN Email Template ID
@RECURRENCEID uniqueidentifier IN Recurrence ID
@SCHEDULEENABLED bit IN Is Schedule Enabled
@SCHEDULENAME nvarchar(256) IN Schedule Name
@TIMETOQUEUE time IN Time to queue
@LASTRUN datetime IN Last Run
@TIMEZONEID int IN Time Zone ID
@CLIENTUSERSID int IN Client Users ID
@CLIENTSITESID int IN CMS Site ID

Definition

Copy


create procedure dbo.USP_EMAILSCHEDULE_EDITSAVE2 (
    @ID uniqueidentifier,
    @CHANGEAGENTID uniqueidentifier,
    @EMAILTEMPLATEID integer,
    @RECURRENCEID uniqueidentifier,
    @SCHEDULEENABLED bit,
    @SCHEDULENAME nvarchar(256),
    @TIMETOQUEUE time(0),
    @LASTRUN datetime,
    @TIMEZONEID integer,
    @CLIENTUSERSID integer,
    @CLIENTSITESID integer
)
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

        update dbo.EMAILSCHEDULE set
        EMAILTEMPLATEID = @EMAILTEMPLATEID,
        RECURRENCEID  = @RECURRENCEID,
        SCHEDULEENABLED = @SCHEDULEENABLED,
        SCHEDULENAME = @SCHEDULENAME,
        TIMETOQUEUE = @TIMETOQUEUE,
        CHANGEDBYID = @CHANGEAGENTID,
        DATECHANGED = @CURRENTDATE,
        LASTRUN = @LASTRUN,
        TIMEZONEID = @TIMEZONEID,
        CLIENTUSERSID = @CLIENTUSERSID,
        CLIENTSITESID = @CLIENTSITESID
        where ID = @ID
    end try
    begin catch
        exec dbo.USP_RAISE_ERROR
        return 1
    end catch

return 0;