Пример #1
0
        private SearchView BuildPublicSettingsView(ModuleInstanceView parent, SearchView settingsData, IDictionary<string, string> parameters)
        {
            // Establish correct search results page URL
            settingsData.UpdateSettingValue("SearchResultsPageUrl", ProviderUtils.CalculateSearchResultsUrl(settingsData, parent.SearchSettings.SearchResultsPageUrl));

            // Handle pre-filled drop-down controls
            foreach (var zone in settingsData.StaticPageZones.Select(z => z.Value).Union(settingsData.DynamicPageZones))
            {
                foreach (var column in zone.FieldColumns)
                {
                    foreach (var field in column.Fields)
                    {
                        if (field.FieldName == "RadiusDistance")
                        {
                            field.Value = "";
                            field.Options.Clear();
                            field.Options.Add(new KeyValuePair<object, object>("", "Any"));
                            field.Options.AddRange(parent.SearchSettings.SearchRadiusOptions.Select(s => new KeyValuePair<object, object>(s, s)).ToList());
                        }
                        if (field.FieldName == "Gender")
                        {
                            field.Value = "";
                            field.Options.Clear();
                            field.Options.Add(new KeyValuePair<object, object>("", "Any"));
                            var genderNameRequest = new ListGendersRequest() { IsEnabled = true };
                            var genderNameResponse = parent.ProcessRequest<ListGendersResponse>(genderNameRequest);
                            foreach (var gender in genderNameResponse.Genders)
                                field.Options.Add(new KeyValuePair<object, object>(gender.Id, gender.Name));
                        }

                        PreloadQueryValuesFromQueryString(field, parameters);
                    }
                }
            }
            return settingsData;
        }
 private List<GenderDto> GetGenders(ProviderDto providerDto)
 {
     var request = new ListGendersRequest() { IsEnabled = true };
     return ProcessRequest<ListGendersResponse>(request).Genders.ToList();
 }
Пример #3
0
 private void GetGender(List<KeyValuePair<object, object>> records)
 {
     var request = new ListGendersRequest() { IsEnabled = true };
     var items = _view.ProcessRequest<ListGendersResponse>(request).Genders;
     foreach (var item in items)
         records.Add(new KeyValuePair<object, object>(item.Name, item.Id));
 }
Пример #4
0
        /// <summary>
        /// Queries the DB using the existing ListProvidersHandler
        /// </summary>
        private ListGendersResponse QueryData()
        {
            var listRequest = new ListGendersRequest();

            //Paging
            listRequest.PageSize = _viewModel.PageSize;
            listRequest.RequestedPage = _viewModel.PageNumber;

            //Sorting
            if (!string.IsNullOrEmpty(_viewModel.SortColumn))
            {
                listRequest.SortField = _viewModel.SortColumn;
                listRequest.SortDirection = _viewModel.SortDirection.ToLowerInvariant() == "asc" ? "Ascending" : "Descending";
            }

            var enabledFilterValue = string.IsNullOrEmpty(_viewModel.FilterFields.Single(f => f.FieldName == "Enabled").FieldValue) ? string.Empty : _viewModel.FilterFields.Single(f => f.FieldName == "Enabled").FieldValue;
            if (!string.IsNullOrEmpty(enabledFilterValue) && enabledFilterValue != "All")
                listRequest.IsEnabled = enabledFilterValue == "Enabled";

            return ProcessRequest<ListGendersResponse>(listRequest);
        }