public void handles_request()
        {
            //setup
            var request = new ReadProviderProfileRequest();
            request.ProviderId = _providerId;
            var handler = CreateHandler();

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

            //assert
            Assert.IsNotNull(response.Provider);
            Assert.AreEqual(_providerId, response.Provider.Id);
            Assert.IsTrue(response.Provider.IsEnabled);
            Assert.AreEqual("test1", response.Provider.Custom1);
            Assert.AreEqual("test2", response.Provider.Custom2);
            Assert.AreEqual("test3", response.Provider.Custom3);
        }
예제 #2
0
        private string GetProvider(ConvertServiceRequest request)
        {
            var providerId = 0;
            if (request.Parameters.ContainsKey("externalId"))
            {
                providerId = LookupDataEntityMapId(request.Parameters["externalId"], false);
            }
            else if (request.Parameters.ContainsKey("id"))
            {
                if (!int.TryParse(request.Parameters["id"], out providerId))
                    throw new BusinessException("Provider Id must be a valid integer");
            }

            // create the requests
            var profileRequest = new ReadProviderProfileRequest { ProviderId = providerId, BypassCache = true };
            var locationsRequest = new ListProviderOrgUnitsRequest { ProviderId = providerId, BypassCache = true, IncludeExternalIds = true };
            var educationRequest = new ListProviderEducationRequest { ProviderId = providerId, BypassCache = true, IncludeIncomplete = true };
            var languageRequst = new ListProviderLanguagesRequest { ProviderId = providerId, BypassCache = true };
            var clinicalRequest = new ListProviderClinicalInterestRequest { ProviderId = providerId, BypassCache = true };
            var certificationRequest = new ListProviderCertificationSpecialtyRequest { ProviderId = providerId, BypassCache = true };
            var orgUnitAffiliationRequest = new ListProviderOrgUnitAffiliationRequest { ProviderId = providerId, ShowAdminList = true, BypassCache = true };
            var providerTypesRequest = new ListProviderProviderTypeRequest { ProviderId = providerId, BypassCache = true };
            var providerSpecialtiesRequest = new ListProviderSpecialtiesRequest { ProviderId = providerId, BypassCache = true };

            // add the requests to the dispatcher
            var provider = ProcessRequest<ReadProviderProfileResponse>(profileRequest).Provider;
            var locations = ProcessRequest<ListProviderOrgUnitsResponse>(locationsRequest).OrgUnits;
            var educations = ProcessRequest<ListProviderEducationResponse>(educationRequest).Records;
            var languages = ProcessRequest<ListProviderLanguagesResponse>(languageRequst).Languages;
            var clinicalInterests = ProcessRequest<ListProviderClinicalInterestResponse>(clinicalRequest).ClinicalInterests;
            var certifications = ProcessRequest<ListProviderCertificationSpecialtyResponse>(certificationRequest).CertificationSpecialties;
            var orgUnitAffiliations = ProcessRequest<ListProviderOrgUnitAffiliationResponse>(orgUnitAffiliationRequest).Records;
            var providerTypes = ProcessRequest<ListProviderProviderTypeResponse>(providerTypesRequest).ProviderTypes;
            var providerSpecialties = ProcessRequest<ListProviderSpecialtiesResponse>(providerSpecialtiesRequest).ProviderSpecialties;

            var viewModel = new ProviderV2
            {
                ProviderId = provider.Id.ToString(CultureInfo.InvariantCulture),
                Npi = provider.Npi.HasValue ? provider.Npi.Value.ToString(CultureInfo.InvariantCulture) : null,
                NamePrefix = provider.NamePrefix,
                FirstName = provider.FirstName,
                MiddleName = provider.MiddleName,
                LastName = provider.LastName,
                NameSuffix = provider.NameSuffix,
                AdditionalSuffix = provider.AdditionalSuffix,
                Gender = provider.Gender,
                DateOfBirth = provider.DateOfBirth.HasValue ? provider.DateOfBirth.Value.ToString(CultureInfo.InvariantCulture) : string.Empty,
                Phone = provider.Phone,
                Fax = provider.Fax,
                Email = provider.Email,
                Website = provider.Website,
                PhilosophyOfCare = provider.PhilosophyOfCare,
                AdditionalInformation = provider.AdditionalInformation,
                InPracticeSince = provider.InPracticeSince.HasValue ? provider.InPracticeSince.Value.ToString(CultureInfo.InvariantCulture) : string.Empty,
                ProviderGroup = provider.ProviderGroupName,
                PictureId = provider.PictureId == 0 ? null : provider.PictureId.ToString(CultureInfo.InvariantCulture),
                ImageUrl = provider.ImageUrl,
                VideoContent = provider.VideoContent,
                AboutMe = provider.AboutMe,
                IsEnabled = provider.IsEnabled.ToString(CultureInfo.InvariantCulture),
                ProviderExternalId = provider.ProviderExternalId,
                Keywords = provider.Keywords,
                CustomKeywords = provider.CustomKeywords,
                ExcludedKeywords = provider.ExcludedKeywords,
                Custom1 = provider.Custom1,
                Custom2 = provider.Custom2,
                Custom3 = provider.Custom3,
                DynamicColumns = provider.DynamicColumns,

                Specialties = providerSpecialties.Select(s => new ProviderSpecialtyV2
                {
                    SpecialtyName = s.SpecialtyName,
                    IsPrimary = s.IsPrimary.ToString(CultureInfo.InvariantCulture),
                    IsBoardCertified = s.IsBoardCertified.ToString(CultureInfo.InvariantCulture),
                    SpecialtyType = s.SpecialtyType
                }).ToList(),

                Languages = languages.Select(l => new ProviderLanguageV2
                {
                    LanguageName = l.LanguageName,
                    IsFluent = l.IsFluent.ToString(CultureInfo.InvariantCulture),
                    IsPrimary = l.IsPrimary.ToString(CultureInfo.InvariantCulture)
                }).ToList(),

                EducationTypes = educations.Select(e => new ProviderEducationV2
                {
                    EducationTypeName = e.EducationTypeName,
                    YearCompleted = e.YearCompleted,
                    InstitutionName = e.InstitutionName,
                    IsComplete = e.IsCompleted.ToString(CultureInfo.InvariantCulture)
                }).ToList(),

                ClinicalInterests = clinicalInterests.Select(c => new ProviderClinicalInterestV2
                {
                    Name = c.ClinicalInterestName
                }).ToList(),

                OrgUnits = locations.Select(o => new ProviderOrgUnitV2
                {
                    OrgUnitId = o.OrgUnitId.ToString(CultureInfo.InvariantCulture),
                    OrgUnitExternalId = o.OrgUnitExternalId,
                    Phone = o.DisplayPhone,
                    Fax = o.DisplayFax,
                    IsPrimary = o.IsPrimary.ToString(CultureInfo.InvariantCulture),
                    IsAcceptingNewPatients = o.IsAcceptingNewPatients.ToString(CultureInfo.InvariantCulture),
                    ProviderOrgUnitId = o.Id.ToString(CultureInfo.InvariantCulture),
                    Insurances = o.Insurance.Where(i => !i.IsInheritedDisabled).Select(i => new ProviderOrgUnitInsuranceV2
                    {
                        Name = i.InsuranceName
                    }).ToList(),
                    Services = o.Service.Select(s => new ProviderOrgUnitServiceV2
                    {
                        Name = s.ServiceName
                    }).ToList(),
                    Schedules = o.Schedule.Select(s => new ProviderOrgUnitScheduleV2
                    {
                        OpenTime = s.Open,
                        CloseTime = s.Close,
                        DayOfWeek = s.Day
                    }).ToList(),
                    DisabledInheritedInsurances = o.Insurance.Where(i => i.IsInherited && i.IsInheritedDisabled).Select(i => new DisabledInheritedInsuranceV2
                    {
                        Name = i.InsuranceName
                    }).ToList()
                }).ToList(),

                CertificationAgencies = certifications.Select(c => new CertificationAgencyV2
                {
                    AgencyName = c.CertificationAgencyName,
                    CertificationBoards = new CertificationBoardV2[1]{new CertificationBoardV2
                {
                    BoardName = c.CertificationBoardName,
                    CertificationSpecialties = new CertificationSpecialtyV2[1]{new CertificationSpecialtyV2
                    {
                        Name = c.CertificationSpecialtyName,
                        YearOfIssuance = c.YearOfIssuance
                    }}.ToList()
                }}.ToList()
                }).ToList(),

                OrgUnitAffiliations = orgUnitAffiliations.Select(a => new ProviderOrgUnitAffiliationV2
                {
                    OrgUnitId = a.OrgUnitId.ToString(CultureInfo.InvariantCulture),
                    OrgUnitTypeId = a.OrgUnitTypeId.ToString(CultureInfo.InvariantCulture),
                    Service = a.ServiceName
                }).ToList(),

                ProviderTypes = providerTypes.Select(t => new ProviderTypeV2
                {
                    Name = t.ProviderTypeName
                }).ToList()
            };

            return CommonUtils.XmlSerialize(viewModel);
        }
