當前位置: 首頁>>代碼示例>>C#>>正文


C# NodeFactory.Node類代碼示例

本文整理匯總了C#中umbraco.NodeFactory.Node的典型用法代碼示例。如果您正苦於以下問題:C# Node類的具體用法?C# Node怎麽用?C# Node使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Node類屬於umbraco.NodeFactory命名空間,在下文中一共展示了Node類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: node

    public static string node(int nodeId)
    {
        var node = new umbraco.NodeFactory.Node(nodeId);

        // I think getting template name requires a database hit
        /*var template = new umbraco.cms.businesslogic.template.Template(node.template); */

        return Json.Encode(
        new
        {
            node.Name,
            node.UrlName,
            node.NodeTypeAlias,
            node.CreatorName,
            node.template,
            /*Template = template.Alias,*/
            Properties = node.PropertiesAsList.Select(p => new { p.Alias, Value=replacemedia(p.Value) }).ToDictionary(k => k.Alias, k => k.Value),
            node.CreateDate,
            node.UpdateDate,
            node.SortOrder,
            node.Url,
            ParentId = (node.Parent != null) ? node.Parent.Id : -1,
            ChildIds = node.ChildrenAsList.Select(n => n.Id)
        });
    }
開發者ID:joeriks,項目名稱:UmbracoExternalContents,代碼行數:25,代碼來源:content.cs

示例2: LoadView

        public void LoadView()
        {
            UrlTrackerDomain domain = null;
            Node redirectRootNode = new Node(UrlTrackerModel.RedirectRootNodeId);

            List<UrlTrackerDomain> domains = UmbracoHelper.GetDomains();
            domain = domains.FirstOrDefault(x => x.NodeId == redirectRootNode.Id);
            if (domain == null)
                domain = new UrlTrackerDomain(-1, redirectRootNode.Id, HttpContext.Current.Request.Url.Host);
            if (!domains.Any())
                pnlRootNode.Visible = false;
            else
            {
                lnkRootNode.Text = string.Format("{0} ({1})", domain.Node.Name, domain.Name);
                lnkRootNode.ToolTip = UrlTrackerResources.SyncTree;
                lnkRootNode.NavigateUrl = string.Format("javascript:parent.UmbClientMgr.mainTree().syncTree('{1}', false);", redirectRootNode.Id, redirectRootNode.Path);
            }

            lnkOldUrl.Text = string.Format("{0} <i class=\"icon-share\"></i>", UrlTrackerModel.CalculatedOldUrl);
            lnkOldUrl.NavigateUrl = UrlTrackerModel.CalculatedOldUrlWithDomain;
            Node redirectNode = new Node(UrlTrackerModel.RedirectNodeId.Value);
            lnkRedirectNode.Text = redirectNode.Name;
            lnkRedirectNode.ToolTip = UrlTrackerResources.SyncTree;
            lnkRedirectNode.NavigateUrl = string.Format("javascript:parent.UmbClientMgr.mainTree().syncTree('{1}', false);", redirectNode.Id, redirectNode.Path);
            if (UrlTrackerModel.RedirectHttpCode == 301)
                rbPermanent.Checked = true;
            else if (UrlTrackerModel.RedirectHttpCode == 302)
                rbTemporary.Checked = true;
            cbRedirectPassthroughQueryString.Checked = UrlTrackerModel.RedirectPassThroughQueryString;
            lblNotes.Text = UrlTrackerModel.Notes;
            lblInserted.Text = UrlTrackerModel.Inserted.ToString();
        }
開發者ID:neehouse,項目名稱:UrlTracker,代碼行數:32,代碼來源:AutoView.ascx.cs

示例3: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                string baseUrl = string.Format("{0}", (Request.ApplicationPath.Equals("/")) ? string.Empty : Request.ApplicationPath);

                Node currentPage = new Node(CurrentPageId);
                List<Contact> contactList = new List<Contact>();
                foreach (Node node in currentPage.Children)
                {
                    if (node.NodeTypeAlias == "Contact")
                    {
                        Contact contact = new Contact();
                        contact.Name = node.Name;
                        contact.Position = node.GetProperty("position").Value ?? "";
                        contact.Email = node.GetProperty("email").Value ?? "";
                        contact.Phone = node.GetProperty("phone").Value ?? "";

                        int imageId = 0;
                        if (int.TryParse(node.GetProperty("image").Value ?? "", out imageId))
                        {
                            var mediaService = ServiceLocator.Instance.Locate<IMediaService>();
                            var media = mediaService.GetById(imageId);
                            contact.ImageUrl = media.GetValue<string>("umbracoFile").Replace("~", baseUrl);
                        }

                        contactList.Add(contact);
                    }
                }

                contacts.DataSource = contactList;
                contacts.DataBind();
            }
        }
