Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE PROCEDURE [dbo].[crud_testMap_getItems]
- @filters CRUDFilterParameter READONLY,
- @sort sql_variant,
- @direction nvarchar(8),
- @page int,
- @pageSize int,
- @username nvarchar(32)
- AS
- BEGIN
- declare @result TABLE (id int, lat nvarchar(32), lng nvarchar(32), description nvarchar(max), tooltip nvarchar(128), radius int, canDrag bit)
- declare @langID int
- select @langID = try_cast(Value as int) from @filters where [Key] = 'langID'
- declare @filterCity int
- select @filterCity = Value from @filters where [Key] = 'tooltip'
- insert into @result
- select id,
- lat,
- lng,
- iif(@langID=1, 'There may be a form with detailed data for a point', 'Здесь может быть форма с детальными данными по точке') description,
- address as tooltip,
- 500 radius,
- 1 canDrag
- from tst_addresses
- where isnull(@filterCity,0)=0 or address like '%'+(select name from as_geo_regions where id = @filterCity)+'%'
- /*
- insert into @result
- select 1 id,
- '43.5868685' lat,
- '39.7299474' lng,
- '<div class="as-form" data-code="captureContact"></div>' description,
- 'Подсказка для элемента' tooltip,
- 500 radius,
- 0 canDrag
- insert into @result
- select 2 id,
- '42.5868685' lat,
- '39.1299474' lng,
- 'Вторая точка' description,
- 'Подсказка для второй точки' tooltip,
- 500 radius,
- 0 canDrag
- insert into @result
- select 3 id,
- '55.753960' lat,
- '37.620393' lng,
- 'Еще одна точка' description,
- 'Подсказка для этой точки' tooltip,
- 500 radius,
- 0 canDrag
- */
- -- 1 SELECT - сами данные
- select * from @result
- order by radius
- OFFSET @PageSize * (@Page - 1) ROWS
- FETCH NEXT @PageSize ROWS ONLY;
- -- 2 SELECT - кол-во в таблице
- select count(*) from @result
- declare @isAdmin int = 0
- select @isAdmin = 1 from sec_getUserRoles(@username) where role = 'admin'
- -- 3 SELECT Дополнительные настройки таблицы
- Select 'map' ViewType,
- 1 MapShowUserLocation,
- '/Controls/Resource/GetFile?code=userPhoto&user='+@username+'&thumb=1' MapUserImageUrl,
- 1 MapShowAllRegions,
- 1 MapShowLocationInRange,
- '{
- "fitBound": 1,
- "zoom":9,
- "mapCenter": {"lat":55.760533, "lng": 37.487028}
- }' MapOptions,
- iif(@langID=1, 'Map with points', 'Вывод точек на карте') title,
- iif(@langID=1, 'An example of a map display with some points found, each point has the ability to place a shape or some kind of description', 'Пример вывода карты с некоторыми найденными точками, у каждой точки есть возможность разместить форму или некое описание') titleTooltip,
- case when isnull(@isAdmin,0)=0 then '' else '<a href="/tst-addAddress" class="btn btn-primary mb-1"><i class="fas fa-plus"></i> '+iif(@langID=1, 'Add point', 'Добавить точку')+'</a>' end as ToolbarAdditional,
- 1 InstantFilter
- -- 4 SELECT Данные для подвала страницы или данные для Ганта/Канбана (если установлен ViewType в 3 SELECT)
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement