USP_DATAFORMTEMPLATE_EDITLOAD_APPUSERSYSTEMROLE
The load procedure used by the edit dataform template "Application User System Role 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. |
@SYSTEMROLEID | uniqueidentifier | INOUT | System role |
@SECURITYMODECODE | tinyint | INOUT | Record access |
@SITEHIERARCHY | xml | INOUT | Hierarchy |
@SITES | xml | INOUT | Sites |
@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. |
@BRANCHSITEID | uniqueidentifier | INOUT | Branch |
@APPUSERSITE | nvarchar(1024) | INOUT | |
@CONSTITUENTSECURITYMODECODE | tinyint | INOUT | Record access |
@CONSTITUENTSECURITYGROUPS | xml | INOUT | Constituent security groups |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDITLOAD_APPUSERSYSTEMROLE
(
@ID uniqueidentifier,
@DATALOADED bit = 0 output,
@SYSTEMROLEID uniqueidentifier = null output,
@SECURITYMODECODE tinyint = null output,
@SITEHIERARCHY xml = null output,
@SITES xml = null output,
@TSLONG bigint = 0 output,
@BRANCHSITEID uniqueidentifier = null output,
@APPUSERSITE nvarchar(1024) = null output,
@CONSTITUENTSECURITYMODECODE tinyint = null output,
@CONSTITUENTSECURITYGROUPS xml = null output
)
as
begin
set nocount on;
select
@SITEHIERARCHY = (
select
SITE.ID as SITEID,
(select
PARENTSITE.ID
from
dbo.SITE AS PARENTSITE
where
SITE.HIERARCHYPATH.GetAncestor(1) = PARENTSITE.HIERARCHYPATH
) as PARENTSITEID,
SITE.NAME,
row_number() over (partition by SITE.HIERARCHYPATH.GetAncestor(1) order by HIERARCHYPATH) as SEQUENCE,
isnull(
(select
SYSTEMROLEAPPUSERSITE.ID
from
dbo.SYSTEMROLEAPPUSERSITE
where
SYSTEMROLEAPPUSERSITE.SITEID = SITE.ID and
SYSTEMROLEAPPUSERSITE.SYSTEMROLEAPPUSERID = @ID
),
newid()
) as SYSTEMROLEAPPUSERSITEID
from
dbo.SITE
order by
HIERARCHYPATH
for
xml raw('ITEM'),type,elements,root('SITEHIERARCHY'),BINARY BASE64
);
select
@DATALOADED = 1,
@TSLONG = SYSTEMROLEAPPUSER.TSLONG,
@SYSTEMROLEID = SYSTEMROLEAPPUSER.SYSTEMROLEID,
@SECURITYMODECODE = SYSTEMROLEAPPUSER.SECURITYMODECODE,
@SITES = dbo.UFN_SYSTEMROLEAPPUSER_GETSITES_TOITEMLISTXML(SYSTEMROLEAPPUSER.ID),
@BRANCHSITEID = BRANCHSITEID,
@APPUSERSITE = isnull(SITE.NAME, ''),
@CONSTITUENTSECURITYMODECODE = CONSTITUENTSECURITYMODECODE,
@CONSTITUENTSECURITYGROUPS = dbo.UFN_SYSTEMROLEAPPUSER_GETSECURITYGROUPS_TOITEMLISTXML(SYSTEMROLEAPPUSER.ID)
from
dbo.SYSTEMROLEAPPUSER
inner join dbo.APPUSER on APPUSER.ID = SYSTEMROLEAPPUSER.APPUSERID
left outer join dbo.SITE on SITE.ID = APPUSER.SITEID
where
SYSTEMROLEAPPUSER.ID = @ID;
end