• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# PageReference类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中PageReference的典型用法代码示例。如果您正苦于以下问题:C# PageReference类的具体用法?C# PageReference怎么用?C# PageReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PageReference类属于命名空间,在下文中一共展示了PageReference类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ConvertUrlToExternal

        public string ConvertUrlToExternal(PageData pageData = null, PageReference p = null)
        {
            if (pageData == null && p == null)
            {
                return string.Empty;
            }
            var page = pageData ?? _repository.Get<PageData>(p);

            var pageUrlBuilder = new UrlBuilder(page.LinkURL);

            Global.UrlRewriteProvider.ConvertToExternal(pageUrlBuilder, page.PageLink, Encoding.UTF8);

            string pageURL = pageUrlBuilder.ToString();

            UriBuilder uriBuilder = new UriBuilder(SiteDefinition.Current.SiteUrl);

            uriBuilder.Path = pageURL;
            var jj = ServiceLocator.Current.GetInstance<UrlResolver>().GetUrl(p);
            if (uriBuilder.Path == "/")
                return uriBuilder.Uri.AbsoluteUri;

            string[] words = uriBuilder.Uri.AbsoluteUri.Split(new char[] {':', '/', '.'},
                        StringSplitOptions.RemoveEmptyEntries);
            bool reoccurs = words.Count(q => q == "http") > 1;

            if (reoccurs)
                return uriBuilder.Uri.LocalPath.StartsWith("/") ? uriBuilder.Uri.LocalPath.Remove(0,1) : uriBuilder.Uri.LocalPath;

            return uriBuilder.Uri.AbsoluteUri;
        }
开发者ID:EpiCenterADC,项目名称:EPICenter,代码行数:30,代码来源:PageService.cs


示例2: CreateNews

        private static void CreateNews()
        {
            var dir = new DirectoryInfo(@"c:\temp\news");

            foreach (var fil in dir.GetFiles())
            {
                using (var stream = fil.OpenRead())
                using (var reader = new StreamReader(stream))
                {
                    var title = reader.ReadLine();
                    var ingress = reader.ReadLine();
                    var content = reader.ReadLine();

                    var pagereference = new PageReference(5);

                    var repo = ServiceLocator.Current.GetInstance<IContentRepository>();

                    var newPage = repo.GetDefault<Nyhet>(pagereference);
                    newPage.PageName = title;
                    newPage.MainIntro = ingress;
                    newPage.MainBody = new XhtmlString(content);
                    repo.Save(newPage, SaveAction.Publish);
                }
            }
        }
开发者ID:kennethdevik,项目名称:episerver_find_poc,代码行数:25,代码来源:SvadaNyhetsGenerator.cs


示例3: establish_context

        protected override void establish_context()
        {
            base.establish_context();

            _repository = new PageDataRepository(new DataFactoryQueryExecutor());

            var pageType = PageType.List().First();

            _root = PageReference.RootPage;
            var start = DataFactory.Instance.GetDefaultPageData(_root, pageType.ID);
            start.PageName = "start";
            start.URLSegment = "start";
            _start = DataFactory.Instance.Save(start, SaveAction.Publish);

            var child = DataFactory.Instance.GetDefaultPageData(start.PageLink, pageType.ID);
            child.PageName = "child";
            child.URLSegment = "child";
            _child = DataFactory.Instance.Save(child, SaveAction.Publish);

            var child2 = DataFactory.Instance.GetDefaultPageData(start.PageLink, pageType.ID);
            child2.PageName = "child";
            child2.URLSegment = "child";
            child2.StopPublish = DateTime.Today;
            _child2 = DataFactory.Instance.Save(child2, SaveAction.Publish);
        }
开发者ID:akselsson,项目名称:LinqToEPiServer,代码行数:25,代码来源:QueryIntegrationTests.cs


示例4: CreatePageFromJson

        private PageReference CreatePageFromJson(PageObject pageObject, PageReference parent, IContentRepository contentRepo)
        {
            BasePage newPage;
            switch (pageObject.Type)
            {
                case 0:
                    ArticlePage aPage = contentRepo.GetDefault<ArticlePage>(parent);
                    aPage.MainBody = pageObject.MainBodyText;
                    newPage = aPage;
                    break;
                case 1:
                    newPage = contentRepo.GetDefault<FolderPage>(parent);
                    break;
                case 2:
                    ListPage lPage = contentRepo.GetDefault<ListPage>(parent);
                    lPage.MainBody = pageObject.MainBodyText;
                    newPage = lPage;
                    break;
                case 3:
                    newPage = contentRepo.GetDefault<PersonPage>(parent);
                    break;
                case 4:
                    newPage = contentRepo.GetDefault<PortalPage>(parent);
                    break;
                default:
                    newPage = contentRepo.GetDefault<ArticlePage>(parent);
                    break;
            }

            newPage.PageName = pageObject.PageName;
            newPage.IntroText = pageObject.IntroText;
            contentRepo.Save(newPage, SaveAction.Publish);
            return newPage.PageLink;
        }
开发者ID:Halvardsjotveit,项目名称:WebNews,代码行数:34,代码来源:JsonImportTool.aspx.cs


示例5: GetPageRoute

 public static RouteValueDictionary GetPageRoute(this RequestContext requestContext, PageReference pageLink)
 {
     var values = new RouteValueDictionary();
     values[RoutingConstants.NodeKey] = pageLink;
     values[RoutingConstants.LanguageKey] = ContentLanguage.PreferredCulture.Name;
     return values;
 }
开发者ID:rbrunge,项目名称:phony-club-denmark,代码行数:7,代码来源:UrlHelpers.cs


示例6: Given

        public override void Given()
        {
            base.Given();

            _startPageReference = ContentRepository
                .Publish<StartPage>(ContentReference.RootPage);

            _oldParentReference = ContentRepository
                .GetDefault<StartPage>(_startPageReference)
                .With(p =>
                    {
                        p.PageName = "OldParent";
                        p.LinkURL = "oldparent";
                    })
                .SaveAndPublish(ContentRepository);

            _newParent = ContentRepository.GetDefault<StartPage>(_startPageReference);
            _newParent.PageName = "NewParent";
            _newParent.LinkURL = "newparent";
            ContentRepository.Save(_newParent, SaveAction.Publish, AccessLevel.NoAccess);

            _pageToMove = ContentRepository.GetDefault<StartPage>(_oldParentReference);
            _pageToMove.PageName = "PageToMove";
            ContentRepository.Save(_pageToMove, SaveAction.Publish, AccessLevel.NoAccess);
        }
开发者ID:stefanforsberg,项目名称:WhiteMagic,代码行数:25,代码来源:when_moving_a_page.cs


示例7: List

        public virtual PageDataCollection List(PageReference pageLink)
        {
            // Using functionality from
            // http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-CMS/9/Search/Searching-for-pages-based-on-page-type/
            string pageTypeId = _pageTypeRepository.Load<StandardPage>()?.ID.ToString();
            if (pageTypeId == null)
            {
                return new PageDataCollection();
            }

            PropertyCriteria productPageTypeCriterion = new PropertyCriteria
            {
                Name = "PageTypeID",
                Type = PropertyDataType.PageType,
                Value = pageTypeId,
                Condition = CompareCondition.Equal,
                Required = true
            };

            var criteria = new PropertyCriteriaCollection
            {
                productPageTypeCriterion
            };

            PageDataCollection pageDataCollection = _searchPages.FindPagesWithCriteria(pageLink, criteria);

            return pageDataCollection;
        }
开发者ID:alfnilsson,项目名称:ascend2015,代码行数:28,代码来源:4+FindPagesWithCriteria.cs


示例8: List

        public PageDataCollection List(PageReference pageLink)
        {
            // This is to display before and after SessionState
            Thread.Sleep(3000);

            return new PageDataCollection();
        }
开发者ID:alfnilsson,项目名称:ascend2015,代码行数:7,代码来源:0+IStandardPageRepository.cs


示例9: GetBreadCrumbs

        /// <summary>
        /// Returns breadcrumbs specific to the block that should be added to navigation
        /// based on the current page reference.  This function is called during the page's
        /// oninit to load any initial breadcrumbs
        /// </summary>
        /// <param name="pageReference">The page reference.</param>
        /// <returns></returns>
        public override List<BreadCrumb> GetBreadCrumbs( PageReference pageReference )
        {
            var breadCrumbs = new List<BreadCrumb>();

            int controllerId = int.MinValue;
            if ( int.TryParse( PageParameter( "controller" ), out controllerId ) )
            {
                var controller = new RestControllerService( new RockContext() ).Get( controllerId );
                if ( controller != null )
                {
                    string name = controller.Name.SplitCase();
                    var controllerType = Reflection.FindTypes( typeof( Rock.Rest.ApiControllerBase ) )
                        .Where( a => a.Key.Equals( controller.ClassName ) ).Select( a => a.Value ).FirstOrDefault();
                    if ( controllerType != null )
                    {
                        var obsoleteAttribute = controllerType.GetCustomAttribute<System.ObsoleteAttribute>();
                        if (obsoleteAttribute != null)
                        {
                            hlblWarning.Text = string.Format( "Obsolete: {1}", controller.Name.SplitCase(), obsoleteAttribute.Message );
                        }
                    }

                    lControllerName.Text = name + " Controller";
                    breadCrumbs.Add( new BreadCrumb( name, pageReference ) );
                }
            }

            return breadCrumbs;
        }
开发者ID:NewPointe,项目名称:Rockit,代码行数:36,代码来源:RestActionList.ascx.cs


示例10: AddPersonToNews

        private void AddPersonToNews()
        {
            var employees = GetEmployees().Select(e => e.FirstName + " " + e.LastName).ToArray();
            var random = new Random();

            var repo = ServiceLocator.Current.GetInstance<IContentRepository>();
            var pagereference = new PageReference(5);

            var news = repo.GetChildren<Nyhet>(pagereference);

            foreach (var n in news)
            {
                if (!string.IsNullOrEmpty(n.Author))
                {
                    continue;
                }
                var clone = (Nyhet) n.CreateWritableClone();

                var empNo = random.Next(employees.Length);
                var emp = employees[empNo];

                clone.Author = emp;
                clone.MainIntro = n.MainIntro + " Oppdiktet av " + emp + ".";

                repo.Save(clone, SaveAction.Publish);
            }
        }
开发者ID:kennethdevik,项目名称:episerver_find_poc,代码行数:27,代码来源:SvadaNyhetsGenerator.cs


示例11: IsInVirtualRole

        public override bool IsInVirtualRole(IPrincipal principal, object context)
        {
            var httpContext = HttpContext.Current;
            if (httpContext == null)
                return false;

            var queryStringToken = httpContext.Request.QueryString["token"];
            if (string.IsNullOrEmpty(queryStringToken))
                return false;

            if (!ParseGuid(queryStringToken))
                return false;

            var pageRef = new PageReference(httpContext.Request.QueryString["id"]);
            var pageLanguage = httpContext.Request.QueryString["epslanguage"];
            
            var tokenGuid = new Guid(queryStringToken);
            if (tokenGuid == Guid.Empty)
                return false;

            Logger.InfoFormat("Token present and has the correct format {0}", tokenGuid);

            var tokenStore = new AccessTokenDataStore();
            return tokenStore.PresentToken(tokenGuid, pageRef.ID, pageRef.WorkID, pageLanguage);
        }
开发者ID:markeverard,项目名称:POSSIBLE.TokenBasedAccess,代码行数:25,代码来源:AccessTokenRole.cs


