Пример #1
0
        public static List<Field> PopulateBoardCertificationsFieldData(ModuleInstanceView parent, ProviderSearchResultDto provider, Field templateField)
        {
            var boardCertificationsFields = new List<Field>();
            var request = new ListProviderCertificationSpecialtyRequest() { ProviderId = provider.Id };
            var response = parent.ProcessRequest<ListProviderCertificationSpecialtyResponse>(request);

            foreach (var certification in response.CertificationSpecialties)
            {
                var certificationField = (Field)templateField.Clone();

                foreach (var column in certificationField.FieldColumns)
                {
                    foreach (var field in column.Fields)
                    {
                        switch (field.FieldName)
                        {
                            case "CertificationAgency":
                                field.Value = certification.CertificationAgencyName;
                                break;
                            case "MemberBoard":
                                field.Value = certification.CertificationBoardName;
                                break;
                            case "Specialty":
                                field.Value = certification.CertificationSpecialtyName;
                                break;
                            case "YearofIssuance":
                                field.Value = certification.YearOfIssuance;
                                break;
                        }
                    }
                }

                boardCertificationsFields.Add(certificationField);
            }

            return boardCertificationsFields;
        }
Пример #2
0
        private void PopulateFieldData(ProviderSearchResultDto provider, Field field)
        {
            //Handle Dynamic Column Data
            if (field.FieldName.StartsWith(Constants.DynamicColumnPrefix))
            {
                var dynamicColumnFieldName = field.FieldName.Replace(Constants.DynamicColumnPrefix, string.Empty);
                var dynamicColumn = _dynamicColumnData.FirstOrDefault(c => c.FieldName == dynamicColumnFieldName);
                if (dynamicColumn != null && _dynamicColumnDefinitions.Any(c => c.Name == dynamicColumnFieldName))
                    field.Value = dynamicColumn.FieldValue;
                else
                    field.Value = string.Empty;
            }
            //Handle Standard Column Data
            else
            {
                switch (field.FieldName)
                {
                    case "ProviderNameLink":
                        field.Value = _view.CalculateProviderFullName(provider.NamePrefix, provider.FirstName, provider.MiddleName, provider.LastName, provider.NameSuffix, provider.AdditionalSuffix, field);
                        field.URL = _view.CalculateProviderDetailUrl(provider.DirectUrl, provider.Id, _baseDetailPageUrl);
                        break;
                    case "DateOfBirth":
                        field.Value = provider.DateOfBirth.HasValue ? provider.DateOfBirth.Value.ToString("M/d/yyyy") : string.Empty;
                        break;
                    case "ProviderImage":
                        if (!string.IsNullOrEmpty(provider.ImageUrl))
                            field.URL = provider.ImageUrl;
                        else
                            field.URL = _view.DefaultProviderImageUrl;

                        field.Value = _view.CalculateProviderFullName(provider.NamePrefix, provider.FirstName, provider.MiddleName, provider.LastName, provider.NameSuffix, provider.AdditionalSuffix, field);
                        break;
                    case "InPracticeSince":
                        field.Value = provider.InPracticeSince.HasValue ? provider.DateOfBirth.Value.ToString("M/d/yyyy") : string.Empty;
                        break;
                    case "Age":
                        field.Value = provider.Age;
                        break;
                    case "Experience":
                        field.Value = provider.Experience;
                        break;
                    case "PrimarySpecialty":
                        field.Value = provider.PrimarySpecialtyName;
                        break;
                    case "PrimaryLocationName":
                        field.Value = provider.PrimaryOrgUnitName;
                        break;
                    case "PrimaryLocationCompleteAddress":
                        field.Value = string.Format("{0}<br />{1}, {2} {3}",
                        !string.IsNullOrEmpty(provider.PrimaryOrgUnitAddress2) ? provider.PrimaryOrgUnitAddress1 + "<br />" + provider.PrimaryOrgUnitAddress2 : provider.PrimaryOrgUnitAddress1,
                        provider.PrimaryOrgUnitCity,
                        provider.PrimaryOrgUnitStateAbbreviated,
                        provider.PrimaryOrgUnitPostalCode);
                        break;
                    case "AcceptingNewPatients":
                        if (provider.IsAcceptingNewPatients)
                            field.Value = field.TrueValue;
                        else
                            field.Value = field.FalseValue;
                        break;
                    case "PrimaryPhone":
                        field.Value = provider.Phone;
                        break;
                    case "PrimaryFax":
                        field.Value = provider.Fax;
                        break;
                    case "PrimaryEmail":
                        field.Value = provider.Email;
                        break;
                    case "Gender":
                        field.Value = provider.Gender;
                        break;
                    case "ProviderLanguages":
                        field.Values = provider.ProviderLanguages.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(l => l).Cast<object>().ToList();
                        break;
                    case "ClinicalInterests":
                        field.Values = provider.ProviderClinicalInterests.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(c => c).Cast<object>().ToList();
                        break;
                    case "Specialties":
                        field.Values = provider.SpecialtiesDescription.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(s => s).Cast<object>().ToList();
                        break;
                    case "Insurances":
                        field.Values = provider.ProviderInsurances.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(i => i).Cast<object>().ToList();
                        break;
                    case "AboutMe":
                        field.Value = provider.AboutMe;
                        break;
                    case "PhilosophyOfCare":
                        field.Value = provider.PhilosophyOfCare;
                        break;
                    case "AdditionalInfo":
                        field.Value = provider.AdditionalInformation;
                        break;
                    case "Website":
                        field.Value = provider.Website;
                        break;
                    case "Custom1":
                        field.Value = provider.Custom1;
                        break;
                    case "Custom2":
                        field.Value = provider.Custom2;
                        break;
                    case "Custom3":
                        field.Value = provider.Custom3;
                        break;
                    case "Distance":
                        if (provider.MostProximateLocationDistance.HasValue)
                            field.Value = Decimal.Round((Decimal)provider.MostProximateLocationDistance.Value, 2) + " Miles";
                        else
                            field.Value = null;
                        break;
                    case "ConditionalField":
                        if (string.IsNullOrEmpty(field.ConditionalSettings.ConditionalField) ||
                        string.IsNullOrEmpty(field.ConditionalSettings.ConditionalValue) ||
                        string.IsNullOrEmpty(field.ConditionalSettings.ConditionOperation))
                            return;

                        if (_viewSettings.AvailableFields.Count == 0)
                            BuildAvailableFields();

                        var conditionalField = _viewSettings.AvailableFields.First(f => f.FieldName == field.ConditionalSettings.ConditionalField);
                        PopulateFieldData(provider, conditionalField);

                        Field fieldToShow = null;
                        if (!string.IsNullOrEmpty(field.ConditionalSettings.FieldToShow))
                        {
                            fieldToShow = field.ConditionalSettings.FieldsWithSettings.First(f => f.FieldName == field.ConditionalSettings.FieldToShow);
                            PopulateFieldData(provider, fieldToShow);
                        }

                        CommonUtils.PopulateConditionalFieldValue(field, conditionalField, fieldToShow);

                        break;
                    case "AppointmentRequestLink":
                        if (provider.PrimaryOrgUnitAllowAppointmentRequests)
                        {
                            field.Value = ProviderUtils.GetAppointmentRequestLinkText(field);
                            field.URL = ProviderUtils.GetAppointmentRequestLinkUrl(field, provider.Id, provider.PrimaryOrgUnitId);
                        }
                        else
                        {
                            field.URL = string.Empty;
                            field.Value = string.Empty;
                        }
                        break;
                }
            }
        }
Пример #3
0
        private MapItem BuildMapItem(ProviderSearchResultDto provider, int locationNumber)
        {
            var mapItem = new MapItem()
            {
                Title = provider.FullName,
                LocationNumber = locationNumber,
                LocationName = provider.PrimaryOrgUnitName,
                LocationAddress = string.Format("{0}, {1}, {2} {3}", provider.PrimaryOrgUnitAddress1, provider.PrimaryOrgUnitCity, provider.PrimaryOrgUnitState, provider.PrimaryOrgUnitPostalCode),
                LocationPhoneNum = provider.Phone,
                DirectUrl = _view.CalculateProviderDetailUrl(provider.DirectUrl, provider.Id, _baseDetailPageUrl),
                HasCustomCoordinates = provider.PrimaryOrgUnitHasCustomCoordinates,
                Latitude = provider.PrimaryOrgUnitLatitude.HasValue ? provider.PrimaryOrgUnitLatitude.ToString() : null,
                Longitude = provider.PrimaryOrgUnitLongitude.HasValue ? provider.PrimaryOrgUnitLongitude.ToString() : null,
                ImageUrl = provider.ImageUrl
            };

            return mapItem;
        }
Пример #4
0
 private void MapCustomFields(ProviderSearchResultDto result)
 {
     result.Age = MapAge();
     result.Gender = _provider.Gender != null ? _provider.Gender.Name : null;
     result.Experience = MapExperience();
     result.PrimarySpecialtyName = MapPrimarySpecialty();
     result.SpecialtiesDescription = string.Join(", ", MapSpecialtyNames(SpecialtyType.Specialty, true).ToArray());
     result.SpecialtiesDescriptionLong = string.Join(", ", MapSpecialtyNames(SpecialtyType.Specialty, false).ToArray());
     result.ConditionsDescription = string.Join(", ", MapSpecialtyNames(SpecialtyType.Condition, false).ToArray());
     result.PrimaryOrgUnitName = MapPrimaryOrgUnitName();
     result.PrimaryOrgUnitCity = MapPrimaryOrgUnitCity();
     result.PrimaryOrgUnitState = MapPrimaryOrgUnitState();
     result.PrimaryOrgUnitCompleteAddress = MapPrimaryOrgUnitAddress();
     result.Phone = StringUtils.FormatPhoneNumber(MapPhone()) ?? string.Empty;
     result.Fax = StringUtils.FormatPhoneNumber(MapFax()) ?? string.Empty;
     result.MostProximateLocationName = MapMostProximateLocationName();
     result.MostProximateLocationCompleteAddress = MapMostProximateLocationCompleteAddress();
     result.VideoContent = _provider.VideoContent;
     result.ProviderEducations = MapProviderEducation();
     result.IsAcceptingNewPatients = _provider.ProviderOrgUnits.Any(a => a.IsAcceptingNewPatients);
     result.PatientRating = MapPatientRating();
     result.HasRatingData = result.PatientRating != null;
 }
Пример #5
0
 private void TruncatePhilosophyOfCare(ProviderSearchResultDto result, int philosophyTruncationCount)
 {
     if (philosophyTruncationCount > 0)
     {
         result.PhilosophyOfCareTruncated = TextUtils.TruncateIfOver(_provider.PhilosophyOfCare, philosophyTruncationCount);
         result.IsPhilosophyOfCareTruncated = result.PhilosophyOfCare != null && result.PhilosophyOfCare.Length > result.PhilosophyOfCareTruncated.Length;
     }
 }
Пример #6
0
 private void AssertPhilosophyOfCareTruncated(ProviderSearchResultDto value)
 {
     Assert.IsTrue(value.PhilosophyOfCareTruncated.Length <= _truncateLength);
     Assert.True(value.IsPhilosophyOfCareTruncated);
 }
Пример #7
0
 private void AssertCustomPropertiesMapped(ProviderSearchResultDto value)
 {
     Assert.IsTrue(value.Age.Length >= 0);
     Assert.IsTrue(value.Experience.Length >= 0);
     Assert.IsTrue(value.SpecialtiesDescription.Length >= 0);
 }