Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void recursive()
- {
- inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "This key contains:");
- //foreach (Int32 key in dictionary.Keys)
- //{
- int key = 2155;
- inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "key : " + key);
- var catalogdto = new inRiver.Dto.CatalogDTO();
- catalogdto.Id = this.dictionary[key].id.ToString();
- catalogdto.Name = this.dictionary[key].channelname;
- catalogdto.Children = new List<inRiver.Dto.CatalogDTO>();
- inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "#Childs: " + this.dictionary[key].list_of_childs.Count());
- foreach (ChildId child in this.dictionary[key].list_of_childs)
- {
- inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "for loop 1");
- var childDto = new inRiver.Dto.CatalogDTO();
- inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "for loop 2");
- //childDto.Id = child.ToString();
- inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "for loop 3");
- //childDto.Name = this.dictionary[child].channelname;
- inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "for loop 4");
- catalogdto.Children.Add(getChildren(this.dictionary[key], childDto));
- inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "for loop 5");
- }
- inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "for loop 6");
- var transferObject = inRiver.Dto.Factories.TransferFactory.CreateTransferObject(catalogdto);
- inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "for loop 7");
- string transferObject_string = JsonConvert.SerializeObject(transferObject, Newtonsoft.Json.Formatting.Indented);
- inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "for loop 8");
- System.IO.File.WriteAllText(NewExportPath(key), transferObject_string);
- inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "for loop 9");
- //}
- }
- public CatalogDTO getChildren (ChannelHandler current, inRiver.Dto.CatalogDTO result )
- {
- inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "Current: " + current.id);
- result.Id = current.id.ToString();
- result.Name = current.channelname;
- result.Children = new List<inRiver.Dto.CatalogDTO>();
- var children = current.list_of_childs;
- foreach(var child in children)
- {
- inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "child: " + child);
- inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "child: " + this.dictionary[child].channelname);
- inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "child: " + this.dictionary[child].list_of_childs.Count());
- inRiver.Dto.CatalogDTO middle = new inRiver.Dto.CatalogDTO();
- middle.Id = child.ToString();
- middle.Name = this.dictionary[child].channelname;
- result = getChildren(this.dictionary[child],middle);
- inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "Recursive return: " + child);
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement