Esempio n. 1
0
        public async Task <PagedQueryResultSet <ConfigurationSettingDto> > GetAsync(ResultSetCriteria gridCriteria, ConfigurationSearchCriteria searchCriteria)
        {
            string key = searchCriteria.Key ?? string.Empty;

            var configurationList = (await _dataContext.GetDocumentsWithPagingAsync <ConfigurationSetting, ConfigurationSettingDto>
                                         (q => q.Where(c =>
                                                       (searchCriteria.Culture == "any" || c.Culture == searchCriteria.Culture) &&
                                                       (searchCriteria.Section == "any" || c.Section == searchCriteria.Section) &&
                                                       (string.IsNullOrEmpty(key) || c.Key.ToLower().Contains(key.ToLower().Trim())))
                                         .Select(c => new ConfigurationSettingDto
            {
                Id = c.Id,
                IsDeleted = c.IsDeleted,
                Culture = c.Culture,
                GroupId = c.GroupId,
                Section = c.Section,
                Key = c.Key,
                IncludeInPod = c.IncludeInPod,
                Priority = c.Priority,
                Value = c.Value,
                ETag = c.ETag,
                UpdatedOnUtc = c.UpdatedOnUtc,
                UpdatedByName = c.UpdatedByName,
                UpdatedById = c.UpdatedById
            }), gridCriteria));

            return(configurationList);
        }
        public async Task <PagedQueryResultSet <LocalisationTextDto> > GetAsync(ResultSetCriteria gridCriteria, ConfigurationSearchCriteria searchCriteria)
        {
            if (string.IsNullOrWhiteSpace(searchCriteria.Key))
            {
                searchCriteria.Key = "";
            }

            var result = await _dataContext.GetDocumentsWithPagingAsync <LocalisationText, LocalisationTextDto>(q =>
                                                                                                                q.Where(d =>
                                                                                                                        (searchCriteria.Culture == "any" || d.Culture == searchCriteria.Culture) &&
                                                                                                                        (searchCriteria.Section == "any" || d.Section == searchCriteria.Section) &&
                                                                                                                        (searchCriteria.Key == "" || d.Key.Contains(searchCriteria.Key.ToUpper().Trim())))
                                                                                                                .Select(c => new LocalisationTextDto
            {
                Id            = c.Id,
                IsDeleted     = c.IsDeleted,
                Culture       = c.Culture,
                GroupId       = c.GroupId,
                Section       = c.Section,
                Key           = c.Key,
                Priority      = c.Priority,
                Value         = c.Value,
                IncludeInPod  = c.IncludeInPod,
                ETag          = c.ETag,
                UpdatedOnUtc  = c.UpdatedOnUtc,
                UpdatedById   = c.UpdatedById,
                UpdatedByName = c.UpdatedByName
            }), gridCriteria);

            return(result);
        }
Esempio n. 3
0
        public async Task <PagedQueryResultSet <LookupDto> > GetLookupListAsync(ResultSetCriteria gridCriteria, ConfigurationSearchCriteria searchCriteria)
        {
            if (string.IsNullOrWhiteSpace(searchCriteria.Key))
            {
                searchCriteria.Key = "";
            }

            var result = await _dataContext.GetDocumentsWithPagingAsync <Lookup, Lookup>(q =>
                                                                                         q.Where(d =>
                                                                                                 (searchCriteria.Culture == "any" || d.Culture == searchCriteria.Culture) &&
                                                                                                 (searchCriteria.Section == "any" || d.Section == searchCriteria.Section) &&
                                                                                                 (searchCriteria.Key == "" || d.Key.Contains(searchCriteria.Key.ToUpper().Trim()))),
                                                                                         gridCriteria);


            var lookupDtoList = result.Results.Select(l => new LookupDto
            {
                Id            = l.Id,
                IsDeleted     = l.IsDeleted,
                Culture       = l.Culture,
                GroupId       = l.GroupId,
                Key           = l.Key,
                IncludeInPod  = l.IncludeInPod,
                Section       = l.Section,
                Priority      = l.Priority,
                UpdatedById   = l.UpdatedById,
                UpdatedByName = l.UpdatedByName,
                UpdatedOnUtc  = l.UpdatedOnUtc,
                ItemValueList = l.Items.OrderBy(i => i.Value).Take(6).Select(item => item.Value)
            }).ToList();

            return(new PagedQueryResultSet <LookupDto> {
                Results = lookupDtoList, ContinuationToken = result.ContinuationToken
            });
        }
        public async Task <PagedQueryResultSet <AlertTemplateDto> > GetAsync(ResultSetCriteria gridCriteria, AlertTemplateSearchCriteria searchCriteria)
        {
            if (string.IsNullOrWhiteSpace(searchCriteria.Key))
            {
                searchCriteria.Key = "";
            }

            var result = await _dataContext.GetDocumentsWithPagingAsync <AlertTemplate, AlertTemplateDto>(q =>
                                                                                                          q.Where(d =>
                                                                                                                  (searchCriteria.Culture == "any" || d.Culture == searchCriteria.Culture) &&
                                                                                                                  (searchCriteria.Section == "any" || d.Section == searchCriteria.Section) &&
                                                                                                                  (searchCriteria.Key == "" || d.Key.Contains(searchCriteria.Key.ToUpper().Trim())) &&
                                                                                                                  (searchCriteria.Channel == "any" || d.Channel == searchCriteria.Channel))
                                                                                                          .Select(c => new AlertTemplateDto
            {
                Id            = c.Id,
                IsDeleted     = c.IsDeleted,
                Culture       = c.Culture,
                GroupId       = c.GroupId,
                Section       = c.Section,
                Key           = c.Key,
                Priority      = c.Priority,
                Channel       = c.Channel,
                ETag          = c.ETag,
                UpdatedOnUtc  = c.UpdatedOnUtc,
                UpdatedById   = c.UpdatedById,
                UpdatedByName = c.UpdatedByName
            }), gridCriteria);

            return(result);
        }
Esempio n. 5
0
        public async Task <PagedQueryResultSet <PermissionConfigDto> > GetAsync(ResultSetCriteria gridCriteria, PermissionSearchCriteria searchCriteria)
        {
            var data = await _dataContext.GetDocumentsWithPagingAsync <PermissionConfig, PermissionConfigDto>(q =>
                                                                                                              q.Where(p => (searchCriteria.Role == "any" || p.Role == searchCriteria.Role))
                                                                                                              .Select(p => new PermissionConfigDto
            {
                GroupId       = p.GroupId,
                Role          = p.Role,
                IsDeleted     = p.IsDeleted,
                Permissions   = p.Permissions,
                Id            = p.Id,
                UpdatedById   = p.UpdatedById,
                UpdatedByName = p.UpdatedByName,
                UpdatedOnUtc  = p.UpdatedOnUtc,
                ETag          = p.ETag
            }), gridCriteria);

            return(data);
        }