本文整理汇总了C#中umbraco.NodeFactory.Node类的典型用法代码示例。如果您正苦于以下问题:C# Node类的具体用法?C# Node怎么用?C# Node使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Node类属于umbraco.NodeFactory命名空间,在下文中一共展示了Node类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: LoadUwebshopEntityPropertiesFromNode
internal static void LoadUwebshopEntityPropertiesFromNode(uWebshopEntity entity, Node node)
{
if (entity.Id == 0) entity.Id = node.Id;
entity.ParentId = node.Parent != null ? node.Parent.Id : -1;
entity.SortOrder = node.SortOrder;
entity.NodeTypeAlias = node.NodeTypeAlias;
entity.Name = node.Name;
entity.Path = node.Path;
entity.CreateDate = node.CreateDate;
entity.UpdateDate = node.UpdateDate;
entity.UrlName = node.UrlName;
}
开发者ID:Chuhukon,项目名称:uWebshop-Releases,代码行数:12,代码来源:Helpers.cs
示例17: GetByNiceUrl
/// <summary>
/// Gets an umbraco node by its NiceUrl.
/// </summary>
/// <param name="niceUrl">The NiceUrl path.</param>
/// <returns>Node.</returns>
public virtual Node GetByNiceUrl(string niceUrl)
{
var xmlNode = umbraco.library.GetXmlNodeByXPath(umbraco.requestHandler.CreateXPathQuery(niceUrl, false).Replace("[ ", "[@urlName ").Replace("/root/*", "/root//*"));
xmlNode.MoveNext();
var idStr = xmlNode.Current.GetAttribute("id", string.Empty);
var id = 0;
Node node = null;
if (int.TryParse(idStr, out id))
{
node = new Node(id);
}
return node;
}
开发者ID:coding3d,项目名称:InstantRDF,代码行数:18,代码来源:UmbracoNodeRepository.cs
示例18: NodeNavigation
public static object NodeNavigation(Node node)
{
return
new
{
node.NiceUrl,
node.Name,
Visible = NodeVisible(node),
node.Id,
node.UrlName,
Children = node.ChildrenAsList.Select(n => NodeNavigation(n as Node))
};
}
开发者ID:joeriks,项目名称:UmbracoPublishedContentApi,代码行数:13,代码来源:ContentHelpers.cs
示例19: GetParentNode
private static Node GetParentNode(int nodeId, string typeName)
{
var node = new Node(nodeId);
Node parentNode = (Node)node.Parent;
if (parentNode.NodeTypeAlias == typeName)
{
return parentNode;
}
else
{
return GetParentNode(parentNode.Id, typeName);
}
}
开发者ID:wakkomail,项目名称:community-framework,代码行数:14,代码来源:NodeHelper.cs
示例20: GetMembers
private void GetMembers()
{
if (ShowNewest)
{
this.header.InnerHtml = "Nieuwe leden";
//var group = MemberGroup.GetByName(MembershipHelper.ForumUserRoleName);
var members = Member.GetAll.OrderByDescending(x => x.CreateDateTime).Take(5);//group.GetMembers().OrderByDescending(x => x.CreateDateTime).Take(5);
if (members.Any())
{
rprMembers.DataSource = members;
rprMembers.DataBind();
}
}
else
{
this.header.InnerHtml = "Groepsleden";
ForumCategory currentCategory = null;
switch (CurrentNode.NodeTypeAlias)
{
case global.GlobalConstants.MembergroupAlias:
case global.GlobalConstants.ProjectAlias:
currentCategory = Mapper.MapForumCategory(CurrentNode);
break;
case global.GlobalConstants.DiscussionAlias:
ForumTopic currentTopic = Mapper.MapForumTopic(CurrentNode);
Node categoryNode = new Node(currentTopic.CategoryId);
currentCategory = Mapper.MapForumCategory(categoryNode);
break;
default:
break;
}
if(currentCategory != null)
{
MemberGroup group = MemberGroup.GetByName(currentCategory.Name);
if(group != null)
{
rprMembers.DataSource = group.GetMembers();
rprMembers.DataBind();
}
}
}
}
开发者ID:wakkomail,项目名称:community-framework,代码行数:48,代码来源:MembersList.ascx.cs
注:本文中的umbraco.NodeFactory.Node类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论