USP_DATAFORMTEMPLATE_EDITLOAD_MKTPACKAGE_2

The load procedure used by the edit dataform template "Package Edit Form 2"

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN The input ID parameter used to load the fields defined on the form.
@CURRENTAPPUSERID uniqueidentifier IN Input parameter indicating the ID of the current user.
@DATALOADED bit INOUT Output parameter indicating whether or not data was actually loaded.
@NAME nvarchar(100) INOUT Name
@DESCRIPTION nvarchar(255) INOUT Description
@CODE nvarchar(10) INOUT Code
@COST money INOUT Unit cost
@CREATIVECOSTS money INOUT Creative costs
@SITEID uniqueidentifier INOUT Site
@SITEREQUIRED bit INOUT Site required?
@SITECANBECHANGED bit INOUT Site can be changed?
@CHANNELCODE tinyint INOUT Channel
@CATEGORYCODEID uniqueidentifier INOUT Category
@CODEVALUEID uniqueidentifier INOUT Code value ID
@TSLONG bigint INOUT Output parameter indicating the TSLONG value of the record being edited. This is used to manage multi-user concurrency issues when multiple users access the same record.
@BASECURRENCYID uniqueidentifier INOUT Currency

Definition

Copy


CREATE procedure dbo.[USP_DATAFORMTEMPLATE_EDITLOAD_MKTPACKAGE_2]
(
  @ID uniqueidentifier,
  @CURRENTAPPUSERID uniqueidentifier,
  @DATALOADED bit = 0 output,
  @NAME nvarchar(100) = null output,
  @DESCRIPTION nvarchar(255) = null output,
  @CODE nvarchar(10) = null output,
  @COST money = null output,
  @CREATIVECOSTS money = null output,
  @SITEID uniqueidentifier = null output,
  @SITEREQUIRED bit = null output,
  @SITECANBECHANGED bit = null output,
  @CHANNELCODE tinyint = null output,
  @CATEGORYCODEID uniqueidentifier = null output,
  @CODEVALUEID uniqueidentifier = null output,
  @TSLONG bigint = 0 output,
  @BASECURRENCYID uniqueidentifier = null output
)
as
  set nocount on;

  set @DATALOADED = 0;
  set @TSLONG = 0;

  select
    @DATALOADED = 1,
    @NAME = [NAME],
    @DESCRIPTION = [DESCRIPTION],
    @CODE = [CODE],
    @CODEVALUEID = [PARTDEFINITIONVALUESID],
    @CHANNELCODE = [CHANNELCODE],
    @CATEGORYCODEID = [PACKAGECATEGORYCODEID],
    @COST = [UNITCOST],
    @CREATIVECOSTS = (select isnull(sum([MKTCREATIVE].[COST]),0)
                      from dbo.[MKTPACKAGECREATIVE]
                      inner join dbo.[MKTCREATIVE] on [MKTCREATIVE].[ID] = [MKTPACKAGECREATIVE].[CREATIVEID]
                      where [MKTPACKAGECREATIVE].[PACKAGEID] = [MKTPACKAGE].[ID]),
    @SITEID = [SITEID],
    @TSLONG = [TSLONG],
    @BASECURRENCYID = [BASECURRENCYID]
  from dbo.[MKTPACKAGE]
  where [ID] = @ID;

  set @SITEREQUIRED = dbo.[UFN_SITEREQUIREDFORUSERONFEATURE](@CURRENTAPPUSERID, 'ce58c5e1-7206-48e4-9b6f-b016e3bb524b', 1);
  set @SITECANBECHANGED = 1; -- obsolete


  return 0;