Ejemplo n.º 1
0
        private void ReportSourceControl_Load(object sender, EventArgs e)
        {
            _rpt = ModelDesignProject.GetLibReportsSourceById(_funNode.Name);

            LibTreeNode rptNode = new LibTreeNode();

            rptNode.Name     = _funNode.Name;
            rptNode.Text     = ReSourceManage.GetResource(NodeType.ReportPanel);
            rptNode.NodeType = NodeType.ReportPanel;
            if (_rpt.GridGroups != null)
            {
                foreach (LibReportGrid grid in _rpt.GridGroups)
                {
                    #region 创建表格组节点
                    LibTreeNode gdgroupNode = new LibTreeNode();
                    gdgroupNode.NodeId   = grid.GridGroupID;
                    gdgroupNode.NodeType = NodeType.GridGroup;
                    gdgroupNode.Name     = grid.GridGroupName;
                    gdgroupNode.Text     = grid.GridGroupDisplayNm;
                    rptNode.Nodes.Add(gdgroupNode);
                    #endregion
                    if (grid.ReportFields != null)
                    {
                        foreach (LibReportField fd in grid.ReportFields)
                        {
                            #region 创建表格组字段节点
                            LibTreeNode gdgroupfield = new LibTreeNode();
                            gdgroupfield.NodeType = NodeType.GridGroup_Field;
                            gdgroupfield.NodeId   = fd.ID;
                            gdgroupfield.Name     = fd.Name;
                            gdgroupfield.Text     = fd.Name;
                            gdgroupNode.Nodes.Add(gdgroupfield);
                            #endregion
                        }
                    }
                }
            }
            if (_rpt.Containers != null)
            {
                foreach (LibReportContainer container in _rpt.Containers)
                {
                    #region 创建栅格容器节点
                    LibTreeNode containerNode = new LibTreeNode();
                    containerNode.NodeId   = container.ContainerID;
                    containerNode.NodeType = NodeType.ReportContainer;
                    containerNode.Name     = container.ContainerNm;
                    containerNode.Text     = container.ContainerNm;
                    rptNode.Nodes.Add(containerNode);
                    #endregion
                    if (container.ReportRows != null)
                    {
                        foreach (LibReportRow row in container.ReportRows)
                        {
                            #region 栅格行节点
                            LibTreeNode rowNode = new LibTreeNode();
                            rowNode.NodeId   = row.RowID;
                            rowNode.NodeType = NodeType.ReportRow;
                            rowNode.Name     = row.RowNm;
                            rowNode.Text     = row.RowNm;
                            containerNode.Nodes.Add(rowNode);
                            #endregion
                            if (row.ReportCols != null)
                            {
                                foreach (LibReportColumn col in row.ReportCols)
                                {
                                    #region 栅格列节点
                                    LibTreeNode colNode = new LibTreeNode();
                                    colNode.NodeId   = col.ColumnID;
                                    colNode.NodeType = NodeType.ReportCol;
                                    colNode.Name     = col.ColumnNm;
                                    colNode.Text     = col.ColumnNm;
                                    rowNode.Nodes.Add(colNode);
                                    #endregion
                                    if (col.Elements != null)
                                    {
                                        foreach (LibReportElement ele in col.Elements)
                                        {
                                            #region 元素节点
                                            LibTreeNode eleNode = new LibTreeNode();
                                            eleNode.NodeId   = ele.ElementID;
                                            eleNode.NodeType = NodeType.ReportElement;
                                            eleNode.Name     = ele.ElementNm;
                                            eleNode.Text     = ele.ElementNm;
                                            colNode.Nodes.Add(eleNode);
                                            #endregion
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            this.treeView1.Nodes.Add(rptNode);
            this.treeView1.SelectedNode = rptNode;
        }