Beispiel #1
0
        /// <summary>
        /// 生成ExtTree
        /// </summary>
        /// <param name="ents"></param>
        /// <param name="parentID"></param>
        /// <returns></returns>
        private WebHelper.ExtTreeNodeCollection ToExtTreeCollection(IEnumerable <SysRole> ents, WebHelper.ExtTreeNode pnode)
        {
            string parentID = (pnode == null) ? null : (pnode["id"] == null ? null : pnode["id"].ToString());

            IEnumerable <SysRole> rtnents = ents;

            WebHelper.ExtTreeNodeCollection nodes = new WebHelper.ExtTreeNodeCollection();

            if (ents != null)
            {
                if (rtnents.Count() > 0)
                {
                    foreach (SysRole tent in rtnents)
                    {
                        WebHelper.ExtTreeNode node = new WebHelper.ExtTreeNode();
                        node["id"]               = tent.RoleID;
                        node["text"]             = tent.Name;
                        node["RoleID"]           = tent.RoleID;
                        node["Type"]             = tent.Type;
                        node["Name"]             = tent.Name;
                        node["Code"]             = tent.Code;
                        node["SortIndex"]        = tent.SortIndex;
                        node["LastModifiedDate"] = tent.LastModifiedDate;
                        node["CreateDate"]       = tent.CreateDate;
                        node["Description"]      = tent.Description;
                        node["leaf"]             = true;

                        nodes.Add(node);
                    }
                }
            }

            return(nodes);
        }
        /// <summary>
        /// 生成ExtTree
        /// </summary>
        /// <param name="ents"></param>
        /// <param name="parentID"></param>
        /// <returns></returns>
        private WebHelper.ExtTreeNodeCollection ToExtTreeCollection(DataTable dataTable, WebHelper.ExtTreeNode pnode)
        {
            string parentID = (pnode == null) ? null : (pnode["id"] == null ? null : pnode["id"].ToString());

            //IEnumerable<D_WorkPackageDictionary> rtnents = null;
            DataRow[] rtnRows = null;

            WebHelper.ExtTreeNodeCollection nodes = new WebHelper.ExtTreeNodeCollection();

            if (dataTable.Rows.Count > 0)
            {
                if (String.IsNullOrEmpty(parentID))
                {
                    //rtnents = ents.Where(ent => (ent.ParentId == null || ent.ParentId == String.Empty));
                    rtnRows = dataTable.Select("PathLevel=2");
                }
                else
                {
                    //rtnents = ents.Where(ent => ent.ParentId == parentID);
                    rtnRows = dataTable.Select("ParentID='" + parentID + "'");
                }

                if (rtnRows.Count() > 0)
                {
                    if (pnode != null)
                    {
                        pnode["leaf"] = false;
                    }

                    foreach (DataRow tent in rtnRows)
                    {
                        WebHelper.ExtTreeNode node = new WebHelper.ExtTreeNode();
                        node["id"] = tent["GroupID"].ToString();
                        //this.text = '<span style="width:150px;">' + this.WBSCode + '</span>' + '<span style="margin-left:30px;">' + this.CurLevelName + '</span>'
                        //node["text"] = "<span style=\"width:150px;\">" + tent["WBSCode"].ToString() + "</span>" + "<span style=\"margin-left:30px;\">" + tent["CurLevelName"].ToString() + "</span>";
                        node["ParentId"] = tent["ParentID"].ToString();
                        //node["Path"] = tent.Path;
                        node["text"]      = tent["Name"].ToString();
                        node["Path"]      = tent["Path"].ToString();
                        node["PathLevel"] = tent["PathLevel"].ToString();
                        //node["uiProvider"] = "col";
                        //node["PathLevel"] = tent["CurLevel"];
                        //node["SortIndex"] = tent["RowIndex"];
                        //node["ManHours"] = tent["ManHours"];
                        node["children"] = ToExtTreeCollection(dataTable, node);
                        node["iconCls"]  = "icon";
                        //node["cls"] = "node-row-bg-level" + tent["CurLevel"];

                        nodes.Add(node);
                    }
                }
                else
                {
                    if (pnode != null)
                    {
                        pnode["leaf"] = true;

                        if (pnode["children"] == null)
                        {
                            pnode.Remove("children");
                        }
                    }
                }
            }

            return(nodes);
        }
Beispiel #3
0
        /// <summary>
        /// 生成ExtTree
        /// </summary>
        /// <param name="ents"></param>
        /// <param name="parentID"></param>
        /// <returns></returns>
        private WebHelper.ExtTreeNodeCollection ToExtTreeCollection(IEnumerable <SysModule> ents, WebHelper.ExtTreeNode pnode)
        {
            string parentID = (pnode == null) ? RequestData["id"].ToString() : (pnode["id"] == null ? null : pnode["id"].ToString());

            IEnumerable <SysModule> rtnents = null;

            WebHelper.ExtTreeNodeCollection nodes = new WebHelper.ExtTreeNodeCollection();

            if (ents != null)
            {
                if (String.IsNullOrEmpty(parentID))
                {
                    rtnents = ents.Where(ent => (ent.ParentID == null || ent.ParentID == String.Empty));
                }
                else
                {
                    rtnents = ents.Where(ent => ent.ParentID == parentID);
                }

                if (rtnents.Count() > 0)
                {
                    if (pnode != null)
                    {
                        pnode["leaf"]    = false;
                        pnode["iconCls"] = "iconnone";
                    }

                    foreach (SysModule tent in rtnents)
                    {
                        WebHelper.ExtTreeNode node = new WebHelper.ExtTreeNode();
                        node["id"]               = tent.ModuleID;
                        node["text"]             = tent.Name;
                        node["ParentID"]         = tent.ParentID;
                        node["ModuleID"]         = tent.ModuleID;
                        node["Type"]             = tent.Type;
                        node["Name"]             = tent.Name;
                        node["Code"]             = tent.Code;
                        node["Path"]             = tent.Path;
                        node["PathLevel"]        = tent.PathLevel;
                        node["Url"]              = tent.Url;
                        node["SortIndex"]        = tent.SortIndex;
                        node["LastModifiedDate"] = tent.LastModifiedDate;
                        node["CreateDate"]       = tent.CreateDate;
                        node["Description"]      = tent.Description;

                        node["children"] = ToExtTreeCollection(ents, node);

                        nodes.Add(node);
                    }
                }
                else
                {
                    if (pnode != null)
                    {
                        pnode["leaf"] = true;

                        if (pnode["children"] == null)
                        {
                            pnode.Remove("children");
                        }
                    }
                }
            }

            return(nodes);
        }
Beispiel #4
0
        /// <summary>
        /// 生成ExtTree
        /// </summary>
        /// <param name="ents"></param>
        /// <param name="parentID"></param>
        /// <returns></returns>
        private WebHelper.ExtTreeNodeCollection ToExtTreeCollection(IEnumerable <SysAuth> ents, WebHelper.ExtTreeNode pnode)
        {
            string parentID = (pnode == null) ? null : (pnode["id"] == null ? null : pnode["id"].ToString());
            IEnumerable <SysAuth> rtnents = null;

            WebHelper.ExtTreeNodeCollection nodes = new WebHelper.ExtTreeNodeCollection();

            if (ents != null)
            {
                if (String.IsNullOrEmpty(parentID))
                {
                    rtnents = ents.Where(ent => (ent.ParentID == null || ent.ParentID == String.Empty));
                }
                else
                {
                    rtnents = ents.Where(ent => ent.ParentID == parentID);
                }

                if (rtnents.Count() > 0)
                {
                    if (pnode != null)
                    {
                        pnode["leaf"] = false;
                    }

                    foreach (SysAuth tent in rtnents)
                    {
                        if (tent.ModuleID != null && DataHelper.QueryDataTable("Select ModuleID from SysModule where ModuleID='" + tent.ModuleID + "' and Status='0'").Rows.Count > 0)
                        {
                            continue;
                        }
                        WebHelper.ExtTreeNode node = new WebHelper.ExtTreeNode();
                        node["id"]               = tent.AuthID;
                        node["text"]             = tent.Name;
                        node["AuthID"]           = tent.AuthID;
                        node["ParentID"]         = tent.ParentID;
                        node["ModuleID"]         = tent.ModuleID;
                        node["Type"]             = tent.Type;
                        node["Name"]             = tent.Name;
                        node["Code"]             = tent.Code;
                        node["Data"]             = tent.Data;
                        node["Path"]             = tent.Path;
                        node["PathLevel"]        = tent.PathLevel;
                        node["SortIndex"]        = tent.SortIndex;
                        node["LastModifiedDate"] = tent.LastModifiedDate;
                        node["CreateDate"]       = tent.CreateDate;
                        node["Description"]      = tent.Description;

                        node["children"] = ToExtTreeCollection(ents, node);

                        nodes.Add(node);
                    }
                }
                else
                {
                    if (pnode != null)
                    {
                        pnode["leaf"] = true;

                        if (pnode["children"] == null)
                        {
                            pnode.Remove("children");
                        }
                    }
                }
            }

            return(nodes);
        }