Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE PROCEDURE [dbo].[crud_kanbanOrders_getItems]
- @filters CRUDFilterParameter READONLY,
- @sort sql_variant,
- @direction nvarchar(8),
- @page int,
- @pageSize int,
- @username nvarchar(32)
- AS
- BEGIN
- CREATE TABLE dbo.#result (id int, name nvarchar(256), color nvarchar(64) )
- declare @langID int
- select @langID = try_cast(Value as int) from @filters where [Key] = 'langID'
- declare @filterCustomer int
- select @filterCustomer = Value from @filters where [Key] = 'name'
- insert into #result
- SELECT 1, iif(@langID=1, 'small', 'Мелкий'), 'lightGreen'
- union
- SELECT 2, iif(@langID=1, 'medium', 'Средний'), 'lightBlue'
- union
- SELECT 3, iif(@langID=1, 'large', 'Крупный'), 'pink'
- select * from #result
- order by id
- OFFSET @PageSize * (@Page - 1) ROWS
- FETCH NEXT @PageSize ROWS ONLY;
- select count(*) from tst_orders
- drop table #result
- select 'kanban' viewType, -- 'entityOrder' kanbanItemForm, 'Детали заказа' kanbanItemFormTitle,
- iif(@langID=1, 'Kanban Board (orders)', 'Доска Канбан (заказы)') Title
- select id,
- statusID,
- (select name from tst_customers where id = customerID) as name,
- '<div class="small">'+(select name from tst_products where id = productID)+', '+cast(isnull(cnt,0) as nvarchar)+'</div>' [text],
- iif(@langID=1, 'Customer comment:', 'Комментарий заказчика: ') + note tooltip,
- isnull(convert(nvarchar, created, 120),'') bottomText,
- '' customClass
- from tst_orders
- where (isnull(@filterCustomer,0)=0 or customerID = @filterCustomer) and statusID is not null
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement