本文整理汇总了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)
});
}
示例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();
}
示例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();
}
}
示例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
}
示例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;
}
示例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);
}
示例7: Navigation
protected NavigationMenu Navigation()
{
Node node = new Node(1080);
var mainMenu = ModelFactory.CreateModel<NavigationMenu>(node);
DetermineCurrentItem(mainMenu);
return mainMenu;
}
示例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;
}
示例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();
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}