Beispiel #1
0
        public string BuildListViewTitleFromFormula(ListView viewSettings, ProviderSearchSettings searchSettings)
        {
            string formula = string.Empty;
            if (Parameters.ContainsKey("ProviderText"))
                formula = searchSettings.SearchResultsPageTitleNameFormula;
            else if (Parameters.ContainsKey("Keyword"))
                formula = searchSettings.SearchResultsPageTitleKeywordFormula;
            else if (Parameters.ContainsKey("SpecialtyText"))
                formula = searchSettings.SearchResultsPageTitleSpecialtyFormula;
            else
                formula = searchSettings.SearchResultsPageTitleBaseFormula;

            var title = formula
                .Replace("{" + ProviderSearchResultsToken.ProviderNameSearched.ToString() + "}", Parameters.ContainsKey("ProviderText") ? Parameters["ProviderText"] : string.Empty)
                .Replace("{" + ProviderSearchResultsToken.SpecialtySearched.ToString() + "}", Parameters.ContainsKey("SpecialtyText") ? Parameters["SpecialtyText"] : string.Empty)
                .Replace("{" + ProviderSearchResultsToken.KeywordSearched.ToString() + "}", Parameters.ContainsKey("Keyword") ? Parameters["Keyword"] : string.Empty)
                .Replace("{" + ProviderSearchResultsToken.PageNum.ToString() + "}", (viewSettings.PageNumber == 0 ? 1 : viewSettings.PageNumber).ToString(CultureInfo.InvariantCulture));

            return ApplyCommonTitleFormatting(title, searchSettings.SeoTitleReplacementValues);
        }
        public string GetModel(ConvertServiceRequest request)
        {
            _locationContext = ResolveLocationContext(request);

            if (!string.IsNullOrEmpty(request.Data))
                _viewModel = CommonUtils.JsonDeserialize<AdminSettingsViewModel>(request.Data);
            else
                CreateInitialViewModel();

            // Handle special commands
            var command = request.Parameters.ContainsKey("Command") ? request.Parameters["Command"] : null;

            if (command == "InheritSettings")
            {
                InheritSettings(_locationContext.Id, "Providers");
                _viewModel.SetSuccessMessage("Settings Successfully Inherited");
            }
            else if (command == "RefreshSiteSearchIndex")
            {
                ProcessOneWayRequest(new UpdateAllProvidersG2RecordRequest());
                _viewModel.SetSuccessMessage("The Site Search index is being updated in the background. Changes should become visible within a few minutes.");
                return CommonUtils.JsonSerialize(_viewModel);
            }

            // Load latest settings
            _searchSettings = ProcessRequest<ReadSearchSettingsResponse>(new ReadSearchSettingsRequest() { OrgUnitContextId = _locationContext.Id }).Settings;

            // Handle settings save request
            if (!string.IsNullOrEmpty(request.Data) && string.IsNullOrEmpty(command))
            {
                Save();
                _viewModel.SetSuccessMessage("Settings Successfully Saved");
            }

            LoadPage(request);

            return CommonUtils.JsonSerialize(_viewModel);
        }