示例#1
0
        public async Task <Response <RequestPublish> > GetData(Context ctx, int pageNumber)
        {
            if (!IsConnectedToInternet(ctx))
            {
                return new Response <RequestPublish> {
                           IsSuccess = false, Message = ctx.GetString(Resource.String.msg_no_internet_conection)
                }
            }
            ;

            try {
                mediaService = RestService.For <ISocialMediaService>(ctx.GetString(Resource.String.resource_url_api));

                var result = await mediaService.GetPublish(pageNumber);

                return(new Response <RequestPublish> {
                    IsSuccess = true, Result = result
                });
            }
            catch (System.Exception ex) {
                return(new Response <RequestPublish> {
                    IsSuccess = false, Message = ex.Message
                });
            }
        }
示例#2
0
 /// <summary>
 /// Creates a new AddressModelHandler
 /// </summary>
 /// <param name="socialMediaService">The social media service.</param>
 /// <param name="userProvider">The user provider to get current user information.</param>
 public SocialMediaPresenceModelHandler(ISocialMediaService socialMediaService, IUserProvider userProvider)
 {
     Contract.Requires(socialMediaService != null, "The social media service must not be null.");
     Contract.Requires(userProvider != null, "The user provider must not be null.");
     this.socialMediaService = socialMediaService;
     this.userProvider       = userProvider;
 }
示例#3
0
 /// <summary>
 /// Creates a new instance of the controller.
 /// </summary>
 /// <param name="userProvider">The user provider.</param>
 /// <param name="socialMediaTypeService">The social media type service.</param>
 /// <param name="socialMediaService">The social media service.</param>
 public SocialMediasController(IUserProvider userProvider, ISocialMediaTypeService socialMediaTypeService, ISocialMediaService socialMediaService)
 {
     Contract.Requires(socialMediaTypeService != null, "The social media type service must not be null.");
     Contract.Requires(socialMediaService != null, "The social media service must not be null.");
     Contract.Requires(userProvider != null, "The user provider must not be null.");
     this.socialMediaTypeService = socialMediaTypeService;
     this.socialMediaService     = socialMediaService;
     this.userProvider           = userProvider;
 }
 public AdminController(IArticleService articleService, ICategoryService categoryService, ITagService tagService, IArticleTagService articleTagService, IQuestionService questionService, IAdminService adminService, ISocialMediaService socialMediaService)
 {
     _articleService     = articleService;
     _categoryService    = categoryService;
     _tagService         = tagService;
     _articleTagService  = articleTagService;
     _questionService    = questionService;
     _adminService       = adminService;
     _socialMediaService = socialMediaService;
 }
示例#5
0
        public MainWindow(IVideoManagementService vms, IVideoNetworkService vns, IStorageService ss, IMasterService ms, IAudioNetworkService ans, IAudioManagementService ams, ISocialMediaService sms)
        {
            _vms = vms;
            _vns = vns;
            _ss  = ss;
            _ms  = ms;
            _ans = ans;
            _ams = ams;
            _sms = sms;

            InitializeComponent();
            SetFolderDefaults();
            CheckCredentials();
        }
示例#6
0
        public MainWindow(IVideoManagementService vms, IVideoNetworkService vns, IStorageService ss, IMasterService ms, IAudioNetworkService ans, IAudioManagementService ams, ISocialMediaService sms)
        {
            _vms = vms;
            _vns = vns;
            _ss = ss;
            _ms = ms;
            _ans = ans;
            _ams = ams;
            _sms = sms;

            InitializeComponent();
            SetFolderDefaults();
            CheckCredentials();
        }
示例#7
0
 public CreateRemarkHandler(IHandler handler,
                            IBusClient bus,
                            IFileResolver fileResolver,
                            IFileValidator fileValidator,
                            IRemarkService remarkService,
                            IGroupService groupService,
                            ISocialMediaService socialMediaService,
                            ILocationService locationService,
                            IResourceFactory resourceFactory,
                            ICreateRemarkPolicy policy)
 {
     _handler            = handler;
     _bus                = bus;
     _fileResolver       = fileResolver;
     _fileValidator      = fileValidator;
     _remarkService      = remarkService;
     _groupService       = groupService;
     _socialMediaService = socialMediaService;
     _locationService    = locationService;
     _resourceFactory    = resourceFactory;
     _policy             = policy;
 }
