예제 #1
0
        private IEnumerable <MasterPageZoneElement> GetMasterPageZoneElements(MasterPage masterPage, long masterPageZoneId)
        {
            MasterPageZone masterPageZone = masterPage.MasterPageZones.Where(z => z.MasterPageZoneId == masterPageZoneId).FirstOrDefault();

            if (masterPageZone == null)
            {
                return(Enumerable.Empty <MasterPageZoneElement>());
            }
            else
            {
                return(masterPageZone.MasterPageZoneElements);
            }
        }
예제 #2
0
        private PageViewZone GetPageViewZoneFromMasterPageZone(long pageId, MasterPageZone masterPageZone)
        {
            PageViewZone pageViewZone = new PageViewZone
            {
                TenantId         = masterPageZone.TenantId,
                MasterPageId     = masterPageZone.MasterPageId,
                MasterPageZoneId = masterPageZone.MasterPageZoneId,
                PageId           = pageId,
                BeginRender      = masterPageZone.BeginRender,
                EndRender        = masterPageZone.EndRender
            };

            return(pageViewZone);
        }
예제 #3
0
        public async Task <PageViewZone> ReadPageViewZoneAsync(long tenantId, long pageId, long masterPageZoneId)
        {
            Page page = await _pageRepository.ReadPageAsync(tenantId, pageId);

            if (page == null)
            {
                return(null);
            }
            MasterPageZone masterPageZone = await _masterPageRepository.ReadMasterPageZoneAsync(tenantId, page.MasterPageId, masterPageZoneId);

            if (masterPageZone == null)
            {
                return(null);
            }
            return(GetPageViewZoneFromMasterPageZone(pageId, masterPageZone));
        }
예제 #4
0
        public async Task <IEnumerable <PageViewZoneElement> > SearchPageViewZoneElementsAsync(long tenantId, long pageId, long masterPageZoneId)
        {
            Page page = await _pageRepository.ReadPageAsync(tenantId, pageId);

            if (page == null)
            {
                return(Enumerable.Empty <PageViewZoneElement>());
            }
            MasterPageZone masterPageZone = await _masterPageRepository.ReadMasterPageZoneAsync(tenantId, page.MasterPageId, masterPageZoneId);

            if (masterPageZone == null)
            {
                return(Enumerable.Empty <PageViewZoneElement>());
            }
            switch (masterPageZone.AdminType)
            {
            case AdminType.Editable:
                long?editablePageZoneId = await GetPageZoneId(tenantId, pageId, masterPageZoneId);

                if (editablePageZoneId == null)
                {
                    return(Enumerable.Empty <PageViewZoneElement>());
                }
                IEnumerable <PageZoneElement> editablePageZoneElements = await _pageRepository.SearchPageZoneElementsAsync(tenantId, pageId, editablePageZoneId.Value);

                IEnumerable <MasterPageZoneElement> editableMasterPageZoneElements = await _masterPageRepository.SearchMasterPageZoneElementsAsync(tenantId, page.MasterPageId, masterPageZoneId);

                return(EnumeratePageViewZoneElements(editablePageZoneElements, editableMasterPageZoneElements));

            case AdminType.Configurable:
                long?pageZoneId = await GetPageZoneId(tenantId, pageId, masterPageZoneId);

                if (pageZoneId == null)
                {
                    return(Enumerable.Empty <PageViewZoneElement>());
                }
                IEnumerable <PageZoneElement> pageZoneElements = await _pageRepository.SearchPageZoneElementsAsync(tenantId, pageId, pageZoneId.Value);

                return(EnumeratePageViewZoneElements(pageZoneElements));

            default:     // AdminType.Static
                IEnumerable <MasterPageZoneElement> masterPageZoneElements = await _masterPageRepository.SearchMasterPageZoneElementsAsync(tenantId, page.MasterPageId, masterPageZoneId);

                return(EnumeratePageViewZoneElements(masterPageZoneElements));
            }
        }
예제 #5
0
        private IEnumerable <PageViewZoneElement> SearchPageViewZoneElements(MasterPage masterPage, Page page, MasterPageZone masterPageZone)
        {
            switch (masterPageZone.AdminType)
            {
            case AdminType.Editable:
                IEnumerable <PageZoneElement>       editablePageZoneElements       = GetPageZoneElements(page, masterPageZone.MasterPageZoneId);
                IEnumerable <MasterPageZoneElement> editableMasterPageZoneElements = GetMasterPageZoneElements(masterPage, masterPageZone.MasterPageZoneId);
                return(EnumeratePageViewZoneElements(editablePageZoneElements, editableMasterPageZoneElements));

            case AdminType.Configurable:
                IEnumerable <PageZoneElement> pageZoneElements = GetPageZoneElements(page, masterPageZone.MasterPageZoneId);
                return(EnumeratePageViewZoneElements(pageZoneElements));

            default:     // AdminType.Static
                IEnumerable <MasterPageZoneElement> masterPageZoneElements = GetMasterPageZoneElements(masterPage, masterPageZone.MasterPageZoneId);
                return(EnumeratePageViewZoneElements(masterPageZoneElements));
            }
        }
예제 #6
0
        private async Task <PageViewZone> GetPageViewZoneFromMasterPageZoneAsync(Page page, MasterPageZone masterPageZone)
        {
            PageViewZone pageViewZone = new PageViewZone
            {
                TenantId             = masterPageZone.TenantId,
                MasterPageId         = masterPageZone.MasterPageId,
                MasterPageZoneId     = masterPageZone.MasterPageZoneId,
                PageId               = page.PageId,
                BeginRender          = masterPageZone.BeginRender,
                EndRender            = masterPageZone.EndRender,
                PageViewZoneElements = await SearchPageViewZoneElementsAsync(page, masterPageZone)
            };

            return(pageViewZone);
        }