public string BuildSeoSchemaField(OrgUnitPublishedDto location) { var sb = new StringBuilder(); sb.Append("<div class='SeoSchema' itemscope itemtype='http://schema.org/MedicalOrganization'>"); //Name sb.AppendFormat("<meta itemprop='name' content='{0}' />", CommonUtils.MakeXmlSafeValue(location.Name)); //Job Title (Specialty) sb.AppendFormat("<meta itemprop='description' content='{0}' />", CommonUtils.MakeXmlSafeValue(location.Description)); //Address sb.Append("<div itemprop='address' itemscope itemtype='http://schema.org/PostalAddress'>"); sb.AppendFormat("<meta itemprop='streetAddress' content='{0}' />", CommonUtils.MakeXmlSafeValue(location.Address1)); sb.AppendFormat("<meta itemprop='addressLocality' content='{0}' />", CommonUtils.MakeXmlSafeValue(location.City)); sb.AppendFormat("<meta itemprop='addressRegion' content='{0}' />", CommonUtils.MakeXmlSafeValue(location.StateName)); sb.AppendFormat("<meta itemprop='postalCode' content='{0}' />", CommonUtils.MakeXmlSafeValue(location.PostalCode)); sb.Append("</div>"); //Phone sb.AppendFormat("<meta itemprop='telephone' content='{0}' />", CommonUtils.MakeXmlSafeValue(location.Phone)); //Email sb.AppendFormat("<meta itemprop='email' content='{0}' />", CommonUtils.MakeXmlSafeValue(location.Email)); sb.Append("</div>"); return sb.ToString(); }
public string BuildDetailViewTitleFromFormula(OrgUnitPublishedDto location) { var services = location.Services.Select(s => s.ServiceName).ToArray(); var searchSettings = DataProxy.ProcessRequest<ReadOrgUnitSearchSettingsResponse>(new ReadOrgUnitSearchSettingsRequest()); var formula = searchSettings.DetailPageTitleFormula; var title = formula //Handle Rename from OrgUnit to Location .Replace("{OrgUnitName}", "{" + LocationDetailToken.LocationName.ToString() + "}") .Replace("{OrgUnitAddress}", "{" + LocationDetailToken.LocationAddress.ToString() + "}") .Replace("{OrgUnitCity}", "{" + LocationDetailToken.LocationCity.ToString() + "}") .Replace("{OrgUnitState}", "{" + LocationDetailToken.LocationState.ToString() + "}") .Replace("{OrgUnitStateAbbrev}", "{" + LocationDetailToken.LocationStateAbbrev.ToString() + "}") .Replace("{OrgUnitZip}", "{" + LocationDetailToken.LocationZip.ToString() + "}") .Replace("{OrgUnitServices}", "{" + LocationDetailToken.LocationServices.ToString() + "}") //Replace Token Values .Replace("{" + LocationDetailToken.LocationName.ToString() + "}", location.Name) .Replace("{" + LocationDetailToken.LocationAddress.ToString() + "}", location.Address1) .Replace("{" + LocationDetailToken.LocationCity.ToString() + "}", location.City) .Replace("{" + LocationDetailToken.LocationState.ToString() + "}", location.StateName) .Replace("{" + LocationDetailToken.LocationStateAbbrev.ToString() + "}", GetStateAbbreviation(location)) .Replace("{" + LocationDetailToken.LocationZip.ToString() + "}", location.PostalCode) .Replace("{" + LocationDetailToken.LocationServices.ToString() + "}", string.Join(", ", services)); return ApplyCommonTitleFormatting(title, searchSettings.SeoTitleReplacementValues); }
private string GetStateAbbreviation(OrgUnitPublishedDto location) { if (location.StateId.HasValue) { var request = new ReadCountryRequest() { CountryId = 1 }; var states = DataProxy.ProcessRequest<ReadCountryResponse>(request).Country.States; return states.First(s => s.Id == location.StateId.Value).Abbreviation; } return string.Empty; }
public string PopulateDetailViewSeoData(DetailView viewSettings, OrgUnitPublishedDto location) { return PopulateDetailViewSeoData(viewSettings, location.SeoPageTitle, BuildDetailViewTitleFromFormula(location), location.SeoPageDescription, location.Description, location.SeoH1Tag, location.Name, location.SeoPrimaryKeyword, location.SeoSecondaryKeyword, location.SeoCanonicalUrl); }
private void PopulateSeoData(ModuleInstanceView parent, OrgUnitPublishedDto location, IDictionary<string, string> parameters) { var seoHelper = new SeoHelper(parent, parameters); //SEO Data var seoData = seoHelper.PopulateDetailViewSeoData(_viewSettings, location); parent.ResponseParameters.Add(CommonParameters.SeoData, seoData); //SEO Schema var seoSchema = seoHelper.BuildSeoSchemaField(location); if (!string.IsNullOrEmpty(seoSchema)) parent.ResponseParameters.Add(CommonParameters.SeoSchema, seoSchema); }
private void PopulateFieldData(ModuleInstanceView parent, OrgUnitPublishedDto location, 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 "LocationName": field.Value = location.Name; break; case "LocationDescription": field.Value = location.Description; break; case "LocationCity": field.Value = location.City; break; case "LocationState": field.Value = location.StateName; break; case "LocationPostalCode": field.Value = location.PostalCode; break; case "LocationFax": field.Value = location.Fax; break; case "LocationPhone": field.Value = location.Phone; break; case "LocationAddress": field.Value = location.CompleteAddress; break; case "LocationAddress1": field.Value = location.Address1; break; case "LocationAddress2": field.Value = location.Address2; break; case "LocationImage": if (!string.IsNullOrEmpty(location.ImageUrl)) field.URL = location.ImageUrl; else field.URL = parent.DefaultLocationImageUrl; field.Value = location.Name; break; case "LocationMap": field.Value = "mapDiv_" + location.Id; field.MappingProvider = _mappingSettings.MappingProvider.ToString().ToUpperInvariant(); field.MapItem = new MapItem() { Title = location.Name, Latitude = location.Latitude.HasValue ? location.Latitude.ToString() : string.Empty, Longitude = location.Longitude.HasValue ? location.Longitude.ToString() : string.Empty, LocationAddress = string.Format("{0}, {1}, {2} {3}", location.Address1, location.City, location.StateName, location.PostalCode), LocationPhoneNum = location.Phone }; break; case "Custom1": field.Value = location.Custom1; break; case "Custom2": field.Value = location.Custom2; break; case "Custom3": field.Value = location.Custom3; break; case "ConditionalField": if (string.IsNullOrEmpty(field.ConditionalSettings.ConditionalField) || string.IsNullOrEmpty(field.ConditionalSettings.ConditionalValue) || string.IsNullOrEmpty(field.ConditionalSettings.ConditionOperation)) return; var conditionalField = _viewSettings.AvailableFields.First(f => f.FieldName == field.ConditionalSettings.ConditionalField); PopulateFieldData(parent, location, conditionalField); Field fieldToShow = null; if (!string.IsNullOrEmpty(field.ConditionalSettings.FieldToShow)) { fieldToShow = _viewSettings.AvailableFields.First(f => f.FieldName == field.ConditionalSettings.FieldToShow); PopulateFieldData(parent, location, fieldToShow); } CommonUtils.PopulateConditionalFieldValue(field, conditionalField, fieldToShow); break; } } }