USP_DATAFORMTEMPLATE_ADD_COPYEVENT
The save procedure used by the add dataform template "Copy Event 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. |
@NAME | nvarchar(100) | IN | Name |
@DESCRIPTION | nvarchar(255) | IN | Description |
@STARTDATE | date | IN | Start date |
@STARTTIME | UDT_HOURMINUTE | IN | Start time |
@ENDDATE | date | IN | End date |
@ENDTIME | UDT_HOURMINUTE | IN | End time |
@CAPACITY | int | IN | Capacity |
@EVENTLOCATIONID | uniqueidentifier | IN | Location |
@EVENTLOCATIONCONTACTID | uniqueidentifier | IN | Contact |
@MAINEVENTID | uniqueidentifier | IN | Main event |
@COPYFROMEVENTID | uniqueidentifier | IN | Input parameter indicating the context ID for the record being added. |
@COPYTASKS | bit | IN | Copy tasks |
@COPYEXPENSES | bit | IN | Copy expenses |
@COPYPRICES | bit | IN | Copy registration options |
@COPYINVITATIONS | bit | IN | Copy invitations |
@COPYINVITEES | bit | IN | Copy invitees |
@COPYATTRIBUTES | bit | IN | Copy attributes |
@ATTRIBUTEDEFINED | bit | IN | Event attributes defined |
@COPYPREFERENCES | bit | IN | Copy preferences |
@SITES | xml | IN | Sites |
@EVENTCATEGORYCODEID | uniqueidentifier | IN | Category |
@COPYTEAMSTRUCTURE | bit | IN | Copy team structure |
@COPYTEAMFUNDRAISERS | bit | IN | Copy team members |
@APPEALID | uniqueidentifier | IN | Appeal |
@ADDQUICKCOMPARE | bit | IN | Allow quick comparisons with original event |
@COPYLODGINGOPTIONS | bit | IN | Copy lodging options |
@EVENTLOCATIONROOMID | uniqueidentifier | IN | Room/Unit |
@COPYJOBOCCURRENCES | bit | IN | Copy job occurrences |
@ISAUCTION | bit | IN | Event is an auction |
@COPYDESIGNATIONS | bit | IN | Copy designations |
@CURRENTAPPUSERID | uniqueidentifier | IN | Input parameter indicating the ID of the current user. |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_COPYEVENT
(
@ID uniqueidentifier = null output,
@CHANGEAGENTID uniqueidentifier = null,
@NAME nvarchar(100) = '',
@DESCRIPTION nvarchar(255) = '',
@STARTDATE date,
@STARTTIME dbo.UDT_HOURMINUTE = null,
@ENDDATE date = null,
@ENDTIME dbo.UDT_HOURMINUTE = null,
@CAPACITY int = 0,
@EVENTLOCATIONID uniqueidentifier = null,
@EVENTLOCATIONCONTACTID uniqueidentifier = null,
@MAINEVENTID uniqueidentifier = null,
@COPYFROMEVENTID uniqueidentifier,
@COPYTASKS bit = 1,
@COPYEXPENSES bit = 1,
@COPYPRICES bit = 1,
@COPYINVITATIONS bit = 1,
@COPYINVITEES bit = 1,
@COPYATTRIBUTES bit = 1,
@ATTRIBUTEDEFINED bit = 0,
@COPYPREFERENCES bit = 1,
@SITES xml = null,
@EVENTCATEGORYCODEID uniqueidentifier = null,
@COPYTEAMSTRUCTURE bit = 0,
@COPYTEAMFUNDRAISERS bit = 0,
@APPEALID uniqueidentifier = null,
@ADDQUICKCOMPARE bit = 0,
@COPYLODGINGOPTIONS bit = 1,
@EVENTLOCATIONROOMID uniqueidentifier = null,
@COPYJOBOCCURRENCES bit = 1,
@ISAUCTION bit = 0,
@COPYDESIGNATIONS bit = 1,
@CURRENTAPPUSERID uniqueidentifier = null
)
as
set nocount on;
declare @CURRENTDATE datetime;
if @ID is null
set @ID = newid();
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
set @CURRENTDATE = getdate();
if @ENDDATE is null
set @ENDDATE = @STARTDATE;
begin try
-- Adding to a hierarchy must now be done from the event summary page or the hierarchy tab
set @MAINEVENTID = null;
--CR297394-040708 TMV 04/08/2008 This may change to be a database constraint in a future release
if dbo.UFN_EVENT_CANSUPPORTEVENTS_NULLAPPEAL(@MAINEVENTID) <> 1
raiserror('ERR_EVENT_CANSUPPORTEVENTS_NULLAPPEAL', 16, 1);
if @ISAUCTION = 1 and @APPEALID is not null and @APPEALID <> '00000000-0000-0000-0000-000000000000'
raiserror('ERR_EVENTAUCTION_TEAMFUNDRAISINGAPPEAL', 13, 1);
exec dbo.USP_EVENTSITE_VALIDATESITES @SITES
insert into dbo.EVENT
(ID, NAME, DESCRIPTION, STARTDATE, STARTTIME, ENDDATE, ENDTIME, CAPACITY, EVENTLOCATIONID, EVENTLOCATIONROOMID, EVENTLOCATIONCONTACTID, MAINEVENTID, EVENTCATEGORYCODEID, APPEALID, ADDEDBYID, CHANGEDBYID, DATEADDED, DATECHANGED)
values
(@ID, @NAME, @DESCRIPTION, @STARTDATE, @STARTTIME, @ENDDATE, @ENDTIME, @CAPACITY, @EVENTLOCATIONID, @EVENTLOCATIONROOMID, @EVENTLOCATIONCONTACTID, @MAINEVENTID, @EVENTCATEGORYCODEID, @APPEALID, @CHANGEAGENTID, @CHANGEAGENTID, @CURRENTDATE, @CURRENTDATE);
exec dbo.USP_EVENT_GETSITES_ADDFROMXML @ID, @SITES, @CHANGEAGENTID, @CURRENTDATE
if @COPYFROMEVENTID is not null
begin
if @COPYTASKS = 1
exec dbo.USP_EVENTTASK_COPY @COPYFROMEVENTID, @ID, @CHANGEAGENTID;
if @COPYEXPENSES = 1
exec dbo.USP_EVENTEXPENSE_COPY @COPYFROMEVENTID, @ID, @CHANGEAGENTID;
if @COPYPRICES = 1
exec dbo.USP_EVENTPRICE_COPY @COPYFROMEVENTID, @ID, @CHANGEAGENTID;
if @COPYINVITATIONS = 1
exec dbo.USP_INVITATION_COPY @COPYFROMEVENTID, @ID, @CHANGEAGENTID, @COPYINVITEES;
if @COPYATTRIBUTES = 1
exec dbo.USP_EVENTATTRIBUTE_COPY @COPYFROMEVENTID, @ID, @CHANGEAGENTID;
if @COPYPREFERENCES = 1
exec dbo.USP_EVENTPREFERENCE_COPY @COPYFROMEVENTID, @ID, @CHANGEAGENTID;
if @COPYTEAMSTRUCTURE = 1
exec dbo.USP_EVENT_TEAMFUNDRAISINGCOPY @COPYFROMEVENTID, null, @ID, @CHANGEAGENTID, @COPYTEAMFUNDRAISERS, @CURRENTAPPUSERID = @CURRENTAPPUSERID, @FEATUREID = 'E8EF143A-F3A4-4A1C-97BD-0846DA7EEF5A';
if @COPYLODGINGOPTIONS = 1
exec dbo.USP_EVENTLODGINGOPTIONS_COPY @COPYFROMEVENTID, @ID, @CHANGEAGENTID;
if @COPYJOBOCCURRENCES = 1
exec dbo.USP_EVENTJOBOCCURRENCES_COPY @COPYFROMEVENTID, @ID, @CHANGEAGENTID;
if @COPYDESIGNATIONS = 1
exec dbo.USP_EVENTDESIGNATIONS_COPY @COPYFROMEVENTID, @ID, @CHANGEAGENTID;
end
if @ISAUCTION = 1
insert into dbo.EVENTAUCTION(ID, DATEADDED, DATECHANGED, ADDEDBYID, CHANGEDBYID) values(@ID, @CURRENTDATE, @CURRENTDATE, @CHANGEAGENTID, @CHANGEAGENTID)
end try
begin catch
exec dbo.USP_RAISE_ERROR;
return 1;
end catch
return 0;