USP_PROGRAMSALESMETHOD_ONLINE_ENABLE
Executes the "Microsite Programming Program Online" record operation.
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | Input parameter indicating the ID of the record being updated. |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the update. |
Definition
Copy
CREATE procedure dbo.USP_PROGRAMSALESMETHOD_ONLINE_ENABLE
(
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier
)
as begin
begin try
declare @ONLINESALESMETHOD uniqueidentifier = dbo.UFN_SALESMETHOD_GETIDFROMTYPECODE(2);--2 = online
if not exists(select 1 from PROGRAMSALESMETHOD where (PROGRAMID = @ID) and (SALESMETHODID = @ONLINESALESMETHOD))
begin
declare @ISDAILYADMISSION bit
select @ISDAILYADMISSION = ISDAILYADMISSION from dbo.PROGRAM where dbo.PROGRAM.ID = @ID
if @ISDAILYADMISSION = 1
begin
--there's no USP_PROGRAMSALESMETHOD_INSERT
declare @PROGRAMSALESMETHODID uniqueidentifier = NEWID()
declare @CURRENTDATE datetime = getdate()
insert into [PROGRAMSALESMETHOD] (
[ID],
[PROGRAMID],
[SALESMETHODID],
ADDEDBYID,
CHANGEDBYID,
DATEADDED,
DATECHANGED
)
values(
@PROGRAMSALESMETHODID,
@ID,
@ONLINESALESMETHOD,
@CHANGEAGENTID,
@CHANGEAGENTID,
@CURRENTDATE,
@CURRENTDATE
)
end
end
end try
begin catch
--exec dbo.USP_RAISE_ERROR
--return 1
end catch
return 0;
end