예제 #3
0
        private void BuildPublicSettingsView(ModuleInstanceView parent, IDictionary<string, string> parameters)
        {
            string providerId;

            if (parameters.TryGetValue("ProviderId", out providerId))
            {
                var request = new ReadProviderProfileRequest() { ProviderId = int.Parse(providerId, CultureInfo.InvariantCulture) };
                var provider = parent.ProcessRequest<ReadProviderProfileResponse>(request).Provider;

                DynamicColumnData = provider.DynamicColumns;
                DynamicColumnDefinitions = CommonUtils.GetDynamicColumnInstances(parent, Constants.ProviderDynamicColumnEntityId);

                foreach (var zone in _viewSettings.StaticPageZones.Select(z => z.Value).Union(_viewSettings.DynamicPageZones))
                {
                    foreach (var column in zone.FieldColumns)
                    {
                        List<Field> locationsFieldList = null;
                        List<Field> eductaionsFieldList = null;
                        List<Field> boardCertificationsFieldList = null;

                        foreach (var field in column.Fields)
                        {
                            if (field.FieldName == "Locations")
                            {
                                locationsFieldList = PopulateLocationsFieldData(parent, provider, field);
                                field.FieldName = "ReplacedLocations";
                            }
                            else if (field.FieldName == "Educations")
                            {
                                eductaionsFieldList = PopulateEducationsFieldData(parent, provider, field);
                                field.FieldName = "ReplacedEducations";
                            }
                            else if (field.FieldName == "BoardCertification")
                            {
                                boardCertificationsFieldList = ProviderModuleUtils.PopulateBoardCertificationsFieldData(parent, provider, field);
                                field.FieldName = "ReplacedBoardCertifications";
                            }
                            else
                            {
                                PopulateFieldData(parent, provider, field);
                            }
                        }

                        //Replace Locations Complex Field with correct field list
                        SetComplexFieldValues(column, locationsFieldList, eductaionsFieldList, boardCertificationsFieldList);
                    }
                }

                // Add SEO data to response
                PopulateSeoData(parent, provider, parameters);
            }
        }
 /// <summary>
 /// Equalses the specified other.
 /// </summary>
 /// <param name="other">The other.</param>
 /// <returns></returns>
 public bool Equals(ReadProviderProfileRequest other)
 {
     return base.Equals(other) && ProviderId == other.ProviderId;
 }