private ReportTreeNode CopyReport(Serialization.Node src, int businessUnitId) { ReportTreeNode dst = null; if (IsAuthorized(src, businessUnitId)) { ReportHandle handle = new ReportHandle(); CopyFields(handle, src); Serialization.ReportReference reference = (Serialization.ReportReference)src.Content.Items[0]; if (reference.ComingSoon) { handle.ComingSoon = true; } else { handle.Report = FindReport(reference.Value, true); } dst = handle; } return(dst); }
private Serialization.Node FindNode(Serialization.Node node, string id) { if (node.Id.Equals(id)) { return(node); } else if (node.NodeType.Equals(Serialization.NodeType.ReportHandle)) { return(null); } else { foreach (Serialization.Node child in node.Content.Items) { Serialization.Node result = FindNode(child, id); if (result != null) { return(result); } } return(null); } }
private ReportTreeNode Copy(Serialization.Node node, int businessUnitId) { if (node.NodeType.Equals(Serialization.NodeType.ReportGroup)) { return(CopyGroup(node, businessUnitId)); } else { return(CopyReport(node, businessUnitId)); } }
private ReportTreeNode CopyGroup(Serialization.Node src, int businessUnitId) { ReportGroup dst = new ReportGroup(); CopyFields(dst, src); foreach (Serialization.Node node in src.Content.Items) { ReportTreeNode child = Copy(node, businessUnitId); if (child != null) { dst.Children.Add(child); } } return(dst); }
public override IReportTreeNode BuildReportTree(string id, int businessUnitId) { Serialization.ReportCenterMetadata metadata = Serialization.Metadata.Instance.Cache; IReportTreeNode root = null; foreach (Serialization.Panel panel in metadata.Panels) { Serialization.Node node = FindNode(panel.Node, id); if (node != null) { root = Copy(node, businessUnitId); break; } } return(root); }
private bool IsAuthorized(Serialization.Node node, int businessUnitId) { return(IsAuthorized(((Serialization.ReportReference)node.Content.Items[0]).Value, businessUnitId)); }
private void CopyFields(ReportTreeNode dst, Serialization.Node src) { dst.Title = src.Title; dst.Description = src.Description; dst.NodeType = (ReportTreeNodeType)Enum.Parse(typeof(ReportTreeNodeType), src.NodeType.ToString()); }