示例#8
0
        /// <summary>
        /// Populates the properties of <see cref="BaseViewModel" /> which can be inherited from parent nodes
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="latestService">The latest service.</param>
        /// <param name="socialMediaService">The social media service.</param>
        /// <param name="eastSussex1SpaceService">The east sussex1 space service.</param>
        /// <param name="escisService">The ESCIS service.</param>
        /// <exception cref="System.ArgumentNullException">model</exception>
        public void PopulateBaseViewModelWithInheritedContent(Models.BaseViewModel model, latest.ILatestService latestService, ISocialMediaService socialMediaService, IEastSussex1SpaceService eastSussex1SpaceService, IEscisService escisService, IRatingSettingsProvider ratingSettings = null)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            if (latestService != null)
            {
                model.Latest = latestService.ReadLatestSettings().LatestHtml;
            }
            if (eastSussex1SpaceService != null)
            {
                model.ShowEastSussex1SpaceWidget = eastSussex1SpaceService.ShowSearch();
            }
            if (escisService != null)
            {
                model.ShowEscisWidget = escisService.ShowSearch();
            }
            if (socialMediaService != null)
            {
                model.SocialMedia = socialMediaService.ReadSocialMediaSettings();
            }
            if (ratingSettings != null)
            {
                model.RatingSettings = ratingSettings.ReadRatingSettings();
            }
        }
示例#9
0
        private static async Task <LandingViewModel> MapUmbracoContentToViewModel(HttpRequestBase request, IPublishedContent content, DateTime?expiryDate, latest.ILatestService latestService, ISocialMediaService socialMediaService, IEastSussex1SpaceService eastSussex1SpaceService, IWebChatSettingsService webChatSettingsService, IRelatedLinksService relatedLinksService, IContentExperimentSettingsService contentExperimentSettingsService, IEscisService escisService, IRatingSettingsProvider ratingSettings, ISkinToApplyService skinService)
        {
            var model = new LandingViewModel();

            model.Navigation.Sections = BuildLandingLinksViewModelFromUmbracoContent(content, relatedLinksService);
            model.Navigation.LandingNavigationLayout = LandingNavigationLayout.ThreeColumn;
            var selectedLayout = content.GetPropertyValue <string>("layout_Content");

            if (!String.IsNullOrEmpty(selectedLayout))
            {
                var selectedOption =
                    umbraco.library.GetPreValueAsString(Int32.Parse(selectedLayout, CultureInfo.InvariantCulture));

                if (selectedOption.ToUpperInvariant().Contains("TWO"))
                {
                    model.Navigation.LandingNavigationLayout = LandingNavigationLayout.TwoColumn;
                }
            }

            // Add common properties to the model
            var modelBuilder = new BaseViewModelBuilder(new EastSussexGovUKTemplateRequest(request, webChatSettingsService: webChatSettingsService));
            await modelBuilder.PopulateBaseViewModel(model, content, contentExperimentSettingsService,
                                                     expiryDate,
                                                     UmbracoContext.Current.InPreviewMode, skinService);

            modelBuilder.PopulateBaseViewModelWithInheritedContent(model, latestService, socialMediaService, eastSussex1SpaceService, escisService, ratingSettings);

            return(model);
        }
示例#10
0
 public PolRegioAccountController(IAccountService accountService, ISocialMediaService socialMediaService)
 {
     _umbracoHelper      = new UmbracoHelper(UmbracoContext.Current);
     _accountService     = accountService;
     _socialMediaService = socialMediaService;
 }
        protected override async Task <LocationViewModel> MapUmbracoContentToViewModel(IPublishedContent content, DateTime?expiryDate, latest.ILatestService latestService, ISocialMediaService socialMediaService, IEastSussex1SpaceService eastSussex1SpaceService, IWebChatSettingsService webChatSettingsService, IRelatedLinksService relatedLinksService, IContentExperimentSettingsService contentExperimentSettingsService, IEscisService escisService, IRatingSettingsProvider ratingSettings, IMediaUrlTransformer mediaUrlTransformer, ISkinToApplyService skinService)
        {
            var model = await base.MapUmbracoContentToViewModel(content, expiryDate, latestService, socialMediaService, eastSussex1SpaceService, webChatSettingsService, relatedLinksService, contentExperimentSettingsService, escisService, ratingSettings, mediaUrlTransformer, skinService);

            // Get the types of waste which have been selected for this recycling site
            var recycledTypes = content.GetPropertyValue <IEnumerable <string> >("wasteTypes_Content");

            if (recycledTypes != null)
            {
                ((List <string>)model.WasteTypesRecycled).AddRange(recycledTypes);
            }

            var acceptedTypes = content.GetPropertyValue <IEnumerable <string> >("acceptedWasteTypes_Content");

            if (acceptedTypes != null)
            {
                ((List <string>)model.WasteTypesAccepted).AddRange(acceptedTypes);
            }

            // Get the authority responsible for this site
            var preValueId = content.GetPropertyValue <int>("responsibleAuthority_Content");

            if (preValueId > 0)
            {
                model.ResponsibleAuthority = umbraco.library.GetPreValueAsString(preValueId);
            }

            return(model);
        }
示例#12
0
        /// <summary>
        /// Populates the properties of <see cref="BaseViewModel" /> which can be inherited from parent nodes
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="latestService">The latest service.</param>
        /// <param name="socialMediaService">The social media service.</param>
        /// <param name="eastSussex1SpaceService">The east sussex1 space service.</param>
        /// <param name="webChatSettingsService">The web chat settings service.</param>
        /// <param name="escisService">The ESCIS service.</param>
        /// <exception cref="System.ArgumentNullException">model</exception>
        public void PopulateBaseViewModelWithInheritedContent(BaseViewModel model, ILatestService latestService, ISocialMediaService socialMediaService, IEastSussex1SpaceService eastSussex1SpaceService, IWebChatSettingsService webChatSettingsService, IEscisService escisService)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            if (latestService != null)
            {
                model.Latest = latestService.ReadLatestSettings().LatestHtml;
            }
            if (eastSussex1SpaceService != null)
            {
                model.ShowEastSussex1SpaceWidget = eastSussex1SpaceService.ShowSearch();
            }
            if (escisService != null)
            {
                model.ShowEscisWidget = escisService.ShowSearch();
            }
            if (socialMediaService != null)
            {
                model.SocialMedia = socialMediaService.ReadSocialMediaSettings();
            }
            if (webChatSettingsService != null)
            {
                model.WebChat = webChatSettingsService.ReadWebChatSettings();
            }
        }
示例#13
0
        private static async Task <MicrosoftCmsViewModel> MapUmbracoContentToViewModel(HttpRequestBase request, IPublishedContent content, DateTime?expiryDate, latest.ILatestService latestService, ISocialMediaService socialMediaService, IEastSussex1SpaceService eastSussex1SpaceService, IWebChatSettingsService webChatSettingsService, IContentExperimentSettingsService contentExperimentSettingsService, IEscisService escisService, IRatingSettingsProvider ratingSettings, ISkinToApplyService skinService)
        {
            var model = new MicrosoftCmsViewModel();

            var modelBuilder = new BaseViewModelBuilder(new EastSussexGovUKTemplateRequest(request, webChatSettingsService: webChatSettingsService));
            await modelBuilder.PopulateBaseViewModel(model, content, contentExperimentSettingsService,
                                                     expiryDate,
                                                     UmbracoContext.Current.InPreviewMode, skinService);

            modelBuilder.PopulateBaseViewModelWithInheritedContent(model, latestService, socialMediaService, eastSussex1SpaceService, escisService, ratingSettings);

            return(model);
        }
 public FacebookWindow(ISocialMediaService sms)
 {
     InitializeComponent();
     _sms = sms;
     SetWebBrowserUrl();
 }
