Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE PROCEDURE [dbo].[crud_tst-calendar_getItems]
- @filters CRUDFilterParameter READONLY,
- @sort sql_variant,
- @direction nvarchar(8),
- @page int,
- @pageSize int,
- @username nvarchar(32)
- AS
- BEGIN
- declare @langID int
- select @langID = try_cast(Value as int) from @filters where [Key] = 'langID'
- declare @result TABLE (itemID int, title nvarchar(256), start nvarchar(64), [end] nvarchar(64),
- color nvarchar(64), textColor nvarchar(64), borderColor nvarchar(64),
- url nvarchar(256), className nvarchar(128), allDay bit, rendering nvarchar(128),
- formCode nvarchar(128), formBig bit, formTitle nvarchar(128), formBtnText nvarchar(128), formSlideout bit
- )
- insert into @result
- --'2020-05-28T07:19:00' convert(nvarchar, start, 120)
- select id itemID, title title, convert(nvarchar, start, 120) start, convert(nvarchar, [end], 120) [end], isnull((select color from as_eventTypes where id=typeID),'#5f3') color, '' textColor, '' borderColor,
- url url, '' className, allDay allDay, '' rendering, 'editEvent' formCode, 0 formBig, iif(@langID=1, 'Change event', 'Изменить событие') formTitle, iif(@langID=1, 'Save', 'Сохранить') formBtnText, 1 formSlideout
- from as_events
- where username = @username
- -- 1 SELECT - сами данные
- select * from @result
- -- 2 SELECT - кол-во в таблице
- select count(*) from @result
- select 'calendar' ViewType,
- '{
- "defaultView": "timeGridWeek",
- "firstDay":1,
- "defaultDate": "2020-05-28",
- "droppable": true,
- "editable": true,
- "locale": "'+iif(@langID=1, 'en', 'ru')+'",
- "rerenderDelay": 30,
- "timeZone": "UTC",
- "displayEventTime": true,
- "height": "parent",
- "header": {
- "left": "title",
- "center": "dayGridMonth,timeGridWeek,timeGridDay,list",
- "right": "prev,next today myCustomButton"
- },
- "formCreate": {
- "itemID":"0", "code" : "newEvent", "big": 0, "title": "'+iif(@langID=1, 'New event','Новое событие')+'", "btnText":"Создать", "slideout":1
- },
- "remove":1
- }' calendarOptions,
- 1 hideTitleCount
- -- 4 SELECT Данные для подвала страницы или данные для Ганта/Канбана (если установлен ViewType в 3 SELECT)
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement