protected void Page_Load(object sender, EventArgs e)
        {
            OnDel();
            if (!IsPostBack)
            {
                sb.Append("\n<script Type='text/javascript'>").Append("\n");
                sb.Append("<!--").Append("\n");
                sb.Append("d = new dTree('d');").Append("\n");
                sb.Append("d.config.closeSameLevel=true;");

                //读取数据
                KingTop.BLL.SysManage.ModuleNode bll = new KingTop.BLL.SysManage.ModuleNode();
                DataTable dt = bll.GetList("SITEWEB", Utils.getOneParams(this.SiteID.ToString()));

                if (dt != null)
                {
                    try
                    {
                        CreateTree(dt, "0");
                    }
                    catch (Exception err)
                    {
                        string stremp = err.Message;
                    }
                }

                sb.Append("document.write(d);").Append("\n");
                //打开所有节点
                sb.Append(" d.openAll();").Append("\n");
                sb.Append("//-->").Append("\n");
                sb.Append("</script>").Append("\n");
                menutree.InnerHtml = sb.ToString();
            }
        }
Esempio n. 2
0
        //通过NodeCode和SiteID获取Nodeid
        private string GetNodeId()
        {
            string strResult = string.Empty;

            KingTop.BLL.SysManage.ModuleNode bll = new KingTop.BLL.SysManage.ModuleNode();
            DataTable dt = bll.GetModeNodeFromCache();

            DataRow[] dr = dt.Select("NodeCode='" + NodeCode + "' and webSiteID=" + SiteID);
            if (dr.Length > 0)
            {
                strResult = dr[0]["NodeID"].ToString();
            }
            return(strResult);
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ////判断是否有当前操作的新建权限
            if (!IsHaveRightByOperCode("New"))
            {
                btnNew.Visible = false;
            }
            OnDel();
            if (!IsPostBack)
            {
                Utils.SetVisiteList(SystemConst.COOKIES_PAGE_KEY, Session.SessionID, Utils.GetUrlParams().Replace("&", "|"), SystemConst.intMaxCookiePageCount); //把当前url全部参数存入cookie中
                StringBuilder sb = new StringBuilder();
                sb.Append("\n<script Type='text/javascript'>").Append("\n");
                sb.Append("<!--").Append("\n");
                sb.Append("d = new dTree('d');").Append("\n");
                sb.Append("d.config.closeSameLevel=true;");

                //读取数据
                KingTop.BLL.SysManage.ModuleNode bll = new KingTop.BLL.SysManage.ModuleNode();
                DataTable dt = bll.GetList("SITESYS", Utils.getOneParams(this.SiteID.ToString()));

                if (dt != null)
                {
                    try
                    {
                        string stremp2  = dt.Rows.Count.ToString();
                        string parentid = "";
                        foreach (DataRow dr in dt.Rows)
                        {
                            if (dr["NodeCode"].ToString().Length <= 3)
                            {
                                parentid = "-1";
                            }
                            else
                            {
                                parentid = dr["NodeCode"].ToString().Substring(0, dr["NodeCode"].ToString().Length - 3);
                            }
                            string strPer = "&nbsp;&nbsp;";
                            if (dr["NodeType"].ToString() == "1")
                            {
                                strPer += "<a HREF=ModelNodeEdit.aspx?Action=New&NodeID=" + NodeID + "&ID=" + dr["NodeID"] + "&NCode=" + dr["NodeCode"] + "&NodeCode=" + NodeCode + "&IsParent=" + dr["NodeType"] + " title=添加子栏目><img SRC=../images/folder.gif border=0></a>&nbsp;&nbsp;";
                            }
                            strPer += "<a HREF=ModelNodeEdit.aspx?Action=Edit&NodeID=" + NodeID + "&ID=" + dr["NodeID"] + "&NCode=" + dr["NodeCode"] + "&NodeCode=" + NodeCode + "&IsParent=" + dr["NodeType"] + " title=修改><img SRC=../images/pen.gif border=0></a>";
                            strPer += "<a HREF=ModelNodeList.aspx?Action=Del&NodeID=" + NodeID + "&ID=" + dr["NodeID"] + "&NCode=" + dr["NodeCode"] + "&NodeCode=" + NodeCode + "&ColumnType=" + dr["ColumnType"] + "&IsParent=" + dr["NodeType"] + " title=删除 onclick=\"selfconfirm({msg:\\'确定要执行删除操作吗?\\',fn:function(data){setAction1(data,\\'" + dr["NodeID"] + "\\',\\'" + dr["NodeCode"] + "\\')}});return false;\"><img SRC=../images/DTree/Del.gif border=0   style=padding-right:5px;padding-left:5px></a>";
                            sb.Append("d.add(").Append(dr["NodeCode"]).Append(",")
                            .Append(parentid).Append(",'").Append(dr["NodeName"]).Append(strPer)
                            .Append("');").Append("\n");
                        }
                    }
                    catch (Exception err)
                    {
                        string stremp = err.Message;
                    }
                }

                sb.Append("document.write(d);").Append("\n");
                //打开所有节点
                sb.Append(" d.openAll();").Append("\n");
                sb.Append("//-->").Append("\n");
                sb.Append("</script>").Append("\n");
                menutree.InnerHtml = sb.ToString();
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 循环生成树
        /// </summary>
        /// <param name="strParCode">父级节点编码,一开始是"",循环得到所有文件夹节点</param>
        /// <param name="objParCell">父级放树控件的容器</param>
        /// <param name="ParentGropID">父节点ID,CreateTreeLeaf()方法的参数</param>
        public void CreateTree(string strParCode, ref System.Web.UI.WebControls.TableCell objParCell, string ParentGropID, DataTable TreeDt, string accountId, string userGroup)
        {
            string strNodeType = "";
            string strCode = "", strName = "";
            string strNodeCode = "";
            string flowState   = "";
            string tableName   = "";
            bool   isShowCheck = true;

            //循环得到文件夹节点数据(strParCode开始是"")
            if (TreeDt == null)
            {
                KingTop.BLL.SysManage.ModuleNode objNode = new ModuleNode();
                TreeDt = objNode.GetModeNodeFromCache();
            }
            //DataTable DTtree = dal.GetTreeData(strParCode,Utils.ParseInt(SiteID,0));
            DataRow[] dr;
            if (strParCode == "")
            {
                dr = TreeDt.Select("len(NodeCode)=3 and WebSiteID=" + SiteID, "NodelOrder ASC,NodeCode ASC");
            }
            else
            {
                dr = TreeDt.Select("NodeCode like '" + strParCode + "%' AND len(NodeCode)=" + (strParCode.Length + 3) + " and WebSiteID=" + SiteID, "NodelOrder ASC,NodeCode ASC");
            }

            //得到父用户组中所有节点编码
            //DataTable DParentNod = dal.GetParentGropNodeID(ParentGropID);
            System.Web.UI.WebControls.Table     objTbl  = new Table();
            System.Web.UI.WebControls.TableRow  objRow  = new TableRow();
            System.Web.UI.WebControls.TableCell objCell = new TableCell();

            try
            {
                for (int i = 0; i < dr.Length; i++)
                {
                    strNodeType = dr[i]["NodeType"].ToString().Trim().ToLower();
                    strCode     = dr[i]["NodeCode"].ToString().Trim();
                    strName     = dr[i]["NodeName"].ToString().Trim();
                    strNodeCode = dr[i]["NodeID"].ToString().Trim();
                    flowState   = dr[i]["ReviewFlowID"].ToString();
                    tableName   = (dr[i]["TableName"].ToString() + "aaaa").ToLower().Replace("k_f_", "k_u_"); //加aaaaa防null值报错
                    //if (flowState == "000000000000000" && tableName.Substring(0, 4) == "k_u_") 不明白为什么要加tableName.Substring(0, 4) == "k_u_"条件
                    if (flowState == "000000000000000")
                    {
                        isShowCheck = true;
                    }
                    else
                    {
                        isShowCheck = false;
                    }

                    if (!HasLeftMenuRights(int.Parse(accountId), userGroup, strCode))
                    {
                        continue;
                    }

                    //如果是文件夹类型
                    if (strNodeType == "1")
                    {
                        objTbl  = new Table();
                        objRow  = new TableRow();
                        objCell = new TableCell();
                        objTbl  = this.CreateTable(objParCell, "tbl" + strParCode);
                        objRow  = this.CreateRow(ref objTbl);



                        //生成树单元格
                        objCell = this.CreateTreeCell(ref objRow, true, strName, strCode);
                        //循环得到下一级节点

                        this.CreateTree(strCode, ref objCell, ParentGropID, TreeDt, accountId, userGroup);
                    }
                    else
                    {
                        //如果父用户组节点编码有数据(即该用户组有父用户组且父用户组权限不为空)
                        if (ParentGropID != "")
                        {
                            //只有该节点是父用户组节点的子集时才生成叶子节点
                            if (CheckHasParentNodeRight(ParentGropID, strCode))
                            {
                                objTbl  = new Table();
                                objRow  = new TableRow();
                                objCell = new TableCell();
                                objTbl  = this.CreateTable(objParCell, "tbl" + strParCode);
                                objRow  = this.CreateRow(ref objTbl);
                                //生成树单元格
                                objCell = this.CreateTreeCell(ref objRow, true, strName, strCode);
                                //生成叶子节点
                                CreateTreeLeaf(strCode, ref objCell, strNodeCode, ParentGropID, isShowCheck, accountId, userGroup);
                                //找到了就跳出循环,不用继续froeache()
                                continue;
                            }
                        }
                        //父用户组节点编码没有数据,表明该用户组是一级用户组,直接生成叶子节点
                        else
                        {
                            objTbl  = new Table();
                            objRow  = new TableRow();
                            objCell = new TableCell();
                            objTbl  = this.CreateTable(objParCell, "tbl" + strParCode);
                            objRow  = this.CreateRow(ref objTbl);
                            //生成树单元格
                            objCell = this.CreateTreeCell(ref objRow, true, strName, strCode);
                            //生成叶子节点
                            CreateTreeLeaf(strCode, ref objCell, strNodeCode, ParentGropID, isShowCheck, accountId, userGroup);
                        }
                    }
                }
            }
            catch (System.Exception exp)
            {
                throw new Exception(exp.Message);
            }
        }