示例#15
0
        public EditSonViewModel(IUserDialogs userDialogs, IMvxMessenger mvxMessenger, IParentService parentService,
                                ISocialMediaService socialMediaService, AppHelper appHelper, IOAuthService oauthService, ISchoolService schoolService) : base(userDialogs, mvxMessenger, appHelper)
        {
            _parentService      = parentService;
            _socialMediaService = socialMediaService;
            _schoolService      = schoolService;
            _oauthService       = oauthService;


            RefreshCommand = ReactiveCommand.CreateFromObservable <Unit, PageModel>((param) => !PageLoaded ? LoadPageModel(): Observable.Empty <PageModel>());

            RefreshCommand.Subscribe(OnPageModelLoaded);

            RefreshCommand.IsExecuting.Subscribe((isExecuting) => HandleIsExecuting(isExecuting, AppResources.Common_Loading));

            RefreshCommand.ThrownExceptions.Subscribe(HandleExceptions);

            ForceRefreshCommand = ReactiveCommand.CreateFromObservable <Unit, PageModel>((param) => LoadPageModel());

            ForceRefreshCommand.Subscribe(OnPageModelLoaded);

            ForceRefreshCommand.IsExecuting.Subscribe((isExecuting) => HandleIsExecuting(isExecuting, AppResources.Common_Loading));

            ForceRefreshCommand.ThrownExceptions.Subscribe(HandleExceptions);

            TakePhotoCommand = ReactiveCommand.CreateFromObservable <Unit, MediaFile>((param) => _appHelper.PickPhotoStream());

            TakePhotoCommand.Subscribe((ImageFile) =>
            {
                _userDialogs.HideLoading();
                NewProfileImage = ImageFile;
                OnNewSelectedImage(ImageFile);
            });

            TakePhotoCommand.ThrownExceptions.Subscribe(HandleExceptions);


            SaveChangesCommand = ReactiveCommand
                                 .CreateFromObservable <Unit, bool>((param) =>
            {
                return((CurrentSon.Identity == null ?
                        _parentService.AddSonToSelfParent(CurrentSon.FirstName, CurrentSon.LastName, CurrentSon.Birthdate, CurrentSon.School.Identity) :
                        _parentService.UpdateSonInformation(CurrentSon.Identity, CurrentSon.FirstName, CurrentSon.LastName, CurrentSon.Birthdate, CurrentSon.School.Identity))
                       .Do((SonEntity) => CurrentSon.HydrateWith(SonEntity))
                       .SelectMany((SonEntity) => _socialMediaService
                                   .SaveAllSocialMedia(
                                       CurrentSon.Identity,
                                       CurrentSocialMedia.Select(s => { s.Son = CurrentSon.Identity; return s; }).ToList()
                                       ).Catch <IList <SocialMediaEntity>, NoSocialMediaFoundException>(ex => Observable.Return(new List <SocialMediaEntity>()))
                                   )
                       .Do((SocialMediaEntities) => CurrentSocialMedia.ReplaceRange(SocialMediaEntities))

                       .SelectMany((_) =>
                {
                    return NewProfileImage != null ?
                    _parentService.UploadSonProfileImage(CurrentSon.Identity, NewProfileImage.GetStream()) :
                    Observable.Empty <ImageEntity>();
                })
                       .Select((_) => true)
                       .DefaultIfEmpty(true));
            });

            SaveChangesCommand.Subscribe((_) =>
            {
                NewProfileImage = null;
                OnSonUpdated(CurrentSon);
                _userDialogs.ShowSuccess(AppResources.EditSon_Saved_Changes_Successfully);
                IsDirtyMonitoring = true;
            });

            SaveChangesCommand.IsExecuting.Subscribe((isLoading) => HandleIsExecuting(isLoading, AppResources.EditSon_Saving_Changes));

            SaveChangesCommand.ThrownExceptions.Subscribe(HandleExceptions);

            SaveSchoolCommand = ReactiveCommand.CreateFromObservable <Unit, SchoolEntity>((param) => _schoolService.CreateSchool(NewSchool.Name, NewSchool.Residence, NewSchool.Latitude, NewSchool.Longitude, NewSchool.Province, NewSchool.Tfno, NewSchool.Email));

            SaveSchoolCommand.Subscribe((SchoolAdded) =>
            {
                NewSchool = new SchoolEntity();
                CurrentSon.School.HydrateWith(SchoolAdded);
                _appHelper.ShowAlert(AppResources.EditSon_School_Saved);
                OnSchoolAdded(SchoolAdded);
            });


            SaveSchoolCommand.IsExecuting.Subscribe((isLoading) => HandleIsExecuting(isLoading, AppResources.EditSon_Saving_School));

            SaveSchoolCommand.ThrownExceptions.Subscribe(HandleExceptions);


            FindSchoolsCommand = ReactiveCommand.CreateFromObservable <string, IList <SchoolEntity> >(
                (name) => _schoolService.FindSchools(name));

            FindSchoolsCommand.IsExecuting.Subscribe((isLoading) => HandleIsExecuting(isLoading, AppResources.EditSon_Find_School));

            FindSchoolsCommand.ThrownExceptions.Subscribe(HandleExceptions);

            FindSchoolsCommand.Subscribe((SchoolsFounded) => {
                SearchPerformed = true;
                Schools.ReplaceRange(SchoolsFounded);
            });
        }
 public SocialMediaAppService(ISocialMediaService socialMediaService, ICachedSearchesService cachedSearchesService)
 {
     _socialMediaService    = socialMediaService;
     _cachedSearchesService = cachedSearchesService;
 }
        private PersonViewModel MapUmbracoContentToViewModel(IPublishedContent content, ILatestService latestService, ISocialMediaService socialMediaService, IEastSussex1SpaceService eastSussex1SpaceService, IWebChatSettingsService webChatSettingsService, IRelatedLinksService relatedLinksService, IContentExperimentSettingsService contentExperimentSettingsService, IEscisService escisService, IMediaUrlTransformer mediaUrlTransformer)
        {
            var model = new PersonViewModel
            {
                JobTitle    = content.GetPropertyValue <string>("jobTitle_Content"),
                LeadingText = new HtmlString(mediaUrlTransformer.ParseAndTransformMediaUrlsInHtml(content.GetPropertyValue <string>("leadingText_Content"))),
                Subheading1 = content.GetPropertyValue <string>("subheading1_Content"),
                Content1    = new HtmlString(mediaUrlTransformer.ParseAndTransformMediaUrlsInHtml(content.GetPropertyValue <string>("content1_Content"))),
                Subheading2 = content.GetPropertyValue <string>("subheading2_Content"),
                Content2    = new HtmlString(mediaUrlTransformer.ParseAndTransformMediaUrlsInHtml(content.GetPropertyValue <string>("content2_Content"))),
                Contact     = new HtmlString(mediaUrlTransformer.ParseAndTransformMediaUrlsInHtml(content.GetPropertyValue <string>("contact_Content")))
            };

            model.Metadata.PersonAbout.Name.Titles.Add(content.GetPropertyValue <string>("HonorificTitle_Content"));
            model.Metadata.PersonAbout.Name.GivenNames.Add(content.GetPropertyValue <string>("GivenName_Content"));
            model.Metadata.PersonAbout.Name.FamilyName = content.GetPropertyValue <string>("FamilyName_Content");
            model.Metadata.PersonAbout.Name.Suffixes.Add(content.GetPropertyValue <string>("HonorificSuffix_Content"));
            model.Metadata.PersonAbout.EmailAddresses.Add(content.GetPropertyValue <string>("email_Content"));
            model.Metadata.PersonAbout.TelephoneNumbers.Add(content.GetPropertyValue <string>("phone_Content"));
            model.Metadata.Person = model.Metadata.PersonAbout.Name.ToString();
            if (!String.IsNullOrEmpty(model.JobTitle))
            {
                model.Metadata.Person += ", " + model.JobTitle;
            }

            var relatedLinksGroups = new RelatedLinksModelBuilder().OrganiseAsHeadingsAndSections(relatedLinksService.BuildRelatedLinksViewModelFromUmbracoContent(content, "relatedLinks_Content"));

            foreach (var linkGroup in relatedLinksGroups)
            {
                model.RelatedLinksGroups.Add(linkGroup);
            }

            var imageData = content.GetPropertyValue <IPublishedContent>("photo_Content");

            if (imageData != null)
            {
                model.Photo = new Image()
                {
                    AlternativeText = imageData.Name,
                    ImageUrl        = new Uri(imageData.Url, UriKind.Relative),
                    Width           = imageData.GetPropertyValue <int>("umbracoWidth"),
                    Height          = imageData.GetPropertyValue <int>("umbracoHeight")
                };
                model.Metadata.PageImageUrl = new Uri(Request.Url, model.Photo.ImageUrl).ToString();
            }

            // Add common properties to the model
            var modelBuilder = new BaseViewModelBuilder();

            modelBuilder.PopulateBaseViewModel(model, content, contentExperimentSettingsService, UmbracoContext.Current.InPreviewMode);
            modelBuilder.PopulateBaseViewModelWithInheritedContent(model, latestService, socialMediaService, eastSussex1SpaceService, webChatSettingsService, escisService);

            return(model);
        }
        private static MicrosoftCmsViewModel MapUmbracoContentToViewModel(IPublishedContent content, ILatestService latestService, ISocialMediaService socialMediaService, IEastSussex1SpaceService eastSussex1SpaceService, IWebChatSettingsService webChatSettingsService, IContentExperimentSettingsService contentExperimentSettingsService, IEscisService escisService)
        {
            var model = new MicrosoftCmsViewModel();

            var modelBuilder = new BaseViewModelBuilder();

            modelBuilder.PopulateBaseViewModel(model, content, contentExperimentSettingsService, UmbracoContext.Current.InPreviewMode);
            modelBuilder.PopulateBaseViewModelWithInheritedContent(model, latestService, socialMediaService, eastSussex1SpaceService, webChatSettingsService, escisService);

            return(model);
        }
