Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE PROCEDURE [dbo].[tree_tst-catalog_getItems]
- @parameters DictionaryParameter READONLY,
- @username nvarchar(128 )='',
- @itemID nvarchar(128)=''
- as
- begin
- declare @langID int
- select @langID = try_cast(Value as int) from @parameters where [Key] = 'langID'
- -- SELECT 1
- select 1 Result, '' Msg,
- 1 CanRename, 1 CanAdd, 1 canDelete,
- '' PlusIcon, '' MinusIcon, 0 ShowIcon, 1 ShowTags,
- '0' ParentIDRootValue,
- '' EmptyIcon,
- '' NodeIcon
- -- SELECT 2
- select c.id Id,
- c.name as title,
- isnull(c.parentID, 0) ParentID,
- c.ord Ord,
- '' Icon, -- fa fa-cube
- 'form' [Type], -- // form, redirect, refreshContainer
- '<a class="as-form-modal" data-code="tst-editCategory" data-itemid="'+cast(c.id as nvarchar)+'" href="#" data-btntext="'+iif(@langID=1, 'Save', 'Сохранить')+'" data-big="0" data-title="'+c.name+'" data-slideout="1"><i class="fas fa-edit"></i></a>' Value,
- --'refreshContainer' [Type],
- --'body' Value,
- 0 Expanded,
- 0 Selected,
- 'fa fa-stop' selectedIcon,
- '#555' color,
- '#eee' backColor,
- '#' href,
- 1 selectable,
- case when (select count(*) from tst_categoryProducts where categoryID = c.id) > 0
- then '<span class="text-danger font-weight-bold">'+cast((select count(*) from tst_categoryProducts where categoryID = c.id) as nvarchar) + ' '+iif(@langID=1, 'cnt', 'тов.')+'</span>'
- else '<span class="text-secondary font-weight-bold">'+cast((select count(*) from tst_categoryProducts where categoryID = c.id) as nvarchar) + ' '+iif(@langID=1, 'cnt', 'тов.')+'</span>'
- end + '|' +
- case when (select count(*) from tst_categories c1 where c1.parentID = c.id) > 3
- then '+'+cast((select count(*) from tst_categories c1 where c1.parentID = c.id)-3 as nvarchar)+'...'
- else '' end + '|' +
- isnull(STUFF((SELECT top 3 '|' + CAST(name as nvarchar(64)) as [text()]
- FROM tst_categories c1 WHERE c1.parentID = c.id ORDER BY c1.ord
- FOR XML PATH(''), TYPE).value('.', 'VARCHAR(MAX)'), 1, 1, ''), '') AS info
- from tst_categories c
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement