private PaginatedList <LayoutData> GetDatasource() { List <LayoutData> allLayouts = LayoutData.GetLayouts(); PagedSearchTemplate <LayoutData> pagedSearch = new PagedSearchTemplate <LayoutData>(); var filterString = this.CurrentFilter; if (CurrentFilterType == FilterType.Search) { Func <LayoutData, bool> searchFilter = (layout) => layout.Name.ContainsIgnoreCase(filterString); pagedSearch.Filters.Add(searchFilter); } else if (CurrentFilterType == FilterType.AlphaFilter) { Func <LayoutData, bool> alphaFilter = null; if (filterString == "[0-9]") { alphaFilter = (layout) => layout.Name.StartsWithNumbers(); } else { alphaFilter = (layout) => layout.Name.StartsWithIgnoreCase(filterString); } pagedSearch.Filters.Add(alphaFilter); } // apply sorting if applicable pagedSearch.Sorter = SortRoutine; var results = pagedSearch.Search(allLayouts, PAGE_SIZE, CurrentPage); return(results); }
private PaginatedList <GridProduct> GetDatasource() { List <GridProduct> allProducts = base.Datasource as List <GridProduct>; PagedSearchTemplate <GridProduct> pagedSearch = new PagedSearchTemplate <GridProduct>(); var filterString = this.CurrentFilter; if (CurrentFilterType.Equals(FilterType.Search)) { Func <GridProduct, bool> searchFilter = (e) => e.LocaleName.ContainsIgnoreCase(filterString); pagedSearch.Filters.Add(searchFilter); } else if (CurrentFilterType.Equals(FilterType.AlphaFilter)) { Func <GridProduct, bool> alphaFilter = null; if (filterString == "[0-9]") { alphaFilter = (e) => e.LocaleName.StartsWithNumbers(); } else { alphaFilter = (e) => e.LocaleName.StartsWithIgnoreCase(filterString); } pagedSearch.Filters.Add(alphaFilter); } // apply sorting if applicable pagedSearch.Sorter = SortRoutine; var results = pagedSearch.Search(allProducts, PAGE_SIZE, CurrentPage); return(results); }
private PaginatedList <Topic> GetDatasource() { List <Topic> allTopics = Topic.GetTopics().Where(t => !t.TopicID.ToString().Equals(ThisTopicID)).ToList(); PagedSearchTemplate <Topic> pagedSearch = new PagedSearchTemplate <Topic>(); String filterString = this.CurrentFilter; if (CurrentFilterType.Equals(FilterType.Search)) { Func <Topic, bool> searchFilter = (t) => t.TopicName.ContainsIgnoreCase(filterString); pagedSearch.Filters.Add(searchFilter); } else if (CurrentFilterType.Equals(FilterType.AlphaFilter)) { Func <Topic, bool> alphaFilter = null; if (filterString == "[0-9]") { alphaFilter = (t) => t.TopicName.StartsWithNumbers(); } else { alphaFilter = (t) => t.TopicName.StartsWithIgnoreCase(filterString); } pagedSearch.Filters.Add(alphaFilter); } // apply sorting if applicable pagedSearch.Sorter = SortRoutine; PaginatedList <Topic> results = pagedSearch.Search(allTopics, PAGE_SIZE, CurrentPage); return(results); }
private PaginatedList <GlobalConfig> GetDatasource() { GlobalConfigCollection allConfigs = AppLogic.GlobalConfigTable; PagedSearchTemplate <GlobalConfig> pagedSearch = new PagedSearchTemplate <GlobalConfig>(); // 0 index is the All, therefore no filter if (cboConfigGroups.SelectedIndex > 0) { string group = cboConfigGroups.SelectedValue; Func <GlobalConfig, bool> groupFilter = (config) => config.GroupName.EqualsIgnoreCase(group); pagedSearch.Filters.Add(groupFilter); } var filterString = this.CurrentFilter; if (CurrentFilterType == FilterType.Search) { Func <GlobalConfig, bool> searchFilter = (config) => config.Name.ContainsIgnoreCase(filterString); pagedSearch.Filters.Add(searchFilter); } else if (CurrentFilterType == FilterType.AlphaFilter) { Func <GlobalConfig, bool> alphaFilter = null; if (filterString == "[0-9]") { alphaFilter = (config) => config.Name.StartsWithNumbers(); } else { alphaFilter = (config) => config.Name.StartsWithIgnoreCase(filterString); } pagedSearch.Filters.Add(alphaFilter); } // apply sorting if applicable pagedSearch.Sorter = SortRoutine; var results = pagedSearch.Search(allConfigs, PAGE_SIZE, CurrentPage); return(results); }
private PaginatedList <GridEntity> GetDatasource() { List <GridEntity> allEntities = (base.Datasource as List <GridEntity>).OrderBy(ent => ent.DisplayOrder).ThenBy(ent => ent.LocaleName).ToList(); var chkShowDeleted = ctrlSearch.FindControl <CheckBox>("chkShowDeleted"); if (chkShowDeleted != null && !chkShowDeleted.Checked) { allEntities = allEntities.Where(e => !e.Deleted).ToList(); } PagedSearchTemplate <GridEntity> pagedSearch = new PagedSearchTemplate <GridEntity>(); var filterString = this.CurrentFilter; if (!String.IsNullOrEmpty(filterString)) { allEntities = allEntities.Where(item => IsFilterSearchMatch(CurrentFilterType, filterString, item, allEntities)).ToList(); } return(pagedSearch.Search(allEntities, PAGE_SIZE, CurrentPage)); }
private PaginatedList <AppConfig> GetDatasource() { List <AppConfig> allConfigs = new List <AppConfig>(); if (Stores.Count > 1) { // 0 index is all stores if (cboStores.SelectedValue.ToNativeInt() == -1) { var defaultConfigs = AppConfigManager.GetAppConfigCollection(0, ThisCustomer.IsAdminSuperUser); allConfigs.AddRange(defaultConfigs); foreach (var store in this.Stores) { var storeConfigs = AppConfigManager.GetAppConfigCollection(store.StoreID, ThisCustomer.IsAdminSuperUser); allConfigs.AddRange(storeConfigs); } } else { // load only configs per the selected store int storeId = cboStores.SelectedValue.ToNativeInt(); var storeConfigs = AppConfigManager.GetAppConfigCollection(storeId, ThisCustomer.IsAdminSuperUser); allConfigs.AddRange(storeConfigs); } } else { var defaultConfigs = AppConfigManager.GetAppConfigCollection(0, ThisCustomer.IsAdminSuperUser); allConfigs.AddRange(defaultConfigs); var defaultStore = Stores[0]; // probably not multi-store var storeConfigs = AppConfigManager.GetAppConfigCollection(defaultStore.StoreID, ThisCustomer.IsAdminSuperUser); allConfigs.AddRange(storeConfigs); } PagedSearchTemplate <AppConfig> pagedSearch = new PagedSearchTemplate <AppConfig>(); // 0 index is the All, therefore no filter if (cboConfigGroups.SelectedIndex > 0) { string group = cboConfigGroups.SelectedValue; Func <AppConfig, bool> groupFilter = (config) => config.GroupName.EqualsIgnoreCase(group); pagedSearch.Filters.Add(groupFilter); } var filterString = this.CurrentFilter; if (CurrentFilterType == FilterType.Search) { Func <AppConfig, bool> searchFilter = (config) => config.Name.ContainsIgnoreCase(filterString) || config.ConfigValue.ContainsIgnoreCase(filterString); pagedSearch.Filters.Add(searchFilter); } else if (CurrentFilterType == FilterType.AlphaFilter) { Func <AppConfig, bool> alphaFilter = null; if (filterString == "[0-9]") { alphaFilter = (config) => config.Name.StartsWithNumbers(); } else { alphaFilter = (config) => config.Name.StartsWithIgnoreCase(filterString); } pagedSearch.Filters.Add(alphaFilter); } // apply sorting if applicable pagedSearch.Sorter = SortRoutine; var results = pagedSearch.Search(allConfigs, PAGE_SIZE, CurrentPage); return(results); }