示例#19
0
 public FacebookWindow(ISocialMediaService sms)
 {
     InitializeComponent();
     _sms = sms;
     SetWebBrowserUrl();
 }
示例#20
0
        /// <summary>
        /// Maps the Umbraco content to the view model.
        /// </summary>
        /// <param name="content">The content.</param>
        /// <param name="expiryDate">The expiry date.</param>
        /// <param name="latestService">The latest service.</param>
        /// <param name="socialMediaService">The social media service.</param>
        /// <param name="eastSussex1SpaceService">The East Sussex One Space service.</param>
        /// <param name="webChatSettingsService">The web chat settings service.</param>
        /// <param name="relatedLinksService">The related links service.</param>
        /// <param name="contentExperimentSettingsService">The content experiment settings service.</param>
        /// <param name="escisService">The escis service.</param>
        /// <param name="ratingSettings">The rating settings.</param>
        /// <param name="mediaUrlTransformer">The media URL transformer.</param>
        /// <param name="skinService">The skin service.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">content
        /// or
        /// latestService
        /// or
        /// socialMediaService
        /// or
        /// eastSussex1SpaceService
        /// or
        /// webChatSettingsService
        /// or
        /// relatedLinksService</exception>
        /// <exception cref="System.ArgumentNullException">content
        /// or
        /// latestService
        /// or
        /// socialMediaService
        /// or
        /// eastSussex1SpaceService
        /// or
        /// webChatSettingsService
        /// or
        /// relatedLinksService
        /// or
        /// contentExperimentSettingsService</exception>
        /// <remarks>
        /// Method is virtual so that document types which inherit from the 'Location' type can also inherit and extend the controller
        /// </remarks>
        protected virtual async Task <LocationViewModel> MapUmbracoContentToViewModel(IPublishedContent content, DateTime?expiryDate, latest.ILatestService latestService, ISocialMediaService socialMediaService, IEastSussex1SpaceService eastSussex1SpaceService, IWebChatSettingsService webChatSettingsService, IRelatedLinksService relatedLinksService, IContentExperimentSettingsService contentExperimentSettingsService, IEscisService escisService, IRatingSettingsProvider ratingSettings, IMediaUrlTransformer mediaUrlTransformer, ISkinToApplyService skinService)
        {
            if (content == null)
            {
                throw new ArgumentNullException("content");
            }
            if (latestService == null)
            {
                throw new ArgumentNullException("latestService");
            }
            if (socialMediaService == null)
            {
                throw new ArgumentNullException("socialMediaService");
            }
            if (eastSussex1SpaceService == null)
            {
                throw new ArgumentNullException("eastSussex1SpaceService");
            }
            if (webChatSettingsService == null)
            {
                throw new ArgumentNullException("webChatSettingsService");
            }
            if (relatedLinksService == null)
            {
                throw new ArgumentNullException("relatedLinksService");
            }
            if (contentExperimentSettingsService == null)
            {
                throw new ArgumentNullException("contentExperimentSettingsService");
            }
            if (ratingSettings == null)
            {
                throw new ArgumentNullException(nameof(ratingSettings));
            }
            if (skinService == null)
            {
                throw new ArgumentNullException(nameof(skinService));
            }

            var model = new LocationViewModel
            {
                Content             = new HtmlString(mediaUrlTransformer.ParseAndTransformMediaUrlsInHtml(content.GetPropertyValue <string>("content_Content"))),
                OpeningHoursDetails = new HtmlString(mediaUrlTransformer.ParseAndTransformMediaUrlsInHtml(content.GetPropertyValue <string>("openingHoursDetails_Content"))),
                Tab1Title           = content.GetPropertyValue <string>("tab1title_Content"),
                Tab1Content         = new HtmlString(mediaUrlTransformer.ParseAndTransformMediaUrlsInHtml(content.GetPropertyValue <string>("tab1content_Content"))),
                Tab2Title           = content.GetPropertyValue <string>("tab2title_Content"),
                Tab2Content         = new HtmlString(mediaUrlTransformer.ParseAndTransformMediaUrlsInHtml(content.GetPropertyValue <string>("tab2content_Content"))),
                Tab3Title           = content.GetPropertyValue <string>("tab3title_Content"),
                Tab3Content         = new HtmlString(mediaUrlTransformer.ParseAndTransformMediaUrlsInHtml(content.GetPropertyValue <string>("tab3content_Content"))),
                Location            = content.GetPropertyValue <AddressInfo>("location_Content"),
                Email1Label         = content.GetPropertyValue <string>("email1label_Content"),
                Email2Label         = content.GetPropertyValue <string>("email2label_Content"),
                Email1      = content.GetPropertyValue <string>("email1_Content"),
                Email2      = content.GetPropertyValue <string>("email2_Content"),
                Phone1Label = content.GetPropertyValue <string>("phone1label_Content"),
                Phone2Label = content.GetPropertyValue <string>("phone2label_Content"),
                Phone1      = content.GetPropertyValue <string>("phone1_Content"),
                Phone2      = content.GetPropertyValue <string>("phone2_Content"),
                Fax1Label   = content.GetPropertyValue <string>("fax1label_Content"),
                Fax2Label   = content.GetPropertyValue <string>("fax2label_Content"),
                Fax1        = content.GetPropertyValue <string>("fax1_Content"),
                Fax2        = content.GetPropertyValue <string>("fax2_Content")
            };

            var relatedLinksGroups = new RelatedLinksModelBuilder().OrganiseAsHeadingsAndSections(relatedLinksService.BuildRelatedLinksViewModelFromUmbracoContent(content, "relatedLinks_Content"));

            foreach (var linkGroup in relatedLinksGroups)
            {
                model.RelatedLinksGroups.Add(linkGroup);
            }

            // Opening times
            model.OpeningHours = DeserialiseOpeningHours(content);
            WorkOutRelativeOpeningTimes(model);
            WorkOutNextOpenRelativeTime(model);

            // Photo
            var imageData = content.GetPropertyValue <IPublishedContent>("photo_Content");

            if (imageData != null)
            {
                model.Photo = new Image()
                {
                    AlternativeText = imageData.Name,
                    ImageUrl        = new Uri(imageData.Url, UriKind.Relative),
                    Width           = imageData.GetPropertyValue <int>("umbracoWidth"),
                    Height          = imageData.GetPropertyValue <int>("umbracoHeight")
                };
                model.Metadata.PageImageUrl = new Uri(Request.Url, model.Photo.ImageUrl).ToString();
            }

            // Add common properties to the model
            var modelBuilder = new BaseViewModelBuilder(new EastSussexGovUKTemplateRequest(Request, webChatSettingsService: webChatSettingsService));
            await modelBuilder.PopulateBaseViewModel(model, content, contentExperimentSettingsService,
                                                     expiryDate,
                                                     UmbracoContext.Current.InPreviewMode, skinService);

            modelBuilder.PopulateBaseViewModelWithInheritedContent(model, latestService, socialMediaService, eastSussex1SpaceService, escisService, ratingSettings);

            return(model);
        }