開發者ID:shferguson,項目名稱:ppc2010,代碼行數:34,代碼來源:ContactList.ascx.cs

示例4: Document_BeforeMove

        void Document_BeforeMove(object sender, MoveEventArgs e)
        {
            #if !DEBUG
            try
            #endif
            {
                Document doc = sender as Document;
            #if !DEBUG
                try
            #endif
                {
                    if (doc != null)
                    {
                        Node node = new Node(doc.Id);

                        if (node != null && !string.IsNullOrEmpty(node.NiceUrl) && !doc.Path.StartsWith("-1,-20")) // -1,-20 == Recycle bin | Not moved to recycle bin
                            UrlTrackerRepository.AddUrlMapping(doc, node.GetDomainRootNode().Id, node.NiceUrl, AutoTrackingTypes.Moved);
                    }
                }
            #if !DEBUG
                catch (Exception ex)
                {
                    ex.LogException(doc.Id);
                }
            #endif
            }
            #if !DEBUG
            catch (Exception ex)
            {
                ex.LogException();
            }
            #endif
        }
開發者ID:neehouse,項目名稱:UrlTracker,代碼行數:33,代碼來源:UrlTrackerApplicationBase.cs

示例5: GetCaseFromUmbracoNode

        private Case GetCaseFromUmbracoNode(INode customerCase)
        {
            //laver cropUp imageUrl
            var imageId = customerCase.GetProperty("images").Value.Split(',').Where(x => string.IsNullOrEmpty(x) == false).Select(x => int.Parse(x)).FirstOrDefault();
            var imageUrl = imageId > 0 ? Umbraco.Media(imageId).Url : "";

            if (string.IsNullOrEmpty(imageUrl) == false)
            {
                var cropUpSizeDesktop = new ImageSizeArguments { Width = 300, Height = 225, CropMode = CropUpMode.BestFit, Zoom = true };
                imageUrl = CropUp.GetUrl("~" + imageUrl, cropUpSizeDesktop);
            }

            //henter kategori
            var catNode = new Node(Convert.ToInt32(customerCase.GetProperty("kategorier").Value));

            //laver return objekt
            var p = new Case
                {
                    Id = 0,
                    Headline = customerCase.Name,
                    Customer = customerCase.Parent.Name,
                    ImageUrl = imageUrl,
                    Url = customerCase.NiceUrl,
                    Created = customerCase.CreateDate,
                    Modified = customerCase.UpdateDate,
                    CategoryId = catNode.Id,
                    CategoryName = catNode.Name,
                    SortOrder = customerCase.Parent.SortOrder
                };

            return p;
        }
開發者ID:rpjengaard,項目名稱:louiseBankDk,代碼行數:32,代碼來源:CasesController.cs

示例6: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     Node node = new Node(1080);
     var mainMenu = ModelFactory.CreateModel<NavigationMenu>(node);
     DetermineCurrentItem(mainMenu);
     topNavigationContent.Text = MustacheHelper.RenderMustacheTemplate(this, "topNavigation", mainMenu);
 }
開發者ID:pdebacker,項目名稱:UmbCodeGen_Example_Project,代碼行數:7,代碼來源:MainNavigation.ascx.cs

示例7: Navigation

 protected NavigationMenu Navigation()
 {
     Node node = new Node(1080);
     var mainMenu = ModelFactory.CreateModel<NavigationMenu>(node);
     DetermineCurrentItem(mainMenu);
     return mainMenu;
 }
開發者ID:pdebacker,項目名稱:UmbCodeGen_Example_Project_Razor,代碼行數:7,代碼來源:BaseController.cs

示例8: CreateSettingsFromNode

		internal static Settings CreateSettingsFromNode(Node node)
		{
			if (node == null) throw new Exception("Trying to load data from null node");

			var product = new Settings();
			LoadDataFromNode(product, node);
			return product;
		}
開發者ID:Chuhukon,項目名稱:uWebshop-Releases,代碼行數:8,代碼來源:Settings.cs

示例9: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            CurrentNode = Node.GetCurrent();

            List<ArticleListItem> articlePages = articleBo.FindFullArticle(CurrentNode);
            ArticleMenuRepeater.DataSource = articlePages;
            ArticleMenuRepeater.DataBind();
        }
開發者ID:rubenski,項目名稱:Tekstenuitleg,代碼行數:8,代碼來源:ArticleMenu.ascx.cs

示例10: GetParentDocument

        private Node GetParentDocument(Node node)
        {
            if (node == null || node.Parent == null || node.NodeTypeAlias != DateDocumentType)
                return node;

            var parent = new Node(node.Parent.Id);
            return GetParentDocument(parent);
        }
開發者ID:TomDudfield,項目名稱:Umbraco.Auto.Documents,代碼行數:8,代碼來源:AutoDocuments.cs

示例11: GetMovieImages

 private void GetMovieImages(Cinema model)
 {
     foreach (var program in model.MoviePrograms)
     {
         Node movieNode = new Node(program.MovieLink.NodeId);
         program.MovieInfo = new MovieProgramInfo();
         ModelFactory.FillModel(program.MovieInfo, movieNode);
     }
 }
開發者ID:pdebacker,項目名稱:UmbCodeGen_Example_Project_Razor,代碼行數:9,代碼來源:CinemaController.cs

示例12: ImportPageContent

        public static void ImportPageContent(int importPageId)
        {
            Node importPage = new Node(importPageId);

            var rawData = APIHelper.GetPageRaw(importPage.GetProperty("gatherContentId").ToString());
            var structure = GetPageContentStructure(rawData);
            var pageContent = DecodeFrom64(structure.page.config);
            var pageStructure = GetPageStructure(pageContent);
            AddPageContent(pageStructure, importPageId);
        }
開發者ID:Philo,項目名稱:gulp-test,代碼行數:10,代碼來源:ImportContent.cs

示例13: GetNodeData

        /// <summary>
        /// Gets the umbraco node by id
        /// </summary>
        public HttpResponseMessage GetNodeData(int id)
        {
            var node = new Node(id);

            if (node.Id == 0)
                return NodeNotFound();

            var viewNode = ViewNode.Create(node);

            return JsonResponse(viewNode);
        }
開發者ID:cdrewery,項目名稱:umbraco-angular,代碼行數:14,代碼來源:NodeApiController.cs

示例14: GetByNodeId

        /// <summary>
        /// Gets an umbraco node, based on its node id.
        /// </summary>
        /// <param name="nodeId">The node id.</param>
        /// <returns></returns>
        /// <remarks></remarks>
        public virtual UmbracoNode GetByNodeId(int nodeId)
        {
            var nativeNode = new Node(nodeId);
            var node = new UmbracoNode() { Name = nativeNode.Name.Replace(" ", "-").Replace(".", "_"), Url = GetUrlPath(nodeId), UpdateDate = nativeNode.UpdateDate};
            LoadChildrenIds(nativeNode, node);
            LoadParentId(nativeNode, node);
            LoadProperties(nativeNode, node);
            LoadDocumentTypeId(nativeNode, node);

            return node;
        }
開發者ID:coding3d,項目名稱:InstantRDF,代碼行數:17,代碼來源:UmbracoNodeRepository.cs

示例15: GetFileUrl

        /// <summary>
        /// Method for getting a file url
        /// </summary>
        /// <param name="node">Node with file property</param>
        /// <param name="filePropertyAlias">Property alias</param>
        /// <returns>string</returns>
        public static string GetFileUrl(Node node, string filePropertyAlias)
        {
            if (!string.IsNullOrEmpty(node.GetProperty<string>(filePropertyAlias)))
            {
                var file =
                    ApplicationContext.Current.Services.MediaService.GetById(node.GetProperty<int>(filePropertyAlias));

                return file.GetValue<string>("umbracoFile");
            }

            return string.Empty;
        }
開發者ID:pjengaard,項目名稱:lilleGrundetDk,代碼行數:18,代碼來源:MediaMapper.cs


注:本文中的umbraco.NodeFactory.Node類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。