예제 #1
0
        private string LoadDropdownValues(ModuleInstanceView parent, IDictionary<string, string> parameters)
        {
            List<DropdownOption> records = new List<DropdownOption>();

            // Get location context settings
            var locationId = LocationContextHelper.ResolveLocationContext(parent, _viewSettings, parameters).Id;
            var descendantOption = LocationContextHelper.ResolveLocationDescendantOption(_viewSettings, parameters);

            var comboBoxRequest = new PopulateProviderComboBoxRequest() { OrgUnitId = locationId, DescendantOption = descendantOption };
            var comboBoxResponse = new PopulateProviderComboBoxResponse();

            switch (parameters["FieldName"])
            {
                case "Provider":
                    comboBoxRequest.ProviderName = parameters["Search"];
                    comboBoxResponse = parent.ProcessRequest<PopulateProviderComboBoxResponse>(comboBoxRequest);
                    foreach (var provider in comboBoxResponse.Results)
                    {
                        records.Add(new DropdownOption
                        {
                            DisplayName = provider.FullName,
                            Id = provider.Id
                        });
                    }
                    break;
                case "Specialty":
                    comboBoxRequest.IncludeSpecialtiesInResults = true;
                    comboBoxRequest.SpecialtyName = parameters["Search"];
                    comboBoxResponse = parent.ProcessRequest<PopulateProviderComboBoxResponse>(comboBoxRequest);
                    foreach (var specialty in comboBoxResponse.Specialties)
                    {
                        records.Add(new DropdownOption
                        {
                            DisplayName = specialty.SpecialtyName,
                            Id = specialty.SpecialtyId
                        });
                    }
                    break;
                case "Condition":
                    comboBoxRequest.IncludeConditionsInResults = true;
                    comboBoxRequest.ConditionName = parameters["Search"];
                    comboBoxResponse = parent.ProcessRequest<PopulateProviderComboBoxResponse>(comboBoxRequest);
                    foreach (var condition in comboBoxResponse.Conditions)
                    {
                        records.Add(new DropdownOption
                        {
                            DisplayName = condition.SpecialtyName,
                            Id = condition.SpecialtyId
                        });
                    }
                    break;
                case "Insurance":
                    comboBoxRequest.IncludeInsurancesInResults = true;
                    comboBoxRequest.InsuranceName = parameters["Search"];
                    comboBoxResponse = parent.ProcessRequest<PopulateProviderComboBoxResponse>(comboBoxRequest);
                    foreach (var insurance in comboBoxResponse.Insurances)
                    {
                        records.Add(new DropdownOption
                        {
                            DisplayName = insurance.Name,
                            Id = insurance.Id
                        });
                    }
                    break;
                case "Language":
                    comboBoxRequest.IncludeLanguagesInResults = true;
                    comboBoxRequest.LanguageName = parameters["Search"];
                    comboBoxResponse = parent.ProcessRequest<PopulateProviderComboBoxResponse>(comboBoxRequest);
                    foreach (var language in comboBoxResponse.Languages)
                    {
                        records.Add(new DropdownOption
                        {
                            DisplayName = language.LanguageName,
                            Id = language.LanguageId
                        });
                    }
                    break;
                case "Location":
                    comboBoxRequest.IncludeLocationsInResults = true;
                    comboBoxRequest.LocationName = parameters["Search"];
                    comboBoxResponse = parent.ProcessRequest<PopulateProviderComboBoxResponse>(comboBoxRequest);
                    foreach (var location in comboBoxResponse.Locations)
                    {
                        records.Add(new DropdownOption
                        {
                            DisplayName = location.OrgUnitName,
                            Id = location.OrgUnitId
                        });
                    }
                    break;
                case "City":
                    comboBoxRequest.IncludeCitiesInResults = true;
                    comboBoxRequest.City = parameters["Search"];
                    comboBoxResponse = parent.ProcessRequest<PopulateProviderComboBoxResponse>(comboBoxRequest);
                    foreach (var city in comboBoxResponse.Cities)
                    {
                        records.Add(new DropdownOption
                        {
                            DisplayName = city,
                            Id = city
                        });
                    }
                    break;
                case "State":
                    comboBoxRequest.IncludeStateInResults = true;
                    comboBoxRequest.State = parameters["Search"];
                    comboBoxResponse = parent.ProcessRequest<PopulateProviderComboBoxResponse>(comboBoxRequest);
                    foreach (var state in comboBoxResponse.States)
                    {
                        records.Add(new DropdownOption
                        {
                            DisplayName = state,
                            Id = state
                        });
                    }
                    break;
                case "ClinicalInterest":
                    comboBoxRequest.IncludeClinicalInterestsInResults = true;
                    comboBoxRequest.ClinicalInterestName = parameters["Search"];
                    comboBoxResponse = parent.ProcessRequest<PopulateProviderComboBoxResponse>(comboBoxRequest);
                    foreach (var interest in comboBoxResponse.ClinicalInterests)
                    {
                        records.Add(new DropdownOption
                        {
                            DisplayName = interest.ClinicalInterestName,
                            Id = interest.ClinicalInterestId
                        });
                    }
                    break;
                case "ProviderType":
                    comboBoxRequest.IncludeProviderTypesInResults = true;
                    comboBoxRequest.ProviderTypeName = parameters["Search"];
                    comboBoxResponse = parent.ProcessRequest<PopulateProviderComboBoxResponse>(comboBoxRequest);
                    foreach (var type in comboBoxResponse.ProviderTypes)
                    {
                        records.Add(new DropdownOption
                        {
                            DisplayName = type.Name,
                            Id = type.Id
                        });
                    }
                    break;
            }

            return CommonUtils.JsonSerialize(records);
        }
 /// <summary>
 /// Determines whether the specified <see cref="PopulateProviderComboBoxRequest" /> is equal to this instance.
 /// </summary>
 /// <param name="other">The other.</param>
 /// <returns></returns>
 public bool Equals(PopulateProviderComboBoxRequest other)
 {
     return base.Equals(other) &&
         IncludeInsurancesInResults == other.IncludeInsurancesInResults &&
         IncludeSpecialtiesInResults == other.IncludeSpecialtiesInResults &&
         IncludeSubSpecialtiesInResults == other.IncludeSubSpecialtiesInResults &&
         IncludeConditionsInResults == other.IncludeConditionsInResults &&
         IncludeSubConditionsInResults == other.IncludeSubConditionsInResults &&
         IncludeLanguagesInResults == other.IncludeLanguagesInResults &&
         IncludeClinicalInterestsInResults == other.IncludeClinicalInterestsInResults &&
         IncludeProviderTypesInResults == other.IncludeProviderTypesInResults &&
         IncludeCitiesInResults == other.IncludeCitiesInResults &&
         IncludeStateInResults == other.IncludeStateInResults &&
         IncludeLocationsInResults == other.IncludeLocationsInResults &&
         IncludeAffiliationsInResults == other.IncludeAffiliationsInResults &&
         string.Equals(FilterCityByState, other.FilterCityByState, System.StringComparison.OrdinalIgnoreCase) &&
         string.Equals(FIlterStateByCity, other.FIlterStateByCity, System.StringComparison.OrdinalIgnoreCase) &&
         RandomizeQuickSearchProviders == other.RandomizeQuickSearchProviders;
 }