Пример #1
0
        public string BuildDetailViewTitleFromFormula(EventDetailDto eventDetail)
        {
            var searchSettings = DataProxy.ProcessRequest<ReadEventSearchSettingsResponse>(new ReadEventSearchSettingsRequest());
            var formula = searchSettings.DetailPageTitle;

            var title = formula
                .Replace("{" + EventDetailToken.EventTitle.ToString() + "}", eventDetail.Title)
                .Replace("{" + EventDetailToken.EventTopics.ToString() + "}", string.Join(",", eventDetail.EventTopicNames))
                .Replace("{" + EventDetailToken.EventTypes.ToString() + "}", string.Join(",", eventDetail.EventTypeNames));

            return ApplyCommonTitleFormatting(title, searchSettings.SeoTitleReplacementValues);
        }
Пример #2
0
 public string PopulateDetailViewSeoData(DetailView viewSettings, EventDetailDto eventDetail)
 {
     return PopulateDetailViewSeoData(viewSettings, eventDetail.SeoPageTitle, BuildDetailViewTitleFromFormula(eventDetail), eventDetail.SeoPageDescription, eventDetail.SummaryDescription, eventDetail.SeoH1Tag, eventDetail.Title, eventDetail.SeoPrimaryKeyword, eventDetail.SeoSecondaryKeyword, eventDetail.SeoCanonicalUrl);
 }
Пример #3
0
        private List<Field> PopulateOccurrencesFieldData(ModuleInstanceView parent, EventDetailDto eventDetail, Field templateField, IDictionary<string, string> parameters)
        {
            var locationsFields = new List<Field>();
            var request = new ListAvailableEventOccurrencesRequest() { EventId = int.Parse(eventDetail.Id) };
            var response = parent.ProcessRequest<ListAvailableEventOccurrencesResponse>(request);
            var seoHelper = new SeoHelper(parent, parameters);

            foreach (var occurrence in response.EventOccurrences)
            {
                var occurrenceField = (Field)templateField.Clone();

                if (string.IsNullOrEmpty(_viewSettings.SeoSchema))
                    _viewSettings.SeoSchema = seoHelper.BuildSeoSchemaField(occurrence);

                foreach (var column in occurrenceField.FieldColumns)
                {
                    foreach (var field in column.Fields)
                    {
                        switch (field.FieldName)
                        {
                            case "LocationName":
                                field.Value = occurrence.EffectiveLocationName;
                                break;
                            case "LocationAddress":
                                field.Value = occurrence.EffectiveCompleteAddress;
                                break;
                            case "Presenter":
                                field.Value = occurrence.Presenter;
                                break;
                            case "ContactName":
                                field.Value = occurrence.EffectiveContactName;
                                break;
                            case "ContactPhone":
                                var sb = new StringBuilder();
                                sb.Append(occurrence.EffectiveContactPhone);
                                if (!string.IsNullOrEmpty(occurrence.EffectiveContactPhoneExtension))
                                    sb.Append(" ext. " + occurrence.EffectiveContactPhoneExtension);
                                field.Value = sb.ToString();
                                break;
                            case "ContactEmail":
                                field.Value = occurrence.EffectiveContactEmail;
                                break;
                            case "MaxAttendees":
                                field.Value = occurrence.EffectiveMaximumAttendees;
                                break;
                            case "Cost":
                                field.Value = string.Format("{0:C}", occurrence.EffectiveCost);
                                break;
                            case "AvailableSeats":
                                field.Value = occurrence.Availability;
                                break;
                            case "SpecialInstructions":
                                field.Value = occurrence.SpecialInstructions;
                                break;
                            case "Map":
                                field.Value = "mapDiv_" + occurrence.Id;
                                field.MappingProvider = _mappingSettings.MappingProvider.ToString().ToUpperInvariant();
                                field.MapItem = new MapItem()
                                {
                                    Title = occurrence.EventTitle,
                                    Latitude = occurrence.Latitude.HasValue ? occurrence.Latitude.ToString() : string.Empty,
                                    Longitude = occurrence.Longitude.HasValue ? occurrence.Longitude.ToString() : string.Empty,
                                    LocationAddress = occurrence.EffectiveCompleteAddress,
                                    LocationPhoneNum = occurrence.EffectiveContactPhone
                                };
                                break;
                            case "RegisterButton":
                                if (occurrence.IsRegistrationEnabled)
                                    field.Value = "<input type='button' class='btn btn-primary' value='Register' data-ng-click='Register(" + occurrence.Id + ")' />";
                                else
                                    field.Value = null;
                                break;
                            case "AddToCartButton":
                                if (occurrence.IsRegistrationEnabled)
                                    field.Value = "<input type='button' class='btn btn-primary' value='Add To Cart' data-ng-click='AddToCart(" + occurrence.Id + ")' />";
                                else
                                    field.Value = null;
                                break;
                            case "DateAndTime":
                                var dtBuilder = new StringBuilder();
                                var formatStr = "{0} - {1} until {2}";
                                foreach(var d in occurrence.Dates)
                                {
                                    if (d.StartDate.HasValue && d.EndDate.HasValue)
                                    {
                                        if (dtBuilder.Length > 0)
                                            dtBuilder.Append("<br/>");

                                        var dateStr = d.StartDate.Value.ToString("MMM. d, yyyy");
                                        var startTime = d.StartDate.Value.ToShortTimeString();
                                        var endTime = d.EndDate.Value.ToShortTimeString();
                                        dtBuilder.AppendFormat(formatStr, dateStr, startTime, endTime);
                                    }
                                }
                                field.Value = dtBuilder.ToString();
                                break;
                        }
                    }
                }

                locationsFields.Add(occurrenceField);
            }

            return locationsFields;
        }
