Exemplo n.º 1
0
    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;
 }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
        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;
        }
    private void AppendChildNode(IList <TreeViewVirtualNode> nodeList, string nodeName, string nodeText, bool isLeaf)
    {
        TreeViewVirtualNode node = new TreeViewVirtualNode(nodeName, nodeText);

        node.IsLeaf = isLeaf;
        nodeList.Add(node);
    }
Exemplo n.º 6
0
        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;
        }
Exemplo n.º 7
0
        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;
        }
Exemplo n.º 8
0
        private void AddBranchNode(PDFEntities entities, List <TreeViewVirtualNode> children)
        {
            var branchs = entities.tblDM_Branch.Where(x => x.IsEnable == true);

            foreach (var branch in branchs)
            {
                TreeViewVirtualNode childNode = new TreeViewVirtualNode("B_" + branch.BranchID, branch.BranchName);
                childNode.IsLeaf       = false;
                childNode.Image.IconID = BranchImageIcon;
                children.Add(childNode);
            }
        }
Exemplo n.º 9
0
        private void AddTypeNode(PDFEntities entities, List <TreeViewVirtualNode> children, string branch, bool isQL = true)
        {
            string groupID = Session["GroupID"].ToString();
            var    types   = entities.tblPDF_FileData.Where(z => z.BranchID == branch && (isQL || z.GroupAccess.Contains(groupID))).Select(x => x.TypeID).Distinct();

            foreach (var type in types)
            {
                TreeViewVirtualNode childNode = new TreeViewVirtualNode(branch + "_" + type, entities.tblDM_Type.Single(x => x.TypeID == type).TypeName);
                childNode.IsLeaf       = false;
                childNode.Image.IconID = TypeImageIcon;
                children.Add(childNode);
            }
        }
Exemplo n.º 10
0
        private void AddBranchNode1(PDFEntities entities, List <TreeViewVirtualNode> children)
        {
            string branchU = Session["BranchID"].ToString();
            string groupID = Session["GroupID"].ToString();
            var    branchs = entities.tblPDF_FileData.Where(z => z.BranchID == branchU || z.GroupAccess.Contains(groupID)).Select(x => x.BranchID).Distinct();

            foreach (var branch in branchs)
            {
                TreeViewVirtualNode childNode = new TreeViewVirtualNode("B_" + branch, entities.tblDM_Branch.FirstOrDefault(z => z.BranchID == branch).BranchName);
                childNode.IsLeaf       = false;
                childNode.Image.IconID = BranchImageIcon;
                children.Add(childNode);
            }
        }
Exemplo n.º 11
0
        private void AddFileNode(PDFEntities entities, List <TreeViewVirtualNode> children, string branch_type, bool isQL = true)
        {
            string groupID = Session["GroupID"].ToString();
            //string type = branch_type.Substring(branch_type.IndexOf('_') + 1);
            //string branch = branch_type.Substring(0, branch_type.IndexOf('_'));
            var files = entities.tblPDF_FileData.Where(x => (x.BranchID + "_" + x.TypeID) == branch_type && (isQL || x.GroupAccess.Contains(groupID)) && x.IsClose == false).OrderByDescending(z => z.UpdatedDate);

            foreach (var file in files)
            {
                TreeViewVirtualNode childNode = new TreeViewVirtualNode(file.ID.ToString(), file.UpdatedDate.ToShortDateString() + " - " + file.FileName);
                childNode.IsLeaf       = true;
                childNode.Image.IconID = PDFImageIcon;
                children.Add(childNode);
            }
        }
Exemplo n.º 12
0
        private void tree_view_child(List <TreeViewVirtualNode> children, int root_type_id, Table <train_lesson_content_type> table)
        {
            // 1. 查询所有符合的节点
            IEnumerable <train_lesson_content_type> type_list;

            type_list = from type in table
                        where type.ParentID == root_type_id
                        select type;

            // 2. 添加节点
            foreach (var type in type_list)
            {
                TreeViewVirtualNode childNode = new TreeViewVirtualNode(type.ID.ToString(), type.TypeName);
                childNode.IsLeaf = table.Any(d => d.ParentID == type.ID) ? false : true;
                children.Add(childNode);
            }
        }
    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;
        }
    }
Exemplo n.º 14
0
        protected void ASPxTreeView1_VirtualModeCreateChildren(object source, DevExpress.Web.TreeViewVirtualModeCreateChildrenEventArgs e)
        {
            using (var db = Database.SPBase())
            {
                List <TreeViewVirtualNode> children = new List <TreeViewVirtualNode>();

                var list = db.Reports.ToList().Select(s => new
                {
                    Id        = s.RepId * 100,
                    ParentID  = s.GrpId,
                    Num       = s.Num,
                    Name      = db.RepLng.FirstOrDefault(w => w.LangId == 2 && w.RepId == s.RepId).Name,
                    HasChilds = false
                }).Concat(db.UserTreeAccess.Where(w => w.UserId == 0 && w.PId == 34).ToList().Select(s => new
                {
                    Id        = s.Id,
                    ParentID  = 0,
                    Num       = (int?)null,
                    Name      = s.Name,
                    HasChilds = true
                }));


                foreach (var item in list)
                {
                    string parentName = e.NodeName != null?e.NodeName.ToString() : "0";

                    if (item.ParentID.ToString() == parentName)
                    {
                        TreeViewVirtualNode child = new TreeViewVirtualNode(item.Id.ToString(), item.Name);
                        if (item.Num.HasValue)
                        {
                            child.Text        = item.Num.ToString() + ". " + item.Name;
                            child.NavigateUrl = "~/Reports/rep" + item.Num.ToString() + ".aspx";
                        }
                        children.Add(child);
                        child.IsLeaf = !item.HasChilds;
                    }
                    e.Children = children;
                }
            }
        }
Exemplo n.º 15
0
        // 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;
        }
Exemplo n.º 16
0
        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;
        }
Exemplo n.º 17
0
        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;
        }
    protected void treeView_VirtualModeCreateChildren(object source, DevExpress.Web.ASPxTreeView.TreeViewVirtualModeCreateChildrenEventArgs e)
    {
        List <TreeViewVirtualNode>  nodeList = new List <TreeViewVirtualNode>();
        Dictionary <string, string> nodes    = new Dictionary <string, string>();

        if (String.IsNullOrEmpty(e.NodeName))
        {
            nodes = GetParentFromDB("null");
        }
        else
        {
            nodes = GetParentFromDB(e.NodeName);
        }
        foreach (KeyValuePair <string, string> nodeKeys in nodes)
        {
            TreeViewVirtualNode node = new TreeViewVirtualNode(nodeKeys.Key, nodeKeys.Value);
            if (isLeafNode(nodeKeys.Key))
            {
                node.IsLeaf = true;
            }
            nodeList.Add(node);
        }
        e.Children = nodeList;
    }
Exemplo n.º 19
0
        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;
        }