USP_DATAFORMTEMPLATE_EDITLOAD_MKTSEED_2

The load procedure used by the edit dataform template "Seed 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.
@INACTIVE bit INOUT Inactive
@FIRSTNAME nvarchar(50) INOUT First name
@MIDDLENAME nvarchar(50) INOUT Middle name
@LASTNAME nvarchar(100) INOUT Last name
@TITLECODEID uniqueidentifier INOUT Title
@SUFFIXCODEID uniqueidentifier INOUT Suffix
@COUNTRYID uniqueidentifier INOUT Country
@ADDRESSBLOCK nvarchar(150) INOUT Address
@CITY nvarchar(50) INOUT City
@STATEID uniqueidentifier INOUT State
@POSTCODE nvarchar(12) INOUT Post code
@CART nvarchar(10) INOUT CART
@DPC nvarchar(8) INOUT DPC
@LOT nvarchar(5) INOUT LOT
@PHONENUMBER nvarchar(100) INOUT Phone number
@EMAILADDRESS UDT_EMAILADDRESS INOUT Email address
@SITEID uniqueidentifier INOUT Site
@SITEREQUIRED bit INOUT Site required?
@SEEDINUSE bit INOUT Seed in use?
@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.

Definition

Copy


CREATE procedure dbo.[USP_DATAFORMTEMPLATE_EDITLOAD_MKTSEED_2]
(
  @ID uniqueidentifier,
  @CURRENTAPPUSERID uniqueidentifier,
  @DATALOADED bit = 0 output,
  @INACTIVE bit = null output,
  @FIRSTNAME nvarchar(50) = null output,
  @MIDDLENAME nvarchar(50) = null output,
  @LASTNAME nvarchar(100) = null output,
  @TITLECODEID uniqueidentifier = null output,
  @SUFFIXCODEID uniqueidentifier = null output,
  @COUNTRYID uniqueidentifier = null output,
  @ADDRESSBLOCK nvarchar(150) = null output,
  @CITY nvarchar(50) = null output,
  @STATEID uniqueidentifier = null output,
  @POSTCODE nvarchar(12) = null output,
  @CART nvarchar(10) = null output,
  @DPC nvarchar(8) = null output,
  @LOT nvarchar(5) = null output,
  @PHONENUMBER nvarchar(100) = null output,
  @EMAILADDRESS dbo.UDT_EMAILADDRESS = null output,
  @SITEID uniqueidentifier = null output,
  @SITEREQUIRED bit = null output,
  @SEEDINUSE bit = null output,
  @TSLONG bigint = 0 output
)
as
  set nocount on;

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

  select
    @DATALOADED = 1,
    @INACTIVE = [INACTIVE],
    @FIRSTNAME = [FIRSTNAME],
    @MIDDLENAME = [MIDDLENAME],
    @LASTNAME = [LASTNAME],
    @TITLECODEID = [TITLECODEID],
    @SUFFIXCODEID = [SUFFIXCODEID],
    @COUNTRYID = isnull([COUNTRYID], dbo.[UFN_COUNTRY_GETDEFAULT]()), -- load the default country if there is no country on the seed

    @ADDRESSBLOCK = [ADDRESSBLOCK],
    @CITY = [CITY],
    @STATEID = [STATEID],
    @POSTCODE = [POSTCODE],
    @CART = [CART],
    @DPC = [DPC],
    @LOT = [LOT],
    @PHONENUMBER = [PHONENUMBER],
    @EMAILADDRESS = [EMAILADDRESS],
    @SITEID = [SITEID],
    @TSLONG = [TSLONG]
  from dbo.[MKTSEED]
  where [ID] = @ID;

  set @SITEREQUIRED = dbo.[UFN_SITEREQUIREDFORUSERONFEATURE](@CURRENTAPPUSERID, '7ca4fcbe-a657-47c7-9277-d4003c26ca89', 1);

  set @SEEDINUSE = case when exists(select top 1 1 from dbo.[MKTSEGMENTATIONSEED] where [SEEDID] = @ID) then 1 else 0 end;

  return 0;