示例#21
0
 public SocialMediaController(ISocialMediaService socialMediaService)
 {
     _socialMediaService = socialMediaService;
 }
示例#22
0
 public SocialMediaController(ISocialMediaService socialMediaService, IMapper mapper)
 {
     _mapper             = mapper;
     _socialMediaService = socialMediaService;
 }
        private static LandingViewModel MapUmbracoContentToViewModel(IPublishedContent content, ILatestService latestService, ISocialMediaService socialMediaService, IEastSussex1SpaceService eastSussex1SpaceService, IWebChatSettingsService webChatSettingsService, IRelatedLinksService relatedLinksService, IContentExperimentSettingsService contentExperimentSettingsService, IEscisService escisService)
        {
            var model = new LandingViewModel();

            model.Navigation.Sections = BuildLandingLinksViewModelFromUmbracoContent(content, relatedLinksService);
            model.Navigation.LandingNavigationLayout = LandingNavigationLayout.ThreeColumn;
            var selectedLayout = content.GetPropertyValue <string>("layout_Content");

            if (!String.IsNullOrEmpty(selectedLayout))
            {
                var selectedOption =
                    umbraco.library.GetPreValueAsString(Int32.Parse(selectedLayout, CultureInfo.InvariantCulture));

                if (selectedOption.ToUpperInvariant().Contains("TWO"))
                {
                    model.Navigation.LandingNavigationLayout = LandingNavigationLayout.TwoColumn;
                }
            }

            // Add common properties to the model
            var modelBuilder = new BaseViewModelBuilder();

            modelBuilder.PopulateBaseViewModel(model, content, contentExperimentSettingsService, UmbracoContext.Current.InPreviewMode);
            modelBuilder.PopulateBaseViewModelWithInheritedContent(model, latestService, socialMediaService, eastSussex1SpaceService, webChatSettingsService, escisService);

            return(model);
        }
