protected void treeView_VirtualModeCreateChildren(object source, TreeViewVirtualModeCreateChildrenEventArgs e) { string parentNodePath = string.IsNullOrEmpty(e.NodeName) ? Page.MapPath("~/") : e.NodeName; List <TreeViewVirtualNode> children = new List <TreeViewVirtualNode>(); if (Directory.Exists(parentNodePath)) { foreach (string childPath in Directory.GetDirectories(parentNodePath)) { string childDirName = Path.GetFileName(childPath); if (IsSystemName(childDirName)) { continue; } TreeViewVirtualNode childNode = new TreeViewVirtualNode(childPath, childDirName); childNode.Image.Url = DirImageUrl; children.Add(childNode); } foreach (string childPath in Directory.GetFiles(parentNodePath)) { string childFileName = Path.GetFileName(childPath); if (IsSystemName(childFileName)) { continue; } TreeViewVirtualNode childNode = new TreeViewVirtualNode(childPath, childFileName); childNode.IsLeaf = true; childNode.Image.Url = FileImageUrl; children.Add(childNode); } } e.Children = children; }
public static void CreateChildren(TreeViewVirtualModeCreateChildrenEventArgs e) { string parentNodePath = string.IsNullOrEmpty(e.NodeName) ? Request.MapPath("~/") : e.NodeName; List<TreeViewVirtualNode> children = new List<TreeViewVirtualNode>(); if(Directory.Exists(parentNodePath)) { foreach(string childPath in Directory.GetDirectories(parentNodePath)) { string childDirName = Path.GetFileName(childPath); if(IsSystemName(childDirName)) continue; TreeViewVirtualNode childNode = new TreeViewVirtualNode(childPath, childDirName); childNode.Image.Url = DirImageUrl; children.Add(childNode); } foreach(string childPath in Directory.GetFiles(parentNodePath)) { string childFileName = Path.GetFileName(childPath); if(IsSystemName(childFileName)) continue; TreeViewVirtualNode childNode = new TreeViewVirtualNode(childPath, childFileName); childNode.IsLeaf = true; childNode.Image.Url = FileImageUrl; children.Add(childNode); } } e.Children = children; }
protected void treeView_VirtualModeCreateChildren(object source, TreeViewVirtualModeCreateChildrenEventArgs e) { List <TreeViewVirtualNode> children = new List <TreeViewVirtualNode>(); DataTable nodesTable = GetDataTable(); for (int i = 0; i < nodesTable.Rows.Count; i++) { string parentName = e.NodeName != null?e.NodeName.ToString() : "0"; if (nodesTable.Rows[i]["ParentID"].ToString() == parentName) { TreeViewVirtualNode child; if (i == 1) { child = new TreeViewVirtualNode(nodesTable.Rows[i]["ID"].ToString(), nodesTable.Rows[i]["Title"].ToString(), "../views/images/arrow_up.png"); } else { child = new TreeViewVirtualNode(nodesTable.Rows[i]["ID"].ToString(), nodesTable.Rows[i]["Title"].ToString(), "../views/images/arrow_down.png"); } children.Add(child); child.IsLeaf = !(bool)nodesTable.Rows[i]["HasChilds"]; } } e.Children = children; }
public static void RecordTypes(TreeViewVirtualModeCreateChildrenEventArgs e) { List <TreeViewVirtualNode> children = new List <TreeViewVirtualNode>(); if (e.NodeName == null) { TreeViewVirtualNode allRecords = new TreeViewVirtualNode("All Records", "All Records"); //allRecords.Checked = true; children.Add(allRecords); } if (e.NodeName == "All Records") { var recordTypes = Enum.GetValues(typeof(RecordType)).Cast <RecordType>(); foreach (var recordType in recordTypes) { children.Add(new TreeViewVirtualNode(recordType.ToString(), recordType.ToString()) { IsLeaf = true, Checked = recordType == RecordType.NCR ? true : false }); } } e.Children = children; }
public static void CreateChildren(TreeViewVirtualModeCreateChildrenEventArgs e) { string parentNodePath = string.IsNullOrEmpty(e.NodeName) ? Request.MapPath("~/") : e.NodeName; List <TreeViewVirtualNode> children = new List <TreeViewVirtualNode>(); var discrepancyTypes = Utils.DiscrepancyTypes(); if (string.IsNullOrEmpty(e.NodeName)) { var nod = new TreeViewVirtualNode("NCR", "NCR"); children.Add(nod); nod = new TreeViewVirtualNode("CAR", "CAR"); children.Add(nod); nod = new TreeViewVirtualNode("FIS", "FIS"); children.Add(nod); nod = new TreeViewVirtualNode("PAR", "PAR"); children.Add(nod); } else if (e.NodeName == "NCR") { foreach (var u in Utils.DiscrepancyTypes()) { TreeViewVirtualNode childNode = new TreeViewVirtualNode(u.DiscrepancyTypeID.ToString(), u.Name) { IsLeaf = false }; children.Add(childNode); } } e.Children = children; }
public static void CoordinatorTypes(TreeViewVirtualModeCreateChildrenEventArgs e) { string parentNodePath = string.IsNullOrEmpty(e.NodeName) ? Request.MapPath("~/") : e.NodeName; List <TreeViewVirtualNode> children = new List <TreeViewVirtualNode>(); var coordinators = Utils.AppUsers(); if (e.NodeName == null) { TreeViewVirtualNode allNodes = new TreeViewVirtualNode("All Coordinators", "All Coordinators") { //Checked = true }; children.Add(allNodes); } if (e.NodeName == "All Coordinators") { foreach (var recordType in coordinators) { children.Add(new TreeViewVirtualNode(recordType.HseqUserID.ToString(), recordType.FullName) { IsLeaf = true }); } } e.Children = children; }
public static void ResponsibleAreaTypes(TreeViewVirtualModeCreateChildrenEventArgs e) { string parentNodePath = string.IsNullOrEmpty(e.NodeName) ? Request.MapPath("~/") : e.NodeName; List <TreeViewVirtualNode> children = new List <TreeViewVirtualNode>(); var responsibleAreaTypes = Utils.ResponsibleAreas(); if (e.NodeName == null) { children.Add(new TreeViewVirtualNode("All Responsible Areas", "All Responsible Areas") { // Checked = true }); } if (e.NodeName == "All Responsible Areas") { foreach (var recordType in responsibleAreaTypes) { children.Add(new TreeViewVirtualNode(recordType.BusinessAreaID.ToString(), recordType.Name) { IsLeaf = true }); } } e.Children = children; }
protected void virtualTree_VirtualModeCreateChildren(object source, TreeViewVirtualModeCreateChildrenEventArgs e) { List <TreeViewVirtualNode> children = new List <TreeViewVirtualNode>(); if (e.NodeName == null) { AppendChildNode(children, "me", "Me!", false); AppendChildNode(children, "family", "Family", false); AppendChildNode(children, "friends", "Friends", false); } else { if (e.NodeName == "me") { AppendChildNode(children, "clean", "Cleaning"); AppendChildNode(children, "drive", "Driving", false); AppendChildNode(children, "play", "Playing"); } else if (e.NodeName == "family") { AppendChildNode(children, "anthony", "Anthony", false); AppendChildNode(children, "chris", "Chris"); } else if (e.NodeName == "friends") { AppendChildNode(children, "john", "John", false); AppendChildNode(children, "ram", "Ram"); } else if (e.NodeName == "drive") { AppendChildNode(children, "crv", "CRV"); AppendChildNode(children, "bmw", "BMW"); AppendChildNode(children, "kluger", "Kluger"); } else if (e.NodeName == "anthony") { AppendChildNode(children, "run", "Running"); AppendChildNode(children, "swim", "Swimming"); } else if (e.NodeName == "john") { AppendChildNode(children, "read", "Reading"); AppendChildNode(children, "test", "Testing"); } } e.Children = children; }
protected void ASPxTreeView1_VirtualModeCreateChildren(object source, TreeViewVirtualModeCreateChildrenEventArgs e) { List <TreeViewVirtualNode> list = new List <TreeViewVirtualNode>(); if (e.NodeName == null) { foreach (DataRowView rw in dsJobs.Select(DataSourceSelectArguments.Empty)) { string name = String.Format("e{0},{1}", rw.Row[0], Guid.NewGuid()); TreeViewVirtualNode node = new TreeViewVirtualNode(name, FormatText(rw.Row[1].ToString())); node.IsLeaf = !HasChildNodes(dsEmployee, "job_id", rw.Row[0].ToString()); list.Add(node); } e.Children = list; return; } if (e.NodeName[0] == 'e') { dsEmployee.SelectParameters["job_id"].DefaultValue = GetId(e.NodeName); foreach (DataRowView rw in dsEmployee.Select(DataSourceSelectArguments.Empty)) { string name = String.Format("p{0},{1}", rw.Row[2], Guid.NewGuid()); string text = String.Format("{0} {1}", rw.Row[0], rw.Row[1], rw.Row[2]); TreeViewVirtualNode node = new TreeViewVirtualNode(name, FormatText(text)); node.IsLeaf = !HasChildNodes(dsPubInfo, "pub_id", rw.Row[2].ToString()); list.Add(node); } e.Children = list; return; } if (e.NodeName[0] == 'p') { dsPubInfo.SelectParameters["pub_id"].DefaultValue = GetId(e.NodeName); foreach (DataRowView rw in dsPubInfo.Select(DataSourceSelectArguments.Empty)) { TreeViewVirtualNode node = new TreeViewVirtualNode(Guid.NewGuid().ToString(), FormatText(rw.Row[0].ToString())); node.IsLeaf = true; list.Add(node); } e.Children = list; } }
// 2. 建立相应的方法 // 3. 建立treeview public void newCreateTree(TreeViewVirtualModeCreateChildrenEventArgs e, int root_type_ID) { List <TreeViewVirtualNode> children = new List <TreeViewVirtualNode>(); var lesson_content_type_table = kkd.GetTable <train_lesson_content_type>(); if (string.IsNullOrEmpty(e.NodeName)) { // 查询节点信息 train_lesson_content_type root_type = lesson_content_type_table.Single(d => d.ID == root_type_ID); // 建立节点 TreeViewVirtualNode childNode = new TreeViewVirtualNode(root_type.ID.ToString(), root_type.TypeName); childNode.IsLeaf = lesson_content_type_table.Any(d => d.ParentID == root_type.ID) ? false : true; children.Add(childNode); } else { this.tree_view_child(children, int.Parse(e.NodeName), lesson_content_type_table); } e.Children = children; }
public static void CreateChildren(TreeViewVirtualModeCreateChildrenEventArgs e) { string parentNodePath = string.IsNullOrEmpty(e.NodeName) ? strStartPath : e.NodeName; List <TreeViewVirtualNode> children = new List <TreeViewVirtualNode>(); if (!bInit) { return; } else { bInit = false; } if (string.IsNullOrEmpty(e.NodeName)) { TreeViewVirtualNode childNode = new TreeViewVirtualNode(strStartPath, strStartPath); childNode.Image.Url = ServerImageUrl; children.Add(childNode); } else if (Directory.Exists(parentNodePath)) { IBLL.IFileTypeSetService setService = BLLFactory.ServiceAccess.CreateFileTypeSetService(); FileTypeSet fset = setService.GetFileTypeSetByMonitorServerIdAndFolderName(msID, parentNodePath); DirectoryInfo dirInfo = new DirectoryInfo(parentNodePath); foreach (DirectoryInfo folder in dirInfo.GetDirectories()) { TreeViewVirtualNode childNode = new TreeViewVirtualNode(folder.FullName.ToString(), folder.Name.ToString()); childNode.Image.Url = DirImageUrl; childNode.Target = "99"; children.Add(childNode); } foreach (FileInfo file in dirInfo.GetFiles()) { TreeViewVirtualNode childNode = new TreeViewVirtualNode(file.FullName.ToString(), file.Name.ToString()); childNode.IsLeaf = true; childNode.Target = file.Extension;//ファイル拡張子 children.Add(childNode); } } e.Children = children; }
protected void treeView_VirtualModeCreateChildren(object sender, TreeViewVirtualModeCreateChildrenEventArgs e) { List <TreeViewVirtualNode> children = new List <TreeViewVirtualNode>(); using (PDFEntities entities = new PDFEntities()) { if (Session["GroupID"].ToString() != "QL") { if (e.NodeName == null) { AddBranchNode1(entities, children); } else if (e.NodeName.Substring(0, 2) == "B_") { AddTypeNode(entities, children, e.NodeName.Substring(2), false); } else { AddFileNode(entities, children, e.NodeName); } } else { if (e.NodeName == null) { AddBranchNode(entities, children); } else if (e.NodeName.Substring(0, 2) == "B_") { AddTypeNode(entities, children, e.NodeName.Substring(2)); } else { AddFileNode(entities, children, e.NodeName); } } } e.Children = children; }
public static void CreateChildren(TreeViewVirtualModeCreateChildrenEventArgs e) { string parentNodePath = string.IsNullOrEmpty(e.NodeName) ? strStartPath : e.NodeName; List <TreeViewVirtualNode> children = new List <TreeViewVirtualNode>(); if (!bInit) { return; } else { bInit = false; } if (string.IsNullOrEmpty(e.NodeName)) { TreeViewVirtualNode childNode = new TreeViewVirtualNode(strStartPath, strStartPath); childNode.Image.Url = ServerImageUrl; children.Add(childNode); } else if (Directory.Exists(parentNodePath)) { DirectoryInfo dirInfo = new DirectoryInfo(parentNodePath); foreach (DirectoryInfo folder in dirInfo.GetDirectories()) { //隠しファイル||システムファイル if ((folder.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden || (folder.Attributes & FileAttributes.System) == FileAttributes.System) { continue; } TreeViewVirtualNode childNode = new TreeViewVirtualNode(folder.FullName.ToString(), folder.Name.ToString()); childNode.Image.Url = DirImageUrl; childNode.Target = "99"; children.Add(childNode); } } e.Children = children; }
// 创建treeview 树 protected void treeview_create(object sender, TreeViewVirtualModeCreateChildrenEventArgs e) { kkd.newCreateTree(e, 1); }
public static void CreateChildren(TreeViewVirtualModeCreateChildrenEventArgs e) { //string parentNodePath = string.IsNullOrEmpty(e.NodeName) ? Request.MapPath("~/") : e.NodeName; string parentNodePath = string.IsNullOrEmpty(e.NodeName) ? strStartPath : e.NodeName; List <TreeViewVirtualNode> children = new List <TreeViewVirtualNode>(); //if (strStartPath == "") //{ //} if (!bInit) { return; } else { bInit = false; } if (string.IsNullOrEmpty(e.NodeName)) { TreeViewVirtualNode childNode = new TreeViewVirtualNode(strStartPath, strStartPath); childNode.Image.Url = ServerImageUrl; children.Add(childNode); } //else if (Directory.Exists(parentNodePath)) //{ // foreach (string childPath in Directory.GetDirectories(parentNodePath)) // { // string childDirName = Path.GetFileName(childPath); // //if(IsSystemName(childDirName)) // // continue; // TreeViewVirtualNode childNode = new TreeViewVirtualNode(childPath, childDirName); // childNode.Image.Url = DirImageUrl; // childNode.Target = "99"; // children.Add(childNode); // } // // ファイルを表示する必要がない。 // foreach (string childPath in Directory.GetFiles(parentNodePath)) // { // string childFileName = Path.GetFileName(childPath); // //if(IsSystemName(childFileName)) // // continue; // TreeViewVirtualNode childNode = new TreeViewVirtualNode(childPath, childFileName); // childNode.IsLeaf = false; // childNode.Image.Url = FileImageUrl; // childNode.ClientVisible = false; // children.Add(childNode); // } //} else if (Directory.Exists(parentNodePath)) { IBLL.IFileTypeSetService setService = BLLFactory.ServiceAccess.CreateFileTypeSetService(); FileTypeSet fset = setService.GetFileTypeSetByMonitorServerIdAndFolderName(msID, parentNodePath); DirectoryInfo dirInfo = new DirectoryInfo(parentNodePath); try { foreach (DirectoryInfo folder in dirInfo.GetDirectories()) { if (fset.id != null) { if (fset.hiddenFileFlg == "1") {//隠しファイル if ((folder.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden) { continue; } } if (fset.systemFileFlg == "1") {//システムファイル if ((folder.Attributes & FileAttributes.System) == FileAttributes.System) { continue; } } } TreeViewVirtualNode childNode = new TreeViewVirtualNode(folder.FullName.ToString(), folder.Name.ToString()); childNode.Image.Url = DirImageUrl; childNode.Target = "99"; children.Add(childNode); } foreach (FileInfo file in dirInfo.GetFiles()) { if (fset.id != null) { //string strExceptAttribute1 = string.Empty; //string strExceptAttribute2 = string.Empty; //string strExceptAttribute3 = string.Empty; //if (fset.exceptAttributeFlg1 == "1") //{ // strExceptAttribute1 = fset.exceptAttribute1; //} //if (fset.exceptAttributeFlg2 == "1") //{ // strExceptAttribute2 = fset.exceptAttribute2; //} //if (fset.exceptAttributeFlg3 == "1") //{ // strExceptAttribute3 = fset.exceptAttribute3; //} //if (CommonWeb.CommonUtil.IsExceptFile(file.Name, strExceptAttribute1, strExceptAttribute2, strExceptAttribute3)) //{ // continue; //} if (fset.hiddenFileFlg == "1") {//隠しファイル if ((file.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden) { continue; } } if (fset.systemFileFlg == "1") {//システムファイル if ((file.Attributes & FileAttributes.System) == FileAttributes.System) { continue; } } } TreeViewVirtualNode childNode = new TreeViewVirtualNode(file.FullName.ToString(), file.Name.ToString()); //show files——2014-06-02 wjd modified //childNode.IsLeaf = true; childNode.Image.Url = FileImageUrl; childNode.Image.AlternateText = file.Extension;//ファイル拡張子 //childNode.Target = file.Extension; childNode.Expanded = true; //childNode.ClientVisible = false; children.Add(childNode); } } catch (System.Exception ex) { logger.Error(ex.Message); } } e.Children = children; }