/// <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; }
private void AddNewNode(string Action, string txtLocalPath, string StrTitle) { TreeNodeEx theNode = (TreeNodeEx)treeView1.SelectedNode; int orderindex = (new BLL.T_CellAndEFile_BLL()).GetMaxOrderIndex(theNode.Name, Globals.ProjectNO);//treesData.GetNextIndex(theNode.Name, Globals.ProjectNO); string ParentID = theNode.Name; string Filepath = txtLocalPath; string Title = StrTitle; string ProjectNO = Globals.ProjectNO; fileModel = new ERM.MDL.T_FileList(); fileModel.gdwj = Title; fileModel.wjtm = Title; fileModel.FileID = Guid.NewGuid().ToString(); fileModel.ParentID = ParentID; fileModel.ProjectNO = ProjectNO; fileModel.OrderIndex = (new BLL.T_FileList_BLL()).GetMaxOrderIndex(ParentID, Globals.ProjectNO) + 1; fileModel.isvisible = 1; fileModel.fileStatus = "0"; fileModel.FL = 0; (new BLL.T_FileList_BLL()).Add(fileModel); MDL.T_CellAndEFile cellMode = new ERM.MDL.T_CellAndEFile(); cellMode.CellID = Guid.NewGuid().ToString(); if (!System.IO.File.Exists(Filepath)) { TXMessageBoxExtensions.Info("文件不存在!"); return; } System.IO.File.Copy(Filepath, Globals.ProjectPath + "ODOC\\" + cellMode.CellID + ".cll", true); cellMode.filepath = "ODOC\\" + cellMode.CellID + ".cll"; cellMode.orderindex = orderindex + 1; cellMode.FileID = fileModel.FileID; cellMode.isvisible = 1; cellMode.EFileType = true;//电子文件类型,0=false 系统的,-1=true 用户上传的 cellMode.ProjectNO = ProjectNO; cellMode.title = Title; cellBLL.Add(cellMode); TreeNodeEx newNode = new TreeNodeEx(); newNode.Name = cellMode.FileID; newNode.ImageIndex = 2; newNode.SelectedImageIndex = 2; newNode.Text = cellMode.title; theNode.Nodes.Add(newNode); theNode.Expand(); }