示例12: ListVersions

		/// <summary>
		/// Lists the versions.
		/// </summary>
		/// <param name="pageLink">The page link.</param>
		/// <param name="languageBranch">The language branch.</param>
		/// <returns></returns>
		public override PageVersionCollection ListVersions(PageReference pageLink, string languageBranch)
		{
			var versions = new PageVersionCollection();
			versions.AddRange(PageVersion.List(pageLink).Where(version =>
				version.LanguageBranch.Equals(languageBranch, StringComparison.OrdinalIgnoreCase)));
			return versions;
		}
开发者ID:nansen,项目名称:EPiServer.CommerceSiteMappings,代码行数:13,代码来源:MyMappedPageProvider.cs


示例13: GetBreadCrumbs

        /// <summary>
        /// Returns breadcrumbs specific to the block that should be added to navigation
        /// based on the current page reference.  This function is called during the page's
        /// oninit to load any initial breadcrumbs
        /// </summary>
        /// <param name="pageReference">The page reference.</param>
        /// <returns></returns>
        public override List<BreadCrumb> GetBreadCrumbs( PageReference pageReference )
        {
            var rockContext = new RockContext();
            var breadCrumbs = new List<BreadCrumb>();

            ConnectionRequest connectionRequest = null;

            int? requestId = PageParameter( "ConnectionRequestId" ).AsIntegerOrNull();
            if ( requestId.HasValue && requestId.Value > 0 )
            {
                connectionRequest = new ConnectionRequestService( rockContext ).Get( requestId.Value );
            }

            if ( connectionRequest != null )
            {
                breadCrumbs.Add( new BreadCrumb( connectionRequest.PersonAlias.Person.FullName, pageReference ) );
            }
            else
            {
                var connectionOpportunity = new ConnectionOpportunityService( rockContext ).Get( PageParameter( "ConnectionOpportunityId" ).AsInteger() );
                if ( connectionOpportunity != null )
                {
                    breadCrumbs.Add( new BreadCrumb( String.Format( "New {0} Connection Request", connectionOpportunity.Name ), pageReference ) );
                }
                else
                {
                    breadCrumbs.Add( new BreadCrumb( "New Connection Request", pageReference ) );
                }
            }

            return breadCrumbs;
        }
开发者ID:NewSpring,项目名称:Rock,代码行数:39,代码来源:ConnectionRequestDetail.ascx.cs


示例14: GetNewUrl

        public string GetNewUrl(string oldUrl)
        {
            if(!oldUrl.EndsWith("/"))
            {
                oldUrl += "/";
            }

            // lookup Url in DDS
            var store = typeof(UrlRemapEntity).GetStore();
            var foundItem = store.Items<UrlRemapEntity>().FirstOrDefault(i => i.OldUrl.Equals(oldUrl));

            if(foundItem != null)
            {
                var reference = new PageReference(foundItem.PageId);
                var pageData = DataFactory.Instance.GetPage(reference);
                pageData = pageData.GetPageLanguage(foundItem.LanguageBranch);
                var builder = new UrlBuilder(UriSupport.AddLanguageSelection(pageData.LinkURL, pageData.LanguageBranch));

                if(Global.UrlRewriteProvider.ConvertToExternal(builder, pageData.PageLink, Encoding.UTF8))
                {
                    return builder.Uri.ToString();
                }
            }

            return null;
        }
开发者ID:ajuris,项目名称:opensource,代码行数:26,代码来源:OldNewUrlMapper.cs


示例15: ContentReference

        protected internal ContentReference(PageReference pageReference)
        {
            if(pageReference == null)
                throw new ArgumentNullException("pageReference");

            this._pageReference = pageReference;
        }
开发者ID:HansKindberg-Net,项目名称:HansKindberg-EPiServer-CMS7-Abstractions,代码行数:7,代码来源:ContentReference.cs


示例16: Send

        public void Send(PageReference mailReference, NameValueCollection nameValueCollection, string toEmail, string language)
        {
            var body = GetHtmlBodyForMail(mailReference, nameValueCollection, language);
            var mailPage = _contentLoader.Get<MailBasePage>(mailReference);

            Send(mailPage.MailTitle, body, toEmail);
        }
