Advertisement
Guest User

Untitled

a guest
Jun 25th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.68 KB | None | 0 0
  1. public void recursive()
  2. {
  3. inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "This key contains:");
  4. //foreach (Int32 key in dictionary.Keys)
  5. //{
  6. int key = 2155;
  7. inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "key : " + key);
  8.  
  9. var catalogdto = new inRiver.Dto.CatalogDTO();
  10. catalogdto.Id = this.dictionary[key].id.ToString();
  11. catalogdto.Name = this.dictionary[key].channelname;
  12. catalogdto.Children = new List<inRiver.Dto.CatalogDTO>();
  13. inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "#Childs: " + this.dictionary[key].list_of_childs.Count());
  14. foreach (ChildId child in this.dictionary[key].list_of_childs)
  15. {
  16. inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "for loop 1");
  17. var childDto = new inRiver.Dto.CatalogDTO();
  18. inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "for loop 2");
  19. //childDto.Id = child.ToString();
  20. inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "for loop 3");
  21. //childDto.Name = this.dictionary[child].channelname;
  22. inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "for loop 4");
  23. catalogdto.Children.Add(getChildren(this.dictionary[key], childDto));
  24. inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "for loop 5");
  25. }
  26. inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "for loop 6");
  27. var transferObject = inRiver.Dto.Factories.TransferFactory.CreateTransferObject(catalogdto);
  28. inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "for loop 7");
  29. string transferObject_string = JsonConvert.SerializeObject(transferObject, Newtonsoft.Json.Formatting.Indented);
  30. inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "for loop 8");
  31. System.IO.File.WriteAllText(NewExportPath(key), transferObject_string);
  32. inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "for loop 9");
  33. //}
  34.  
  35. }
  36. public CatalogDTO getChildren (ChannelHandler current, inRiver.Dto.CatalogDTO result )
  37. {
  38. inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "Current: " + current.id);
  39. result.Id = current.id.ToString();
  40. result.Name = current.channelname;
  41. result.Children = new List<inRiver.Dto.CatalogDTO>();
  42. var children = current.list_of_childs;
  43. foreach(var child in children)
  44. {
  45. inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "child: " + child);
  46. inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "child: " + this.dictionary[child].channelname);
  47. inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "child: " + this.dictionary[child].list_of_childs.Count());
  48. inRiver.Dto.CatalogDTO middle = new inRiver.Dto.CatalogDTO();
  49. middle.Id = child.ToString();
  50. middle.Name = this.dictionary[child].channelname;
  51. result = getChildren(this.dictionary[child],middle);
  52. inRiver.Integration.Reporting.ReportManager.Instance.Write(this.Id, "Recursive return: " + child);
  53. }
  54. return result;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement