Пример #1
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);
        }
Пример #2
0
        private void PopulateSeoData(IDictionary<string, string> parameters)
        {
            var seoHelper = new SeoHelper(_view, parameters);

            //SEO Title
            var pageTitle = seoHelper.BuildListViewTitleFromFormula(_viewSettings, _view.SearchSettings);
            var seoData = seoHelper.PopulateListViewSeoData(_viewSettings, pageTitle);

            _view.ResponseParameters.Add(CommonParameters.SeoData, seoData);
        }
Пример #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;
        }