public static List<SubEntityRecord> GetDropdownValues(ProviderAdminDetailView parent, int providerId)
        {
            IEnumerable<ProviderClinicalInterestDto> existingInterests = new List<ProviderClinicalInterestDto>();
            if (providerId != 0)
                existingInterests = GetProviderClinicalInterests(parent, providerId);

            var request = new ListClinicalInterestsRequest() { IsEnabled = true };
            var clinicalInterests = parent.ProcessRequest<ListClinicalInterestsResponse>(request).ClinicalInterests;
            var records = new List<SubEntityRecord>();

            foreach (var clinicalInterest in clinicalInterests.Where(c => !existingInterests.Any(e => e.ClinicalInterestId == c.Id)))
            {
                var record = new SubEntityRecord();
                record.DisplayName = clinicalInterest.Name;
                record.Id = clinicalInterest.Id;
                record.Fields.Add(new Field(_id, _id, FieldTypes.Hidden, null));
                record.Fields.Add(new Field(_providerId, _providerId, FieldTypes.Hidden, providerId));
                record.Fields.Add(new Field(_clinicalInterestId, _clinicalInterestId, FieldTypes.Hidden, clinicalInterest.Id));
                record.Fields.Add(new Field(_clinicalInterestName, "Clinical Interest Name", FieldTypes.Label, clinicalInterest.Name));

                records.Add(record);
            }

            return records;
        }
        public void list_ClinicalInterests()
        {
            //setup
            var handler = CreateHandler();
            var request = new ListClinicalInterestsRequest();

            //act
            var response = HandleRequest<ListClinicalInterestsResponse>(handler, request);

            //assert
            Assert.AreEqual(response.ClinicalInterests.Count(), 3);
            Assert.AreEqual(response.ClinicalInterests.ElementAt(0).Name, "Brain");
        }
        /// <summary>
        /// Queries the DB using the existing ListProvidersHandler
        /// </summary>
        private ListClinicalInterestsResponse QueryData()
        {
            var listRequest = new ListClinicalInterestsRequest();

            //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<ListClinicalInterestsResponse>(listRequest);
        }
 private void GetClinicalInterests(List<KeyValuePair<object, object>> records)
 {
     var request = new ListClinicalInterestsRequest() { IsEnabled = true };
     var items = _view.ProcessRequest<ListClinicalInterestsResponse>(request).ClinicalInterests;
     foreach (var item in items)
         records.Add(new KeyValuePair<object, object>(item.Name, item.Id));
 }