Пример #4
0
        private void PopulateSeoData(ModuleInstanceView parent, EventDetailDto eventDetail, IDictionary<string, string> parameters)
        {
            var seoHelper = new SeoHelper(parent, parameters);

            //SEO Data
            var seoData = seoHelper.PopulateDetailViewSeoData(_viewSettings, eventDetail);
            parent.ResponseParameters.Add(CommonParameters.SeoData, seoData);

            //SEO Schema
            if (!string.IsNullOrEmpty(_viewSettings.SeoSchema))
                parent.ResponseParameters.Add(CommonParameters.SeoSchema, _viewSettings.SeoSchema);
        }
Пример #5
0
 private void PopulateFieldData(ModuleInstanceView parent, EventDetailDto eventDetail, 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 && DynamicColumnDefitions.Any(c => c.Name == dynamicColumnFieldName))
             field.Value = dynamicColumn.FieldValue;
         else
             field.Value = string.Empty;
     }
     //Handle Standard Column Data
     else
     {
         switch (field.FieldName)
         {
             case "EventTitle":
                 field.Value = eventDetail.Title;
                 break;
             case "EventDescription":
                 field.Value = eventDetail.SummaryDescription;
                 break;
             case "SpecialInstructions":
                 field.Value = eventDetail.SpecialInstructions;
                 break;
             case "Image":
                 if (!string.IsNullOrEmpty(eventDetail.ImagePath))
                     field.URL = eventDetail.ImagePath;
                 else
                     field.URL = parent.DefaultEventImageUrl;
                 field.Value = eventDetail.Title;
                 break;
             case "EventTopics":
                 field.Values = eventDetail.EventTopicNames.Select(t => t).Cast<object>().ToList();
                 break;
             case "EventTypes":
                 field.Values = eventDetail.EventTypeNames.Select(t => t).Cast<object>().ToList();
                 break;
             case "Custom1":
                 field.Value = eventDetail.Custom1;
                 break;
             case "Custom2":
                 field.Value = eventDetail.Custom2;
                 break;
             case "Custom3":
                 field.Value = eventDetail.Custom3;
                 break;
         }
     }
 }