USP_DATAFORMTEMPLATE_EDITLOAD_SALESORDER_ONLINE_CONSTITUENTADDRESSUPDATE
The load procedure used by the edit dataform template "Sales Order Online Constituent Address Edit Data Form"
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | The input ID parameter used to load the fields defined on the form. |
@DATALOADED | bit | INOUT | Output parameter indicating whether or not data was actually loaded. |
@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. |
@CONSTITUENTID | uniqueidentifier | INOUT | Constituent ID |
@ADDRESSID | uniqueidentifier | INOUT | Address ID |
@PHONEID | uniqueidentifier | INOUT | Phone ID |
@EMAILADDRESSID | uniqueidentifier | INOUT | Email ID |
@PHONE | nvarchar(100) | INOUT | Phone Number |
nvarchar(100) | INOUT | Email Address | |
@COUNTRYID | uniqueidentifier | INOUT | Country ID |
@STATEID | uniqueidentifier | INOUT | State ID |
@ADDRESSBLOCK | nvarchar(150) | INOUT | Address block |
@CITY | nvarchar(50) | INOUT | City |
@POSTCODE | nvarchar(12) | INOUT | Post code |
@TITLECODEID | uniqueidentifier | INOUT | Title code ID |
@FIRSTNAME | nvarchar(50) | INOUT | Firstname |
@KEYNAME | nvarchar(100) | INOUT | Keyname |
@COMPLETINGORDER | bit | INOUT | Completing order |
@ADDRESSTYPECODEID | uniqueidentifier | INOUT | |
@EMAILADDRESSTYPECODEID | uniqueidentifier | INOUT | |
@PHONETYPECODEID | uniqueidentifier | INOUT |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDITLOAD_SALESORDER_ONLINE_CONSTITUENTADDRESSUPDATE(
@ID uniqueidentifier,
@DATALOADED bit = 0 output,
@TSLONG bigint = 0 output,
@CONSTITUENTID uniqueidentifier = null output,
@ADDRESSID uniqueidentifier = null output,
@PHONEID uniqueidentifier = null output,
@EMAILADDRESSID uniqueidentifier = null output,
@PHONE nvarchar(100) = null output,
@EMAIL nvarchar(100) = null output,
@COUNTRYID uniqueidentifier = null output,
@STATEID uniqueidentifier = null output,
@ADDRESSBLOCK nvarchar(150) = null output,
@CITY nvarchar(50) = null output,
@POSTCODE nvarchar(12) = null output,
@TITLECODEID uniqueidentifier = null output,
@FIRSTNAME nvarchar(50) = null output,
@KEYNAME nvarchar(100) = null output,
@COMPLETINGORDER bit = null output,
@ADDRESSTYPECODEID uniqueidentifier = null output,
@EMAILADDRESSTYPECODEID uniqueidentifier = null output,
@PHONETYPECODEID uniqueidentifier = null output
)
as
set nocount on;
-- be sure to set these, in case the select returns no rows
set @DATALOADED = 0
set @TSLONG = 0
set @COMPLETINGORDER = 0
-- populate the output parameters, which correspond to fields on the form. Note that
-- we set @DATALOADED = 1 to indicate that the load was successful. Otherwise, the system
-- will display a "no data loaded" message. Also note that we fetch the TSLONG so that concurrency
-- can be considered.
select
@DATALOADED = 1,
@TSLONG = TSLONG,
@CONSTITUENTID = CONSTITUENTID,
@ADDRESSID = ADDRESSID,
@PHONEID = PHONEID,
@EMAILADDRESSID = EMAILADDRESSID
from dbo.[SALESORDER]
where ID = @ID
if @ADDRESSID is not null
begin
select
@COUNTRYID = [ADDRESS].[COUNTRYID],
@STATEID = [ADDRESS].[STATEID],
@ADDRESSBLOCK = [ADDRESS].[ADDRESSBLOCK],
@CITY = [ADDRESS].[CITY],
@POSTCODE = [ADDRESS].[POSTCODE]
from dbo.[ADDRESS]
where [ADDRESS].[ID] = @ADDRESSID
end
if @PHONEID is not null
begin
select @PHONE = [PHONE].[NUMBER]
from dbo.[PHONE]
where [PHONE].[ID] = @PHONEID
end
if @EMAILADDRESSID is not null
begin
select @EMAIL = [EMAILADDRESS].[EMAILADDRESS]
from dbo.[EMAILADDRESS]
where [EMAILADDRESS].[ID] = @EMAILADDRESSID
end
select
@TITLECODEID = [CONSTITUENT].[TITLECODEID],
@FIRSTNAME = [CONSTITUENT].[FIRSTNAME],
@KEYNAME = [CONSTITUENT].[KEYNAME]
from dbo.[CONSTITUENT]
where [CONSTITUENT].[ID] = @CONSTITUENTID
return 0;