开发者ID:javafun,项目名称:Quicksilver,代码行数:7,代码来源:MailService.cs


示例17: GetBreadCrumbs

        /// <summary>
        /// Gets the bread crumbs.
        /// </summary>
        /// <param name="pageReference">The page reference.</param>
        /// <returns></returns>
        public override List<BreadCrumb> GetBreadCrumbs( PageReference pageReference )
        {
            var breadCrumbs = new List<BreadCrumb>();

            var itemIds = GetNavHierarchy().AsIntegerList();
            int? itemId = PageParameter( pageReference, "contentItemId" ).AsIntegerOrNull();
            if ( itemId != null )
            {
                itemIds.Add( itemId.Value );
            }

            foreach( var contentItemId in itemIds )
            {
                ContentChannelItem contentItem = new ContentChannelItemService( new RockContext() ).Get( contentItemId );
                if ( contentItem != null )
                {
                    breadCrumbs.Add( new BreadCrumb( contentItem.Title, pageReference ) );
                }
                else
                {
                    breadCrumbs.Add( new BreadCrumb( "New Content Item", pageReference ) );
                }
            }

            return breadCrumbs;
        }
开发者ID:NewSpring,项目名称:Rock,代码行数:31,代码来源:ContentChannelItemDetail.ascx.cs


示例18: GetBreadCrumbs

        /// <summary>
        /// Returns breadcrumbs specific to the block that should be added to navigation
        /// based on the current page reference.  This function is called during the page's
        /// oninit to load any initial breadcrumbs.
        /// </summary>
        /// <param name="pageReference">The <see cref="Rock.Web.PageReference" />.</param>
        /// <returns>
        /// A <see cref="System.Collections.Generic.List{BreadCrumb}" /> of block related <see cref="Rock.Web.UI.BreadCrumb">BreadCrumbs</see>.
        /// </returns>
        public override List<BreadCrumb> GetBreadCrumbs( PageReference pageReference )
        {
            var breadCrumbs = new List<BreadCrumb>();

            int? batchId = PageParameter( pageReference, "batchId" ).AsIntegerOrNull();
            if ( batchId != null )
            {
                string batchName = new FinancialBatchService( new RockContext() )
                    .Queryable().Where( b => b.Id == batchId.Value )
                    .Select( b => b.Name )
                    .FirstOrDefault();

                if ( !string.IsNullOrWhiteSpace( batchName ) )
                {
                    breadCrumbs.Add( new BreadCrumb( batchName, pageReference ) );
                }
                else
                {
                    breadCrumbs.Add( new BreadCrumb( "New Batch", pageReference ) );
                }
            }
            else
            {
                // don't show a breadcrumb if we don't have a pageparam to work with
            }

            return breadCrumbs;
        }
开发者ID:RMRDevelopment,项目名称:Rockit,代码行数:37,代码来源:BatchDetail.ascx.cs


示例19: FakePageReferenceFacade

 public FakePageReferenceFacade(PageReference rootPage,
     PageReference startPage,
     PageReference wasteBasket)
 {
     this.startPage = startPage;
     this.rootPage = rootPage;
     this.wasteBasket = wasteBasket;
 }
开发者ID:joelabrahamsson,项目名称:EPiAbstractions,代码行数:8,代码来源:FakePageReferenceFacade.cs


示例20: FindPagesWithCriteria

 public PageDataCollection FindPagesWithCriteria(PageReference start, params PropertyCriteria[] criteria)
 {
     foreach (var criterion in criteria)
     {
         Console.WriteLine(criterion.EquatableWithFormatting());
     }
     return _inner.FindPagesWithCriteria(start, criteria);
 }
开发者ID:akselsson,项目名称:LinqToEPiServer,代码行数:8,代码来源:ConsoleLoggingQueryExecutor.cs



注:本文中的PageReference类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PageType类代码示例发布时间:2022-05-24
下一篇:
C# PageOrientation类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap