USP_DATAFORMTEMPLATE_EDITLOAD_ORGANIZATION

The load procedure used by the edit dataform template "Organization Data Edit 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.
@ORGANIZATIONNAME nvarchar(100) INOUT Name
@INDUSTRYCODEID uniqueidentifier INOUT Industry
@NUMEMPLOYEES int INOUT No. of employees
@NUMSUBSIDIARIES int INOUT No. of subsidiaries
@PARENTCORPID uniqueidentifier INOUT Parent org
@PICTURE varbinary INOUT Image
@PICTURETHUMBNAIL varbinary INOUT Image thumbnail
@PICTURECHANGED bit INOUT Picture changed?
@WEBADDRESS UDT_WEBADDRESS INOUT Website
@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_ORGANIZATION
                (
                    @ID uniqueidentifier,
                    @DATALOADED bit = 0 output,
                    @ORGANIZATIONNAME nvarchar(100) = null output
                    @INDUSTRYCODEID uniqueidentifier = null output,        
                    @NUMEMPLOYEES int = null output,
                    @NUMSUBSIDIARIES int = null output,
                    @PARENTCORPID uniqueidentifier = null output,
                    @PICTURE varbinary(max) = null output,
                    @PICTURETHUMBNAIL varbinary(max) = null output,
                    @PICTURECHANGED bit = null output,
                    @WEBADDRESS dbo.UDT_WEBADDRESS = null output,
                    @TSLONG bigint = 0 output

                ) as
                    set nocount on;

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

                    select 
                        @DATALOADED = 1,
                        @ID = CONSTITUENT.ID,
                        @ORGANIZATIONNAME = CONSTITUENT.KEYNAMEPREFIX + case CONSTITUENT.KEYNAMEPREFIX when '' then '' else '\' end + CONSTITUENT.KEYNAME,
                        @INDUSTRYCODEID = ORGANIZATIONDATA.INDUSTRYCODEID,
                        @NUMEMPLOYEES = coalesce(ORGANIZATIONDATA.NUMEMPLOYEES,0),
                        @NUMSUBSIDIARIES = coalesce(ORGANIZATIONDATA.NUMSUBSIDIARIES,0),
                        @PARENTCORPID = ORGANIZATIONDATA.PARENTCORPID,
                        @PICTURETHUMBNAIL = CONSTITUENT.PICTURETHUMBNAIL,
                        @WEBADDRESS = WEBADDRESS,
                        @TSLONG = CONSTITUENT.TSLONG
                    from 
                        dbo.CONSTITUENT
                        left join dbo.ORGANIZATIONDATA on ORGANIZATIONDATA.ID = CONSTITUENT.ID
                    where 
                        CONSTITUENT.ISORGANIZATION = 1 and
                        CONSTITUENT.ID = @ID;

                    return 0;