Exemplo n.º 1
0
        private void BiudTree()
        {
            Maticsoft.BLL.SysManageBLL sm = new Maticsoft.BLL.SysManageBLL();
            DataTable dt = sm.GetTreeList("").Tables[0];

            this.listTarget.Items.Clear();
            //加载树
            this.listTarget.Items.Add(new ListItem("根目录", "0"));
            DataRow[] drs = dt.Select("ParentID= " + 0);

            foreach (DataRow r in drs)
            {
                string nodeid       = r["NodeID"].ToString();
                string text         = r["Text"].ToString();
                string parentid     = r["ParentID"].ToString();
                string permissionid = r["PermissionID"].ToString();
                text = "╋" + text;
                this.listTarget.Items.Add(new ListItem(text, nodeid));
                int    sonparentid = int.Parse(nodeid);
                string blank       = "├";

                BindNode(sonparentid, dt, blank);
            }
            this.listTarget.DataBind();
        }
Exemplo n.º 2
0
        private void dataBind(int pageIndex)
        {
            pageIndex--;
            Maticsoft.BLL.SysManageBLL sm = new Maticsoft.BLL.SysManageBLL();
            string strWhere = "";

            if (Session["strWheresys"] != null && Session["strWheresys"].ToString() != "")
            {
                strWhere = Session["strWheresys"].ToString();
            }
            if (listTarget.SelectedItem != null)
            {
                string nodeid = listTarget.SelectedValue;
                if (strWhere.Trim() != "")
                {
                    strWhere = strWhere + " and ";
                }
                strWhere += "ParentID= " + nodeid;
            }

            DataSet ds = new DataSet();

            ds = sm.GetTreeList(strWhere);
            grid.DataSource = ds.Tables[0].DefaultView;
            int record_Count = ds.Tables[0].Rows.Count;
            int page_Size    = grid.PageSize;
            int totalPages   = int.Parse(Math.Ceiling((double)record_Count / page_Size).ToString());

            if (totalPages > 0)
            {
                if ((pageIndex + 1) > totalPages)
                {
                    pageIndex = totalPages - 1;
                }
            }
            else
            {
                pageIndex = 0;
            }
            grid.CurrentPageIndex = pageIndex;
            grid.DataBind();
            int page_Count   = grid.PageCount;
            int page_Current = pageIndex + 1;

            Page011.Record_Count = record_Count;
            Page011.Page_Count   = page_Count;
            Page021.Page_Count   = page_Count;

            Page011.Page_Size    = page_Size;
            Page021.Page_Size    = page_Size;
            Page011.Page_Current = page_Current;
            Page021.Page_Current = page_Current;
        }
Exemplo n.º 3
0
        //邦定根节点
        public void BindTreeView()
        {
            Maticsoft.BLL.SysManageBLL bll = new Maticsoft.BLL.SysManageBLL();
            DataTable dt = bll.GetTreeList("").Tables[0];

            DataRow[] drs = dt.Select("ParentID= " + 0);//选出所有子节点

            //菜单状态
            bool menuExpand = false;

            TreeView1.Nodes.Clear(); // 清空树
            foreach (DataRow r in drs)
            {
                string nodeid       = r["NodeID"].ToString();
                string text         = r["Text"].ToString();
                string parentid     = r["ParentID"].ToString();
                string location     = r["Location"].ToString();
                string url          = r["Url"].ToString();
                string imageurl     = r["ImageUrl"].ToString();
                int    permissionid = int.Parse(r["PermissionID"].ToString().Trim());

                //treeview set
                this.TreeView1.Font.Name = "宋体";
                this.TreeView1.Font.Size = FontUnit.Parse("9");

                Microsoft.Web.UI.WebControls.TreeNode rootnode = new Microsoft.Web.UI.WebControls.TreeNode();
                rootnode.Text = text + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"modify.aspx?id=" + nodeid + "\">修改</a> " +
                                "&nbsp;&nbsp;&nbsp;&nbsp;<a onClick=\"if (!window.confirm('您真的要删除这条记录吗?')){return false;}\" href=\"delete.aspx?id=" + nodeid + "\">删除</a>" +
                                "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"add.aspx?nodeid=" + nodeid + "\">增加节点</a>";
                rootnode.NodeData = nodeid;
                //rootnode.NavigateUrl = url;
                //rootnode.Target = framename;
                rootnode.Expanded = menuExpand;
                rootnode.ImageUrl = "../" + imageurl;

                TreeView1.Nodes.Add(rootnode);

                int sonparentid = int.Parse(nodeid);// or =location
                CreateNode(sonparentid, rootnode, dt);
            }
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                user = new AccountsPrincipal(Context.User.Identity.Name);
                if (Session["UserInfo"] == null)
                {
                    return;
                }
                currentUser = (LTP.Accounts.Bus.User)Session["UserInfo"];
                Maticsoft.BLL.SysManageBLL sm = new Maticsoft.BLL.SysManageBLL();
                DataSet ds;
                ds = sm.GetTreeList("");
                BindTreeView("mainFrame", ds.Tables[0]);

                if (this.TreeView1.Nodes.Count == 0)
                {
                    strWelcome += "<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;但你没有任何模块的访问权";
                }
            }
        }