public frmAddTemplet(TreeNodeEx Node, Form ParentForm, ITreeFactory Itree, bool fileOrFlord_flg) { InitializeComponent(); _parentForm = ParentForm; treeFactory = Itree; checkBox1.Checked = fileOrFlord_flg; }
public void RefreshNode(TreeNodeEx Node, bool withImage, string projectNo, bool IsCount, bool isAll, CellCreate enumTree) { ////树 ////添加节点 ////添加子节点 ////销毁 }
public FrmScan(TreeNodeEx node, Form PartentForm, ITreeFactory Itree) { treeFactory = Itree; try { InitializeComponent(); } catch { MessageBox.Show("没有安装扫描控件,请打开安装包安装!"); this.DialogResult = DialogResult.OK; return; } tssLabel1.Text = "就绪"; tssLabel2.Text = Globals.AppTitle; tssLabel3.Text = Globals.LoginUser; string strSql = "select filestatus from T_FileList where ProjectNO='" + Globals.ProjectNO + "' and treepath='" + Functions.OpeartPath(node) + "'"; object tmp = Digi.DBUtility.DbHelperOleDb.GetSingle(strSql); if (tmp != null && (tmp.ToString() == "4" || tmp.ToString() == "5")) { MessageBox.Show("该模板已提交,不能扫描或编辑之下的文件。"); this.DialogResult = DialogResult.OK; } NewNode = node; getAllFileFromTemplateNode(node); _parentForm = PartentForm; FileID = Guid.NewGuid().ToString(); }
private void DelNode(TreeNodeEx theNode, string tableName, string projectNo) { ////删除数据库中的记录 ////DBFunc.ExecuteSql(sql); ////删除附件 ////递归 }
private TreeNodeEx PNode; //父节点 /// <summary> /// 对frmMain窗体中树的节点属性进行修改 /// </summary> /// <param name="frm"></param> public frmCellNameEdit(TreeNodeEx node, TreeNodeEx _pNode) { InitializeComponent(); this.theNode = node; this.PNode = _pNode; txtTitle.Text = theNode.Text; }
public frmExpData(TreeNodeEx theNode) { InitializeComponent(); treeFactory = new TreeFactory(); this.Text += "-" + Globals.Projectname; TheNode = theNode; }
/// 用递归的方法读取树 /// </summary> /// <param name="treeView">需要把数据绑定到的TreeView控件</param> /// <param name="tableName">树的数据所在的表</param> public void GetTree(TreeView treeView, string fileRecording_templet, string cell_tempet, bool withImage, string projectNo, bool IsAll) { treeView.Nodes.Clear(); ds = vars.GetTrees(true, Globals.ProjectNO); DataView dataView = new DataView(ds.Tables[0]); dataView.RowFilter = "id='01'"; if (dataView.Count == 0) { return; } DataRowView tRow = dataView[0]; ERM.MDL.T_FileList M_FileRecording_Templet = this.Command_GetFile(tRow);//获取文件对象模型 TreeNodeEx node = new TreeNodeEx(); node.Name = M_FileRecording_Templet.id; //节点唯一ID,用来检索 node.Text = M_FileRecording_Templet.gdwj; //标题 node.Tag = M_FileRecording_Templet; //是否最后一个节点,范例路径,是否用户定义表格,附件 node.Checked = M_FileRecording_Templet.isvisible == 1?true:false; //是否可见 if (withImage) { node.ImageIndex = 0; //0为根目录图片号 node.SelectedImageIndex = 0; //0为根目录图片号 } treeView.BeginUpdate(); treeView.Nodes.Add(node); LoadChildNodes(node, node.Name, withImage, IsAll); node.IsFirstExpand = false; treeView.EndUpdate(); treeView.Nodes[0].Expand(); }
/// <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(); } }
/// <summary> /// 删除某一节点及所有子节点,调用时请先使Cell控件打开的是空表, /// 而是不需要删除的节点中的某一表格,以防删除电子文件失败 /// </summary> /// <param name="theNode"></param> /// <param name="tableName"></param> /// <param name="projectNo"></param> public void DelNodes(TreeNodeEx theNode, string tableName, string projectNo) { string sql = ""; if (theNode.ImageIndex == ImageLists.Root) { sql = "delete from " + tableName; if (projectNo != "") { sql += " where ProjectNO='" + projectNo + "'"; } if (projectNo != "") { common.DeleteAndCreateEmptyDirectory(Globals.ProjectPath); } return; } this.DelNode(theNode, tableName, projectNo); if (theNode.Parent != null) { TreeNodeEx parentNode = (TreeNodeEx)theNode.Parent; if (parentNode.Nodes.Count == 1) { sql = "update " + tableName + " set lastleaf=1 where nodeid=" + parentNode.Name; if (projectNo != "") { sql += " and ProjectNO='" + projectNo + "'"; } } } }
private bool IsTemplet; //是否为表格 /// </summary> /// <param name="node">子节点 用来区分是否为新增,新增时搞个null的treenode</param> /// <param name="_istemplet">是模板还是目录,模板是true</param> /// <param name="_pNode">父节点</param> public frmMainGetTempletFromStandard(TreeNodeEx node, bool _istemplet, TreeNodeEx _pNode) { InitializeComponent(); this.Cell1.Login("digipower", "11100101845", "1040-1145-0062-4005"); this.Cell1.LocalizeControl(0x804); TheNode = node; pNode = _pNode; if (!_istemplet) { this.label1.Text = "节点名称:"; } if (_istemplet && node == null) { this.customPanel2.Visible = true; } else { this.customPanel2.Visible = false; this.Size = new Size(this.Size.Width, 130); } if (node != null) { txtTitle.Text = node.Text.Remove(0, node.Text.IndexOf(']') + 1).Replace("*", ""); } IsTemplet = _istemplet; }
public void ShowData(TreeNode obj) { TreeNodeEx newNode = new TreeNodeEx(); newNode.Name = obj.Name; newNode.Tag = obj.Tag; ShowData(newNode); }
/// <summary> /// 获取子节点总数 YQ 2011-0617 /// </summary> /// <param name="node"></param> /// <param name="nodeSumCount"></param> private void GetChildToFileCount(TreeNodeEx node, ref int nodeSumCount) { foreach (TreeNodeEx childNode in node.Nodes) { nodeSumCount++; } nodeSumCount++; }
public frmAddDwg(TreeNodeEx node, Form par) { InitializeComponent(); NewNode = node; _parentForm = par; CreateTable(); LoadData(); }
private void treeView1_DoubleClick(object sender, EventArgs e) { if (searchFrm != null) { try { searchFrm.Close(); } catch { } } ////当前节点 TreeNodeEx theNode = treeView1.SelectedNode as TreeNodeEx; if (theNode == null) { return; } if (theNode.ImageIndex == 2 || theNode.ImageIndex == 7) { this.Cell2.closefile(); frmCellEdit frm = new frmCellEdit(this, theNode, Mydel); frm.ShowDialog(); showCell(theNode.Name); theNode.ImageIndex = (treeFactory.CheckEFileByFileID(theNode.Name, 1) == true) ? 7 : 2;//判断是否有电子文件 theNode.SelectedImageIndex = theNode.ImageIndex; MyFavorites obj = new MyFavorites(); obj.Write(theNode.Name, theNode.Text); if (treeView1.Nodes.Count > 0) { if (treeView1.Nodes[0].Text == "最近著录过的文件") { if (theNode.Parent != null && theNode.Parent.Text == "最近著录过的文件") { treeFactory.CreatemyFavoritesNode((TreeNodeEx)treeView1.Nodes[0]); treeFactory.SelectNodeImage(treeView1, theNode.Name); } else { treeFactory.CreatemyFavoritesNode((TreeNodeEx)treeView1.Nodes[0]); } } if (treeView1.Nodes.Count >= 1 && (!(treeView1.Nodes[1].IsExpanded))) { treeView1.Nodes[1].Expand(); } } } else if (theNode.ImageIndex == 4) { TXMessageBoxExtensions.Info("提示:已组卷的目录不允许编辑! \n 【温馨提示:如想编辑请在文件登记中撤销登记或在组卷目录移除此文件】"); } }
/// <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; }
public void RefreshNode(TreeNodeEx Node, string fileRecording_templet, string cell_tempet, bool withImage, string projectNo, bool IsAll) { TreeView treeView1 = Node.TreeView; ////dsArchive = vars.GetArchives(); Node.Nodes.Clear(); ds = vars.GetTrees(true, Globals.ProjectNO); LoadChildNodes(Node, Node.Name, withImage, IsAll); Node.IsFirstExpand = false; }
/// <summary> /// 刷新节点 /// </summary> /// <param name="node"></param> private void RefreshNode(TreeNodeEx NewNode) { if (NewNode.IsFirstExpand) { if (NewNode.ImageIndex == 1) { treeFactory.RefreshFileNode(NewNode, true, Globals.ProjectNO, true); } } }
private void menuDelNode_Click(object sender, EventArgs e) { TreeNodeEx theNode = (TreeNodeEx)treeView1.SelectedNode; if (theNode == null) { return; } this.DelNode(); }
/// <summary> /// 获取父节点总数 YQ 2011-0617 /// </summary> /// <param name="node"></param> /// <param name="nodeSumCount"></param> private void GetNodesCount(TreeNodeEx node, ref int nodeSumCount) { if (node != null) { nodeSumCount++; } if (node.Parent != null) { GetNodesCount((TreeNodeEx)node.Parent, ref nodeSumCount); } }
int curIndex = 0;//状态栏 变量 YQ 2011-0617 private void ParentToFile(TreeNodeEx node, string TempSavePath) { if (node != null) {//父 一定是文件级 CreateFile("T_FileList", node.Name, TempSavePath); } if (node.Parent != null) { ParentToFile((TreeNodeEx)node.Parent, TempSavePath); } }
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); }
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(); }
private void getAllFileFromTemplateNode(TreeNodeEx node) { tscmbDisp.SelectedIndex = 0; tscmbScale.SelectedIndex = 2; tsCut.SelectedIndex = 0; if (System.IO.File.Exists(reportsPath + "temp.tif")) { System.IO.File.Delete(reportsPath + "temp.tif"); } string strSql = "select * from attachment where fileTreePath='" + treeFactory.OpeartPath(node) + "' and ProjectNO='" + Globals.ProjectNO + "'"; strSql += " order by fileorderindex,attachid"; DataSet ds = null; ds = Digi.DBUtility.DbHelperOleDb.Query(strSql); axImgAdmin1.Image = reportsPath + "temp.tif"; axImgAdmin1.Append(reportsPath + "blank.tif", 1, 1); string str = ""; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { str = ds.Tables[0].Rows[i]["yswjpath"].ToString(); str = str.Substring(str.LastIndexOf(".") + 1); str = str.ToLower(); if (str == "jpg" || str == "bmp" || str == "gif" || str == "tif") { arrPic.Add(projectPath + Globals.ProjectNO + "\\ODoc\\" + ds.Tables[0].Rows[i]["yswjpath"].ToString()); axImgAdmin1.Append(projectPath + Globals.ProjectNO + "\\ODoc\\" + ds.Tables[0].Rows[i]["yswjpath"].ToString(), 1, 1); } } axImgAdmin1.DeletePages(1, 1); axImgEdit1.ImagePalette = ImgeditLibCtl.ImagePaletteConstants.wiPaletteRGB24; if (arrPic.Count == 0) { this.axImgEdit1.Image = reportsPath + "blank.jpg"; } else { axImgThumbnail1.Image = reportsPath + "temp.tif"; this.axImgEdit1.Image = arrPic[0].ToString(); } axImgEdit1.RenderAllPages(-100, -100); axImgEdit1.Display(); if (arrPic.Count > 0) { curSelNoFrmThum = 1; } else { curSelNoFrmThum = 0; } }
private void treeView1_BeforeExpand(object sender, TreeViewCancelEventArgs e) { ; TreeNodeEx NewNode = (TreeNodeEx)(e.Node); if (NewNode.Parent != null) { if (NewNode.IsFirstExpand) { RefreshNode((TreeNodeEx)NewNode); } } }
private void menuCopyFile_Click(object sender, EventArgs e) { TreeNodeEx theNode = treeView1.SelectedNode as TreeNodeEx; if (theNode == null) { return; } if (theNode.ImageIndex == 2 || theNode.ImageIndex == 7 || theNode.ImageIndex == 4) { CopyFileID = theNode.Name;//copy } }
/// <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; } }
private void ChildToFile(TreeNodeEx node, string TempSavePath) { foreach (TreeNodeEx childNode in node.Nodes) { if (childNode.ImageIndex != 3) { CreateFile("T_FileList", childNode.Name, TempSavePath); ChildToFile(childNode, TempSavePath); } } if (node.ImageIndex != 3) { CreateFile("T_CellAndEFile", node.Name, TempSavePath); } }
private void CheckCanDel(TreeNodeEx node) { if (node.ImageIndex == 2 || node.ImageIndex == 7) { StrCheck += "'" + node.Name + "',"; } else { TreeNodeCollection nodes = node.Nodes; for (int i = 0; i < nodes.Count; i++) { CheckCanDel((TreeNodeEx)nodes[i]); } } }
/// <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); } }
private void MenuItemExp_Click(object sender, EventArgs e) { TreeNodeEx theNode = (TreeNodeEx)treeView1.SelectedNode; if (theNode == null || theNode.Text.Trim() == "最近著录过的文件" || (theNode.Parent != null && theNode.Parent.Text.Trim() == "最近著录过的文件")) { TXMessageBoxExtensions.Info("提示:请选中有效的节点导出数据!"); return; } ERM.UI.frmExpData Frm = new ERM.UI.frmExpData(theNode); if (Frm.ShowDialog() == DialogResult.OK) { TXMessageBoxExtensions.Info("导出数据成功!"); } }