Advertisement
hecrus

Untitled

Jul 11th, 2020
519
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.49 KB | None | 0 0
  1. CREATE PROCEDURE [dbo].[list_projects_getItem]
  2. @itemID int,
  3. @username nvarchar(32),
  4. @parameters DictionaryParameter READONLY
  5. AS
  6. BEGIN
  7.  
  8. declare @langID int
  9. select @langID = try_cast(value as int) from @parameters where [key] = 'langID'
  10.  
  11. if isnull(@langID,0)=0 set @langID = 2
  12.  
  13. select port.id,
  14. isnull(lang.title,port.title) as name,
  15. 0 price,
  16. iif(isnull(lang.task, port.task)<>'', '<h2>'+iif(@langID=1, 'Initial task', 'Начальная задача')+'</h2>'+ isnull(lang.task, port.task), '') +
  17. iif(isnull(lang.solution, port.solution)<>'', '<h2>'+iif(@langID=1, 'Solution', 'Решение')+'</h2>'+ isnull(lang.solution, port.solution), '') +
  18. iif(isnull(lang.answers, port.answers)<>'', '<h2>'+iif(@langID=1, 'Customer response', 'Отклик заказчика')+'</h2>'+ isnull(lang.answers, port.answers), '') [desc],
  19. '' List1Makeup,
  20. '<h3>{p1}</h3><div class="mb-3">{p2}</div>' List2Makeup,
  21. '' List3Makeup,
  22. '' List4Makeup,
  23. '' List5Makeup,
  24. isnull(lang.title,port.title) + ' - FALCON' + iif(@langID=1, ' Project', ' Проект') SeoTitle,
  25. dbo.[as_stripHTML](isnull(lang.task,port.task)) + ' - FALCON' + iif(@langID=1, ' Project', ' Проект') SeoDescription,
  26. dbo.[as_stripHTML](isnull(lang.task,port.task)) + ' - FALCON' + iif(@langID=1, ' Project', ' Проект') SeoKeywords,
  27. iif(@langID=1, 'Falcon Space Projects', 'Проекты Falcon Space') BreadcrumbRootTitle
  28.  
  29. from as_falconPortfolio port
  30. left join as_lang_portfolio lang on lang.portfolioID = port.id and lang.langID = @langID
  31. where port.id = @itemID
  32.  
  33.  
  34. -- Определяем цепочку категорий
  35. declare @level int
  36. CREATE TABLE dbo.#cats (id int, code nvarchar(256), title nvarchar(256))
  37.  
  38. insert into #cats
  39. select id, code, title
  40. from as_falconPortfolioCategories
  41. where id = (select catID from as_falconPortfolioItemCategories where itemID = @itemID)
  42.  
  43. -- SELECT 2 Cats chain
  44. select * from #cats
  45. drop table #cats
  46.  
  47. --SELECT 3 ItemParams - Атрибуты (Структура ID, Name, Code, Value, ItemID)
  48. select 2 as ID, 'Картинка' as Name, 'image' as Code, dbo.rs_resourceLink('falconPortfolio',try_cast(id as nvarchar),0) as value, id as ItemID from as_falconPortfolio where id = @itemID
  49. union
  50. select 3 as ID, 'Ссылка' as Name, 'projectUrl' as Code, iif(isnull(url,'')<>'', '<a href="'+url+'" class="btn btn-outline-primary btn-sm ml-2 mb-2" target="_blank"><i class="fa fa-link"></i> '+url+'</a>', '') as value, id as ItemID from as_falconPortfolio where id = @itemID
  51. union
  52. select 3 as ID, 'Айди' as Name, 'itemID' as Code, try_cast(id as nvarchar) as value, id as ItemID from as_falconPortfolio where id = @itemID
  53. union
  54. select 3 as ID, 'cta' as Name, 'cta' as Code, dbo.as_htmlBlockLang('cta',@langID) as value, 0 as ItemID
  55.  
  56.  
  57. --select 1 as ID, 'Фото' as Name, 'photo1' as Code, '<div class="as-resourceManager" data-code="listItemImagetest" data-itemID="'+(select isnull(username,'') from ctr_contacts where id = contactID)+'" data-hideTitle="1"></div>' as value, id as itemID from au_suppliers where id = @itemID
  58. --union
  59. --select 2 as ID, 'Оценка' as Name, 'mark' as Code,'12344' value, id as itemID from au_suppliers where id = @itemID
  60.  
  61. -- SELECT 4-9
  62. -- Категории услуг и расценки
  63. --select '111' p1, '22' p2, '22' p3, '22' p4, '22' p5
  64.  
  65. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement