private List<GenderDto> GetGenders(ProviderDto providerDto)
 {
     var request = new ListGendersRequest() { IsEnabled = true };
     return ProcessRequest<ListGendersResponse>(request).Genders.ToList();
 }
 private List<ProviderGroupDto> GetProviderGroups(ProviderDto providerDto)
 {
     var request = new ListProviderGroupsRequest() { EnabledOnly = true };
     return ProcessRequest<ListProviderGroupsResponse>(request).ProviderGroups.ToList();
 }
        private List<Field> BuildFields(ProviderDto providerDto, bool newRecord)
        {
            var request = new ReadCustomFieldSettingsRequest();
            var customFieldSettings = ProcessRequest<ReadCustomFieldSettingsResponse>(request).CustomFields;

            var fields = new List<Field>();

            if (!newRecord)
                fields.Add(new Field(_id, "Id", FieldTypes.Label, providerDto.Id));
            else
                fields.Add(new Field(_id, "Id", FieldTypes.Hidden, 0));

            fields.Add(new Field(_externalId, "External Id", FieldTypes.Label, providerDto.ExternalId));
            fields.Add(new Field(_npi, "NPI", FieldTypes.Text, providerDto.Npi) { Focus = true });
            fields.Add(new Field(_isEnabled, "Enabled", FieldTypes.Checkbox, newRecord ? true : providerDto.IsEnabled));
            fields.Add(new Field(_namePrefix, "Prefix", FieldTypes.Text, providerDto.NamePrefix));
            fields.Add(new Field(_firstName, "First Name", FieldTypes.Text, providerDto.FirstName, true));
            fields.Add(new Field(_middleName, "Middle Name", FieldTypes.Text, providerDto.MiddleName));
            fields.Add(new Field(_lastName, "Last Name", FieldTypes.Text, providerDto.LastName, true));
            fields.Add(new Field(_nameSuffix, "Suffix", FieldTypes.Text, providerDto.NameSuffix));
            fields.Add(new Field(_additionalSuffix, "Additional Suffix", FieldTypes.Text, providerDto.AdditionalSuffix));

            if (!DigitalAssetManager.IsImageManagementEnabled())
                fields.Add(new Field(_imageUrl, "Image URL", FieldTypes.URL, providerDto.ImageUrl));

            var genderField = new Field(_gender, "Gender", FieldTypes.Dropdown, providerDto.GenderId);
            foreach (var gender in GetGenders(providerDto))
                genderField.Options.Add(new KeyValuePair<object, object>(gender.Id, gender.Name));
            fields.Add(genderField);

            var providerGroupField = new Field(_providerGroup, "Provider Group", FieldTypes.Dropdown, providerDto.ProviderGroupId);
            foreach (var group in GetProviderGroups(providerDto))
                providerGroupField.Options.Add(new KeyValuePair<object, object>(group.Id, group.Name));
            fields.Add(providerGroupField);

            if (!newRecord)
                fields.Add(new Field(_directUrl, "Direct URL", FieldTypes.Label, providerDto.DirectUrl));

            fields.Add(new Field(_dateOfBirth, "Date of Birth", FieldTypes.DatePicker, providerDto.DateOfBirth));
            fields.Add(new Field(_inPracticeSince, "In Practice Since", FieldTypes.DatePicker, providerDto.InPracticeSince));
            fields.Add(new Field(_email, "Primary Email", FieldTypes.Email, providerDto.Email));
            fields.Add(new Field(_phone, "Primary Phone", FieldTypes.Phone, providerDto.Phone));
            fields.Add(new Field(_fax, "Primary Fax", FieldTypes.Phone, providerDto.Fax));
            fields.Add(new Field(_website, "Primary Website", FieldTypes.WYSIWYG, providerDto.Website, true));
            fields.Add(new Field(_aboutMe, "About Me", FieldTypes.WYSIWYG, providerDto.AboutMe, true));
            fields.Add(new Field(_additionalInfo, "Additional Information", FieldTypes.WYSIWYG, providerDto.AdditionalInformation, true));
            fields.Add(new Field(_philosophyOfCare, "Philosophy Of Care", FieldTypes.WYSIWYG, providerDto.PhilosophyOfCare, true));
            fields.Add(new Field(_videoContent, "Video Content", FieldTypes.WYSIWYG, providerDto.VideoContent, true));
            fields.Add(new Field(_custom1, customFieldSettings.ProviderCustom1Name, FieldTypes.WYSIWYG, providerDto.Custom1, true));
            fields.Add(new Field(_custom2, customFieldSettings.ProviderCustom2Name, FieldTypes.WYSIWYG, providerDto.Custom2, true));
            fields.Add(new Field(_custom3, customFieldSettings.ProviderCustom3Name, FieldTypes.WYSIWYG, providerDto.Custom3, true));
            fields.Add(new Field(_customKeywords, "Custom Keywords", FieldTypes.MultiLineText, providerDto.CustomKeywords) { NumberOfRows = 3 });
            fields.Add(new Field(_keywords, "Generated Keywords", FieldTypes.MultiLineText, providerDto.Keywords) { NumberOfRows = 3, IsDisabled = true });
            fields.Add(new Field(_excludedWords, "Excluded Words", FieldTypes.MultiLineText, providerDto.ExcludedKeywords) { NumberOfRows = 3 });
            fields.Add(new Field(_seoPageTitle, "SEO Page Title", FieldTypes.Text, providerDto.SeoPageTitle));
            fields.Add(new Field(_seoPageDescription, "SEO Page Description", FieldTypes.MultiLineText, providerDto.SeoPageDescription));
            fields.Add(new Field(_seoH1, "SEO H1", FieldTypes.Text, providerDto.SeoH1Tag));
            fields.Add(new Field(_seoPrimaryKeyword, "SEO Primary Keyword", FieldTypes.Text, providerDto.SeoPrimaryKeyword));
            fields.Add(new Field(_seoSecondaryKeyword, "SEO Secondary Keyword", FieldTypes.Text, providerDto.SeoSecondaryKeyword));
            fields.Add(new Field(_seoCanonicalUrl, "SEO Canonical URL", FieldTypes.Text, providerDto.SeoCanonicalUrl));

            fields.AddRange(CommonUtils.BuildDynamicColumnsFields(this, providerDto.DynamicColumnData, Constants.ProviderDynamicColumnEntityId));

            if (!newRecord)
                fields.Add(new Field(_lastUpdated, "Last Updated", FieldTypes.Label, providerDto.UpdatedDate.HasValue ? providerDto.UpdatedDate.Value.ToString("M/d/yy h:mm tt") : null));

            return fields;
        }