Ejemplo n.º 1
0
        /// <summary>
        /// 刷新节点
        /// </summary>
        /// <param name="Node"></param>
        /// <param name="withImage"></param>
        /// <param name="projectNo"></param>
        /// <param name="IsCount"></param>
        /// <param name="isAll"></param>
        public void RefreshFileNode(TreeNode NodeNode, bool withImage, string projectNo, bool isAll)
        {
            TreeNodeEx Node      = (TreeNodeEx)NodeNode;
            TreeView   treeView1 = Node.TreeView;

            ERM.CBLL.FileRegist cbll = new ERM.CBLL.FileRegist();
            ds = cbll.RegistGetNewFileRecording_Templet(projectNo);
            DataView dataView = new DataView(ds.Tables[0]);

            if (dataView.Count == 0)
            {
                treeView1.Nodes.Clear();
                return;
            }
            Node.Nodes.Clear();
            dataView.RowFilter = "id='" + Node.Name + "'";
            if (dataView.Count > 0)
            {
                treeView1.BeginUpdate();
                Node.Text = dataView[0]["title"].ToString();
                Node.Tag  = dataView[0]["table_name"].ToString();
                LoadFileChildNodes(Node.Nodes, Node.Name, withImage, isAll);
                Node.IsFirstExpand = false;
                treeView1.EndUpdate();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 增加节点
        /// </summary>
        /// <param name="Node"></param>
        /// <param name="projectNo"></param>
        public void AddFileNode(TreeNodeEx Node, string projectNo)
        {
            int           intCount = 0;
            List <string> list     = new List <string>();

            ERM.CBLL.FileRegist cbll = new ERM.CBLL.FileRegist();
            string fullPath          = OpeartPath(Node);

            if (Node.ImageIndex != 4)
            {
                ds = cbll.GetArchiveDataAtPath(fullPath, projectNo);
                DataView dataView = new DataView(ds.Tables[0]);
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    TreeNodeEx NewNode = new TreeNodeEx();
                    NewNode.Name               = ds.Tables[0].Rows[i]["id"].ToString();
                    NewNode.NodeKey            = ds.Tables[0].Rows[i]["filepath"].ToString(); //表格代码
                    NewNode.NodeValue          = ds.Tables[0].Rows[i]["filepath"].ToString(); //华表路径
                    NewNode.ImageIndex         = 3;
                    NewNode.SelectedImageIndex = 3;
                    NewNode.Text               = ds.Tables[0].Rows[i]["title"].ToString(); //标题
                    Node.Nodes.Add(NewNode);
                    list.Add(ds.Tables[0].Rows[i]["title"].ToString());
                    intCount++;
                }
            }
            DataSet ADS    = cbll.GetAttachment(fullPath, Globals.ProjectNO);
            bool    IsHave = true;

            for (int i = 0; i < ADS.Tables[0].Rows.Count; i++)
            {
                TreeNodeEx NewNode = new TreeNodeEx();
                for (int j = 0; j < list.Count; j++)
                {
                    if (ADS.Tables[0].Rows[i]["title"].ToString().Equals(ds.Tables[0].Rows[j]["title"].ToString()))
                    {
                        IsHave = false;
                        break;
                    }
                }
                if (IsHave)
                {
                    NewNode.Name               = ADS.Tables[0].Rows[i]["attachid"].ToString();
                    NewNode.NodeKey            = ADS.Tables[0].Rows[i]["attachid"].ToString(); //表格代码
                    NewNode.NodeValue          = ADS.Tables[0].Rows[i]["filepath"].ToString(); //华表路径
                    NewNode.ImageIndex         = 3;
                    NewNode.SelectedImageIndex = 3;
                    NewNode.Text               = ADS.Tables[0].Rows[i]["title"].ToString(); //标题
                    Node.Nodes.Add(NewNode);
                    intCount++;
                }
                IsHave = true;
            }
            Node.Expand();
            ds = null;
        }
Ejemplo n.º 3
0
        public string GetFinal_fileCount(TreeNodeEx node)
        {
            ERM.CBLL.FileRegist cbll = new ERM.CBLL.FileRegist();
            string count             = "[0]";
            string NUM = cbll.GetAttachmentListCount(OpeartPath(node), Globals.ProjectNO);

            if (!String.IsNullOrEmpty(NUM))
            {
                count = "[" + NUM + "]";
            }
            return(count);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 获取树的节点,跟其他方法合用
        /// </summary>
        /// <param name="nodes">TreeNodeCollection</param>
        /// <param name="nodeID">要查询的节点</param>
        /// 用递归的方法读取树
        /// </summary>
        /// <param name="treeView">需要把数据绑定到的TreeView控件</param>
        /// <param name="tableName">树的数据所在的表</param>
        public void GetFileTree(TreeView treeView, string fileRecording_templet, string cell_tempet, bool withImage, string projectNo, bool IsCount, bool isAll, FileStatus treeEnum)
        {
            treeView.Nodes.Clear();
            ERM.CBLL.FileRegist cbll = new ERM.CBLL.FileRegist();
            if (treeEnum == FileStatus.Full)
            {
                ds = cbll.RegistGetNewFileRecording_Templet(projectNo);
            }
            else
            {
                ds = FilterData(ds, treeEnum);
            }
            CellTreesData treesData = new CellTreesData();

            dsArchive = treesData.GetArchives(projectNo);
            if (ds != null)
            {
                DataView dataView = new DataView(ds.Tables[0]);
                dataView.RowFilter = "id='01'";
                if (dataView.Count == 0)
                {
                    return;
                }
                string     nodeID     = "";
                string     title      = "";
                string     codeno     = "";
                int        imageindex = 0;
                TreeNodeEx node;
                nodeID    = dataView[0]["ParentPath"].ToString(); //节点唯一ID
                title     = dataView[0]["title"].ToString();      //标题
                codeno    = dataView[0]["id"].ToString();         //表格代码
                node      = new TreeNodeEx();
                node.Name = "01";                                 //节点唯一ID,用来检索
                node.Text = title;                                //标题
                if (withImage)
                {
                    node.ImageIndex         = imageindex;
                    node.SelectedImageIndex = imageindex;
                }
                treeView.BeginUpdate();
                treeView.Nodes.Add(node);
                if (string.IsNullOrEmpty(nodeID))
                {
                    nodeID = dataView[0]["treepath"].ToString();
                }
                LoadFileChildNodes(node.Nodes, codeno, withImage, IsCount, isAll);
                treeView.EndUpdate();
                treeView.Nodes[0].Expand();
                ds = null;
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 设置模版图标
 /// </summary>
 /// <param name="NewNode"></param>
 /// <param name="cbll"></param>
 /// <param name="FileStatus"></param>
 /// <returns></returns>
 public void SetNodeIcon(TreeNodeEx NewNode)
 {
     CBLL.FileRegist cbll = new ERM.CBLL.FileRegist();
     if (NewNode.Nodes.Count > 0 && NewNode.ImageIndex == 1)
     {
         for (int i = 0; i < NewNode.Nodes.Count; i++)
         {
             TreeNodeEx StatusNode = (TreeNodeEx)NewNode.Nodes[i];
             SetImageIndex(cbll, StatusNode);
         }
     }
     else
     {
         SetImageIndex(cbll, NewNode);
     }
 }
Ejemplo n.º 6
0
        /// 用递归的方法读取树
        /// </summary>
        /// <param name="treeView">需要把数据绑定到的TreeView控件</param>
        /// <param name="tableName">树的数据所在的表</param>
        public void GetFileTree(TreeView treeView, bool withImage, string projectNo, bool isAll)
        {
            treeView.Nodes.Clear();
            ERM.CBLL.FileRegist cbll = new ERM.CBLL.FileRegist();
            ds = cbll.GetNewFileRecording_Templet(projectNo);
            DataView dataView = new DataView(ds.Tables[0]);

            dataView.RowFilter = "id='01'";
            if (dataView.Count == 0)
            {
                return;
            }
            string     nodeID     = "";
            string     title      = "";
            int        imageindex = 0;
            string     tag        = "";
            TreeNodeEx node;

            nodeID    = dataView[0]["id"].ToString();    //节点唯一ID
            title     = dataView[0]["title"].ToString(); //标题
            tag       = dataView[0]["table_name"].ToString();
            node      = new TreeNodeEx();
            node.Name = nodeID;         //节点唯一ID,用来检索
            node.Text = title;          //标题
            node.Tag  = tag;
            if (withImage)
            {
                node.ImageIndex         = imageindex;
                node.SelectedImageIndex = imageindex;
            }
            treeView.BeginUpdate();
            LoadFileChildNodes(node.Nodes, nodeID, withImage, isAll);
            treeView.Nodes.Add(node);
            treeView.EndUpdate();
            treeView.Nodes[0].Expand();
            ds = null;
        }
Ejemplo n.º 7
0
 public DataSet GetDS(string projectNo, string KeyString)
 {
     ERM.CBLL.FileRegist cbll = new ERM.CBLL.FileRegist();
     dsSearch = cbll.GetSearchDS(projectNo, KeyString);
     return(dsSearch);
 }
Ejemplo n.º 8
0
        /// <summary>
        /// 刷新节点
        /// </summary>
        /// <param name="Node"></param>
        /// <param name="withImage"></param>
        /// <param name="projectNo"></param>
        /// <param name="IsCount"></param>
        /// <param name="isAll"></param>
        public void RefreshFileNode(TreeNodeEx Node, bool withImage, string projectNo, bool IsCount, bool isAll, FileStatus treeEnum, bool IsRush)
        {
            TreeView treeView1 = Node.TreeView;

            ERM.CBLL.FileRegist cbll = new ERM.CBLL.FileRegist();
            if (ds == null || ds.Tables[0].Rows.Count == 0)
            {
                if (treeEnum == FileStatus.Full)
                {
                    ds = cbll.RegistGetNewFileRecording_Templet(Globals.ProjectNO);
                }
                else
                {
                    ds = FilterData(ds, treeEnum);
                }
            }
            if (!IsRush)
            {
                if (treeEnum == FileStatus.Full)
                {
                    ds = cbll.RegistGetNewFileRecording_Templet(Globals.ProjectNO);
                }
                else
                {
                    ds = FilterData(ds, treeEnum);
                }
            }
            dsArchive = treesData.GetArchives(projectNo);
            DataView dataView = new DataView(ds.Tables[0]);

            if (dataView.Count == 0)
            {
                treeView1.Nodes.Clear();
                return;
            }
            Node.Nodes.Clear();
            if (Node.Parent == null)
            {
                Node.Name = "01";
            }
            dataView.RowFilter = "id='" + Node.Name + "'";
            if (dataView.Count > 0)
            {
                Node.NodeKey   = dataView[0]["filepath"].ToString();
                Node.NodeValue = dataView[0]["filepath"].ToString();        //华表路径
                if (withImage)
                {
                    if (Node.Parent == null)
                    {
                        Node.ImageIndex         = 0;
                        Node.SelectedImageIndex = 0;
                    }
                    else
                    {
                        Node.ImageIndex         = Convert.ToInt32(dataView[0]["imageindex"]);
                        Node.SelectedImageIndex = Convert.ToInt32(dataView[0]["imageindex"]);
                    }
                }
                if (IsCount)
                {
                    if (Node.ImageIndex == 5 || Node.ImageIndex == 2)
                    {
                        Node.Text = GetFinal_fileCount(Node) + dataView[0]["title"].ToString();
                    }
                }
                treeView1.BeginUpdate();
                LoadFileChildNodes(Node.Nodes, Node.Name, withImage, IsCount, isAll);
                Node.IsFirstExpand = false;
                treeView1.EndUpdate();
            }
        }