public static List<AtcClassification> getAtcBySyndicationFeed(IEnumerable<SyndicationItem> atcs) { List<AtcClassification> atcList = new List<AtcClassification>(); foreach (SyndicationItem item in atcs) { string ractName = item.Title.Text; int id = item.ElementExtensions.ReadElementExtensions<int>("id", vidalNameSpace).FirstOrDefault(); string feedid = item.Id; Uri altLink = null; SyndicationLink altSyndicationLink = item.Links.FirstOrDefault(l => (l.RelationshipType == "inline")); if (altSyndicationLink != null) { altLink = altSyndicationLink.Uri; } SyndicationLink productsLinkFeed = (item.Links.FirstOrDefault(l => (l.Title == "PRODUCTS"))); Uri productsLink = null; if (productsLinkFeed != null) { productsLink = productsLinkFeed.Uri; } AtcClassification atc = new AtcClassification(id,feedid, ractName, altLink,productsLink); atcList.Add(atc); } return atcList; }
private static void getClassifChildren(List<AtcClassification> pd, AtcClassification parent, TreeNode node) { IEnumerable<AtcClassification> children = pd.Where<AtcClassification>(l => ((l.parentLink != null ? l.parentLink.ToString() : null) == parent.feedid)); foreach (AtcClassification child in children) { TreeNode childNode = new TreeNode(); childNode.Name = child.feedid; childNode.Text = child.name; childNode.Tag = child; node.Nodes.Add(childNode); getClassifChildren(pd, child, childNode); } }