//-------------------------------------- //-------------------------------------- public List <ContentLinkInfo> ContentRecentNLinksGet(string type, int num) { List <ContentLinkInfo> linkInfoList = new List <ContentLinkInfo>(); List <ContentTransfer> xferList; try { xferList = repository.NodeTypeMostRecentNLeavesGet(type, num); if (xferList == null) { return(null); } foreach (ContentTransfer xfer in xferList) { ContentLinkInfo linkInfo = new ContentLinkInfo { Summary = xfer.Summary, Text = xfer.Title, Url = xfer.Path }; linkInfoList.Add(linkInfo); } } catch (Exception ex) { // Replace this with a call to the logger. Debug.Print(ex.Message); } return(linkInfoList); }
//-------------------------------------- //-------------------------------------- public List <ContentLinkInfo> ContentPathLinksGet(ContentNode node) { if (node == null) { return(null); } ContentLinkInfo linkInfo; List <ContentLinkInfo> linkInfoList = new List <ContentLinkInfo>(); string path; string[] segments; segments = node.Path.Split(ContentNode.pathDividerChar); path = ""; foreach (string segment in segments) { path += segment; linkInfo = new ContentLinkInfo { Summary = "", Text = segment, Url = path }; linkInfoList.Add(linkInfo); path += ContentNode.pathDividerStr; } return(linkInfoList); }
//-------------------------------------- //-------------------------------------- public List <ContentLinkInfo> ContentChildLinksGet(ContentNode node) { if (node == null) { return(null); } List <ContentTransfer> childNodes = new List <ContentTransfer>(); ContentLinkInfo linkInfo; List <ContentLinkInfo> linkInfoList = new List <ContentLinkInfo>(); int segmentChild; string[] segments; // The text for each child link will be the same as the child segment in the path. // The child segment follows the last segment in the parent path. segments = node.Path.Split(ContentNode.pathDividerChar); segmentChild = segments.Length; childNodes = repository.NodeChildrenGet(node.NodeId); if (childNodes == null) { return(null); } foreach (ContentTransfer childNode in childNodes) { segments = childNode.Path.Split(ContentNode.pathDividerChar); linkInfo = new ContentLinkInfo { Summary = childNode.Summary, Text = segments[segmentChild], Url = childNode.Path }; linkInfoList.Add(linkInfo); } return(linkInfoList); }