示例#24
0
        protected override LocationViewModel MapUmbracoContentToViewModel(IPublishedContent content, ILatestService latestService, ISocialMediaService socialMediaService, IEastSussex1SpaceService eastSussex1SpaceService, IWebChatSettingsService webChatSettingsService, IRelatedLinksService relatedLinksService, IContentExperimentSettingsService contentExperimentSettingsService, IEscisService escisService, IMediaUrlTransformer mediaUrlTransformer)
        {
            var model = base.MapUmbracoContentToViewModel(content, latestService, socialMediaService, eastSussex1SpaceService, webChatSettingsService, relatedLinksService, contentExperimentSettingsService, escisService, mediaUrlTransformer);

            // Get the types of waste which have been selected for this recycling site
            var recycledTypes = ReadWasteTypesFromProperty(content, "wasteTypes_Content");

            if (recycledTypes != null)
            {
                ((List <string>)model.WasteTypesRecycled).AddRange(recycledTypes);
            }

            var acceptedTypes = ReadWasteTypesFromProperty(content, "acceptedWasteTypes_Content");

            if (acceptedTypes != null)
            {
                ((List <string>)model.WasteTypesAccepted).AddRange(acceptedTypes);
            }

            // Get the authority responsible for this site
            var preValueId = content.GetPropertyValue <int>("responsibleAuthority_Content");

            if (preValueId > 0)
            {
                model.ResponsibleAuthority = umbraco.library.GetPreValueAsString(preValueId);
            }

            return(model);
        }