/// <summary> /// 绑定树节点 /// </summary> /// <param name="Tree1"></param> public void BandTreeListShowCOM(FineUI.Tree Tree1) { // 模拟从数据库返回数据表 DataTable table; DataSet dsCom = null; dsCom = (DataSet)SPs.Get_COMPONENT00List().ExecuteDataSet(); if (dsCom.Tables.Count > 0) { table = dsCom.Tables[0].Copy(); } else { table = new DataTable(); } DataSet ds = new DataSet(); ds.Tables.Add(table); ds.Relations.Add("TreeRelation", ds.Tables[0].Columns["TREE_ID"], ds.Tables[0].Columns["PARENT_Id"], false); foreach (DataRow row in ds.Tables[0].Rows) { if (row.IsNull("PARENT_Id")) { FineUI.TreeNode node = new FineUI.TreeNode(); node.Text = row["TREE_NAME"].ToString(); node.Expanded = false; Tree1.Nodes.Add(node); ResolveSubTree(row, node); } } }
/// <summary> /// 添加子节点 /// </summary> /// <param name="dt"></param> /// <param name="node"></param> /// <param name="nodeid"></param> public int AddNode(DataTable dt, FineUI.TreeNode node, string nodeid) { //筛选出当前节点下面的子节点 var childdt = DataTableHelper.GetFilterData(dt, BranchTable.ParentId, nodeid, BranchTable.Sort, "Asc"); //判断是否有节点存在 if (childdt.Rows.Count > 0) { foreach (DataRow item in childdt.Rows) { //bool ispage = int.Parse(item[MenuInfo.Columns.MenuInfo_IsMenu].ToString()) == 0 ? false : true; var tnode = new FineUI.TreeNode(); //设置节点名称 tnode.Text = item[BranchTable.Name].ToString(); //设置节点ID tnode.NodeID = item[BranchTable.Id].ToString(); //是否自动扩大 tnode.Expanded = true; //if (!TreeMenu.Nodes.Contains(tnode)) node.Nodes.Add(tnode); //递归添加子节点 int count = AddNode(dt, tnode, item[BranchTable.Id].ToString()); //判断当前节点是否为最终节点 if (count == 0) { tnode.Leaf = true; } tnode.EnableClickEvent = true; } } return childdt.Rows.Count; }
/// <summary> /// 绑定数据 /// </summary> private void DataBind() { //List<SeatManage.ClassModel.TerminalInfoV2> clientlist = SeatManage.Bll.TerminalOperatorService.GetAllTeminalInfo(); List <SeatManage.ClassModel.TerminalInfoV2> clientlist = SeatManage.Bll.TerminalOperatorService.GetAllTeminalInfo(); foreach (SeatManage.ClassModel.TerminalInfoV2 teminal in clientlist) { FineUI.TreeNode node = new FineUI.TreeNode(); //if (!teminal.DeviceSetting.IsAnyPaper) //{ // node.Icon = FineUI.Icon.PrinterCancel; // if (string.IsNullOrEmpty(teminal.Describe)) // { // node.Text = teminal.ClientNo + "(缺纸)"; // } // else // { // node.Text = teminal.Describe + "(缺纸)"; // } //} //else //{ node.Icon = FineUI.Icon.Computer; if (string.IsNullOrEmpty(teminal.Describe)) { node.Text = teminal.ClientNo; } else { node.Text = teminal.Describe; } //} node.ToolTip = teminal.ClientNo; node.NodeID = teminal.ClientNo; node.EnablePostBack = true; treeMenu.Nodes.Add(node); } List <SeatManage.ClassModel.ReadingRoomInfo> roomlist = SeatManage.Bll.ClientConfigOperate.GetReadingRooms(null); foreach (SeatManage.ClassModel.ReadingRoomInfo room in roomlist) { FineUI.CheckItem ci = new FineUI.CheckItem(); ci.Text = (room.Name + "(" + room.No + ")"); ci.Value = room.No; clbroom.Items.Add(ci); } //clbroom.DataTextField = "Name"; //clbroom.DataValueField = "No"; //clbroom.DataSource = roomlist; //clbroom.DataBind(); //cblTerm.DataTextField = "ClientNo"; //cblTerm.DataValueField = "ClientNo"; //cblTerm.DataSource = clientlist; //cblTerm.DataBind(); if (clientlist.Count > 0) { SelectChange(clientlist[0].ClientNo); } }
/// <summary>读取数据</summary> public override void LoadData() { int positionId = ConvertHelper.Cint0(hidPositionId.Text); if (positionId != 0) { //获取指定ID的职位内容 var model = PositionBll.GetInstence().GetModelForCache(x => x.Id == positionId); if (model == null) { return; } //对页面窗体进行赋值 txtName.Text = model.Name; //设置下拉列表选择项 labBranchName.Text = model.Branch_Name; //设置页面权限 _pagePower = model.PagePower; //设置页面控件权限 _controlPower = model.ControlPower; } else { //设置部门 var branchModel = BranchBll.GetInstence().GetModelForCache(ConvertHelper.Cint0(hidBranchId.Text)); labBranchName.Text = branchModel.Name; } //创建树节点 var tnode = new FineUI.TreeNode(); //设置节点名称 tnode.Text = "菜单"; //设置节点ID tnode.NodeID = "0"; //设置当前节点是否为最终节点 tnode.Leaf = false; //是否可以选择(打勾) tnode.EnableCheckBox = true; //是否已经选择 tnode.Checked = true; //是否自动扩大 tnode.Expanded = true; //开启点击节点全选或取消事件 tnode.EnableCheckEvent = true; //根据指定的父ID去查询相关的子集ID var dt = MenuInfoBll.GetInstence().GetDataTable(); //获取全部页面权限 var pgdt = PagePowerSignBll.GetInstence().GetDataTable(); //从一级菜单开始添加 AddNode(dt, pgdt, tnode, "0"); MenuTree.Nodes.Add(tnode); }
/// <summary> /// 勾选当前节点 /// </summary> /// <param name="node"></param> public void CheckNode(FineUI.TreeNode node) { FineUI.TreeNode pnode = node.ParentNode; while (pnode != null) { pnode.Checked = true; pnode = pnode.ParentNode; } }
/// <summary> /// 绑定菜单 /// </summary> private void LoadData() { //获取用户信息 SeatManage.ClassModel.UserInfo LoginUser = GetUserInfo(this.LoginId); if (LoginUser == null) { Response.Write(@"<script language='javascript'>alert('用户信息获取失败请重新登录!'); </script> "); Response.Redirect(this.LogoutPage); } ShowUserInfo(LoginUser); List <SeatManage.ClassModel.SysMenuInfo> listSysMenu = LoginUser.UserMenus; if (listSysMenu != null) { foreach (SeatManage.ClassModel.SysMenuInfo list in listSysMenu) { FineUI.TreeNode node = new FineUI.TreeNode(); node.Text = list.MenuName; node.Expanded = false; node.SingleClickExpand = true; TreeMenu.Nodes.Add(node); foreach (SeatManage.ClassModel.SysMenuInfo listChild in list.ChildMenu) { FineUI.TreeNode nodeChild = new FineUI.TreeNode(); nodeChild.Text = listChild.MenuName; nodeChild.Expanded = false; nodeChild.NavigateUrl = "../" + listChild.MenuLink; node.Nodes.Add(nodeChild); } } } if (LoginUser.UserType == SeatManage.EnumType.UserType.Admin) { houseTab.IFrameUrl = "../FunctionPages/Statistical/LibraryUsedStatistical.aspx"; } else { if (ConfigurationManager.AppSettings["ChangePassWord"] == "close") { btnPassword.Visible = false; } else { btnPassword.Visible = true; } houseTab.IFrameUrl = "../FunctionPages/Statistical/LibraryUsedStat.aspx"; } }
/// <summary> /// 获取阅览室节点 /// </summary> /// <returns></returns> public static List <FineUI.TreeNode> GetReadingRoomTreeNodes(string loginId) { SeatManage.ClassModel.ManagerPotency mp = SeatManage.Bll.T_SM_ManagerPotency.GetManangePotencyByLoginID(loginId); List <FineUI.TreeNode> treeNodes = new List <FineUI.TreeNode>(); if (mp != null) { foreach (SeatManage.ClassModel.ReadingRoomInfo room in mp.RightRoomList) { bool isExists = false; for (int i = 0; i < treeNodes.Count; i++)//遍历已经存在的一级节点,判断所管理的阅览室是否存在。 { if (treeNodes[i].NodeID == room.Libaray.No) { //相同,说明已经存在 FineUI.TreeNode node1 = new FineUI.TreeNode(); //构造一个二级节点,添加到一级节点下。 node1.EnablePostBack = true; node1.Text = room.Name; node1.NodeID = room.No; node1.ToolTip = room.No; treeNodes[i].Nodes.Add(node1); isExists = true; break; } } if (!isExists) { FineUI.TreeNode node0 = new FineUI.TreeNode(); node0.Expanded = true; node0.Text = room.Libaray.Name; node0.NodeID = room.Libaray.No; node0.ToolTip = room.Libaray.No; FineUI.TreeNode node1 = new FineUI.TreeNode(); node1.Text = room.Name; node1.EnablePostBack = true; node1.NodeID = room.No; node1.ToolTip = room.No; node0.Nodes.Add(node1); treeNodes.Add(node0); } } } return(treeNodes); }
/// <summary> /// 生成菜单树 /// </summary> /// <param name="source">数据元</param> /// <param name="pNode">父节点</param> /// <param name="pid">父IP</param> /// <param name="first">是否是第一组</param> private void ResolveSubTree(EnumerableRowCollection <DataRow> source, FineUI.TreeNode pNode, int pid) { var query = from menu in source where menu.Field <int>("M_PARENTID") == pid && code.Contains("," + menu.Field <string>("M_CODE") + ",") == true select new { name = menu.Field <String>("M_NAME"), link = menu.Field <String>("M_LINK"), icon = menu.Field <String>("M_ICON"), id = menu.Field <int>("M_ID") }; foreach (var dr in query) { FineUI.TreeNode node = new FineUI.TreeNode(); node.Text = dr.name; if (!string.IsNullOrEmpty(dr.icon)) { node.IconUrl = "/res/images/menuicon/" + dr.icon; } if (dr.link.Length > 0) { node.Target = "mainframe"; node.Leaf = true; node.NavigateUrl = dr.link; } else { node.Expanded = true; } if (pNode == null) { leftTree.Nodes.Add(node); } else { pNode.Nodes.Add(node); } ResolveSubTree(source, node, dr.id); } }
private void clearTreeNode(FineUI.TreeNode tn) { if (string.IsNullOrEmpty(tn.NavigateUrl) && tn.Nodes.Count == 0) { if (tn.ParentNode == null) { leftMenuTree.Nodes.Remove(tn); } else { tn.ParentNode.Nodes.Remove(tn); } isCleared = false; } else { for (int i = 0; i < tn.Nodes.Count; i++) { clearTreeNode(tn.Nodes[i]); } } }
private void loadSubMenu(XElement parentItem, FineUI.TreeNode parentNode) { //BaseRepository<GroupInPermission> groupPermissionService = new BaseRepository<GroupInPermission>(); foreach (var item in parentItem.Elements()) { FineUI.TreeNode tn = new FineUI.TreeNode(); tn.Text = item.Attribute("Text").Value; tn.IconUrl = item.Attribute("ImageUrl").Value; if (item.Attribute("NavigateUrl") != null) { tn.NavigateUrl = item.Attribute("NavigateUrl").Value; } //GroupInPermission groupPermission = groupPermissionService.FindBy(v => v.Permission.PermissionName == "浏览" && v.GroupId == 2 && v.Permission.Path.PathName == tn.Text); //if (groupPermission != null && !groupPermission.Enabled) //{ // continue; //} loadSubMenu(item, tn); parentNode.Nodes.Add(tn); } }
//添加子节点 public void ResolveSubTree(DataRow dataRow, FineUI.TreeNode treeNode) { DataRow[] rows = dataRow.GetChildRows("TreeRelation"); if (rows.Length > 0) { treeNode.Expanded = true; foreach (DataRow row in rows) { FineUI.TreeNode node = new FineUI.TreeNode(); node.Text = row["TREE_NAME"].ToString(); node.NodeID = row["TREE_ID"].ToString(); if (row["TREE_ID"].ToString().Contains("PRODUCT00_")) { //node.EnableCheckEvent = true; node.EnableClickEvent = true; //node.OnClientClick = ""; } treeNode.Nodes.Add(node); ResolveSubTree(row, node); } } }
private void leftMenuTreeDataBind() { //FineUI.TreeNode tnUserCenter = new FineUI.TreeNode(); //tnUserCenter.Text = "用户中心"; //tnUserCenter.Nodes.Add(new FineUI.TreeNode { Text = "用户信息", NavigateUrl = "~/UserCenter/UserInfoEdit.aspx" }); //tnUserCenter.Nodes.Add(new FineUI.TreeNode { Text = "修改密码", NavigateUrl = "~/UserCenter/ChangePwd.aspx" }); //leftMenuTree.Nodes.Add(tnUserCenter); //FineUI.TreeNode tnSystemManage = new FineUI.TreeNode(); //tnSystemManage.Text = "系统管理"; //tnSystemManage.Nodes.Clear(); //tnSystemManage.Nodes.Add(new FineUI.TreeNode { Text = "部门管理", NavigateUrl = "~/SystemManage/DepartmentManage.aspx" }); //tnSystemManage.Nodes.Add(new FineUI.TreeNode { Text = "用户管理", NavigateUrl = "~/SystemManage/UserManage.aspx" }); //tnSystemManage.Nodes.Add(new FineUI.TreeNode { Text = "用户组管理", NavigateUrl = "~/SystemManage/UserGroupManage.aspx" }); //leftMenuTree.Nodes.Add(tnSystemManage); XElement root = XElement.Load(Server.MapPath("MainMenu.xml")); foreach (var item in root.Elements()) { FineUI.TreeNode tn = new FineUI.TreeNode(); tn.Text = item.Attribute("Text").Value; tn.IconUrl = item.Attribute("ImageUrl").Value; if (item.Attribute("NavigateUrl") != null) { tn.NavigateUrl = item.Attribute("NavigateUrl").Value; } //GroupInPermission groupPermission = groupPermissionService.FindBy(v => v.Permission.PermissionName == "浏览" && v.GroupId == 2 && v.Permission.Path.PathName == tn.Text); //if (groupPermission != null && !groupPermission.Enabled) //{ // continue; //} loadSubMenu(item, tn); leftMenuTree.Nodes.Add(tn); } clearLeftMenuTree(); }
/// <summary> /// 添加子节点 /// </summary> /// <param name="dt"></param> /// <param name="node"></param> /// <param name="nodeid"></param> public int AddNode(DataTable dt, FineUI.TreeNode node, string nodeid) { //筛选出当前节点下面的子节点 var childdt = DataTableHelper.GetFilterData(dt, BranchTable.ParentId, nodeid, BranchTable.Sort, "Asc"); //判断是否有节点存在 if (childdt.Rows.Count > 0) { foreach (DataRow item in childdt.Rows) { //bool ispage = int.Parse(item[MenuInfo.Columns.MenuInfo_IsMenu].ToString()) == 0 ? false : true; var tnode = new FineUI.TreeNode(); //设置节点名称 tnode.Text = item[BranchTable.Name].ToString(); //设置节点ID tnode.NodeID = item[BranchTable.Id].ToString(); //是否自动扩大 tnode.Expanded = true; //if (!TreeMenu.Nodes.Contains(tnode)) node.Nodes.Add(tnode); //递归添加子节点 int count = AddNode(dt, tnode, item[BranchTable.Id].ToString()); //判断当前节点是否为最终节点 if (count == 0) { tnode.Leaf = true; } tnode.EnableClickEvent = true; } } return(childdt.Rows.Count); }
/// <summary> /// 添加子节点 /// </summary> /// <param name="dt"></param> /// <param name="node"></param> /// <param name="nodeid"></param> public void AddNode(DataTable dt, DataTable pgdt, FineUI.TreeNode node, string nodeid) { //筛选出当前节点下面的子节点 var childdt = DataTableHelper.GetFilterData(dt, MenuInfoTable.ParentId, nodeid, MenuInfoTable.Sort, "Asc"); //判断是否有节点存在 if (childdt.Rows.Count > 0) { foreach (DataRow item in childdt.Rows) { bool ispage = int.Parse(item[MenuInfoTable.IsMenu].ToString()) != 0; var tnode = new FineUI.TreeNode(); //设置节点名称 tnode.Text = item[MenuInfoTable.Name].ToString(); //设置节点ID tnode.NodeID = item[MenuInfoTable.Id].ToString(); //开启点击节点全选或取消事件 tnode.EnableCheckEvent = true; //判断当前节点是否为最终节点 if (ispage) { //添加页面权限 //筛选出当前节点下面的页面权限节点 DataTable cdt = DataTableHelper.GetFilterData(pgdt, PagePowerSignTable.MenuInfo_Id, item[MenuInfoTable.Id].ToString(), null, null); //判断当前节点下是否有设置页面权限 if (cdt == null || cdt.Rows.Count == 0) { tnode.Leaf = true; } else { //设置为非最终节点 tnode.Leaf = false; //循环添加页面权限节点 for (int i = 0; i < cdt.Rows.Count; i++) { var tn = new FineUI.TreeNode(); //设置节点名称 tn.Text = cdt.Rows[i][PagePowerSignTable.CName].ToString(); //设置节点ID tn.NodeID = item[MenuInfoTable.Id].ToString() + "|" + cdt.Rows[i][PagePowerSignTable.PagePowerSignPublic_Id].ToString(); tn.Leaf = true; //是否可以选择(打勾) tn.EnableCheckBox = true; //是否已经选择 if (_controlPower.IndexOf("," + tn.NodeID + ",") >= 0) { tn.Checked = true; } tnode.Nodes.Add(tn); } } } //是否可以选择(打勾) tnode.EnableCheckBox = true; //是否已经选择 if (_pagePower.IndexOf("," + tnode.NodeID + ",") >= 0) { tnode.Checked = true; } //是否自动扩大 tnode.Expanded = true; //if (!MenuTree.Nodes.Contains(tnode)) node.Nodes.Add(tnode); //递归添加子节点 AddNode(dt, pgdt, tnode, item[MenuInfoTable.Id].ToString()); } } }
/// <summary>读取数据</summary> public override void LoadData() { int positionId = ConvertHelper.Cint0(hidPositionId.Text); if (positionId != 0) { //获取指定ID的职位内容 var model = PositionBll.GetInstence().GetModelForCache(x => x.Id == positionId); if (model == null) return; //对页面窗体进行赋值 txtName.Text = model.Name; //设置下拉列表选择项 labBranchName.Text = model.Branch_Name; //设置页面权限 _pagePower = model.PagePower; //设置页面控件权限 _controlPower = model.ControlPower; } else { //设置部门 var branchModel = BranchBll.GetInstence().GetModelForCache(ConvertHelper.Cint0(hidBranchId.Text)); labBranchName.Text = branchModel.Name; } //创建树节点 var tnode = new FineUI.TreeNode(); //设置节点名称 tnode.Text = "菜单"; //设置节点ID tnode.NodeID = "0"; //设置当前节点是否为最终节点 tnode.Leaf = false; //是否可以选择(打勾) tnode.EnableCheckBox = true; //是否已经选择 tnode.Checked = true; //是否自动扩大 tnode.Expanded = true; //开启点击节点全选或取消事件 tnode.EnableCheckEvent = true; //根据指定的父ID去查询相关的子集ID var dt = MenuInfoBll.GetInstence().GetDataTable(); //获取全部页面权限 var pgdt = PagePowerSignBll.GetInstence().GetDataTable(); //从一级菜单开始添加 AddNode(dt, pgdt, tnode, "0"); MenuTree.Nodes.Add(tnode); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { String user_isgrade = Server.UrlDecode(Request.Cookies["Userisgrade"].Value); String user_position = Server.UrlDecode(Request.Cookies["Userposition"].Value); if (user_isgrade.Equals("七年级") || user_isgrade.Equals("八年级") || user_isgrade.Equals("九年级")) { FineUI.TreeNode node = new FineUI.TreeNode(); node.Text = "年级主任工作"; node.Expanded = false; leftMenuTree.Nodes.Add(node); FineUI.TreeNode node1 = new FineUI.TreeNode(); node1.Text = "教师工作目录"; node1.NavigateUrl = "~/GradeTeacher.aspx"; leftMenuTree.Nodes[1].Nodes.Add(node1); FineUI.TreeNode node2 = new FineUI.TreeNode(); node2.Text = "教师工作调整"; node2.NavigateUrl = "~/ChooseManager.aspx"; leftMenuTree.Nodes[1].Nodes.Add(node2); FineUI.TreeNode node3 = new FineUI.TreeNode(); node3.Text = "请假信息管理"; node3.NavigateUrl = "~/LeaveItem.aspx"; leftMenuTree.Nodes[1].Nodes.Add(node3); } else if (user_isgrade.Equals("后勤")) { FineUI.TreeNode node = new FineUI.TreeNode(); node.Text = "后勤工作"; node.Expanded = false; leftMenuTree.Nodes.Add(node); FineUI.TreeNode node1 = new FineUI.TreeNode(); node1.Text = "职务分配"; node1.NavigateUrl = "~/ServiceManager.aspx"; leftMenuTree.Nodes[1].Nodes.Add(node1); FineUI.TreeNode node2 = new FineUI.TreeNode(); node2.Text = "请假审核"; node2.NavigateUrl = "~/LeaveItem.aspx"; leftMenuTree.Nodes[1].Nodes.Add(node2); } if (user_position.Equals("财务")) { FineUI.TreeNode node = new FineUI.TreeNode(); node.Text = "财务工作"; node.NavigateUrl = "~/Fianace.aspx"; leftMenuTree.Nodes.Add(node); } else if (user_position.Equals("校长") || user_position.Equals("副校长")) { int n = 1; if (leftMenuTree.Nodes.Count == 1) { n = 1; } if (leftMenuTree.Nodes.Count == 2) { n = 2; } FineUI.TreeNode node = new FineUI.TreeNode(); node.Text = "校务工作"; node.Expanded = false; leftMenuTree.Nodes.Add(node); FineUI.TreeNode node1 = new FineUI.TreeNode(); node1.Text = "教师信息管理"; node1.NavigateUrl = "~/Teacher_Manage.aspx"; leftMenuTree.Nodes[n].Nodes.Add(node1); FineUI.TreeNode node2 = new FineUI.TreeNode(); node2.Text = "班级信息管理"; node2.NavigateUrl = "~/TeacherManager2.aspx"; leftMenuTree.Nodes[n].Nodes.Add(node2); FineUI.TreeNode node3 = new FineUI.TreeNode(); node3.Text = "学期开始与关闭"; node3.NavigateUrl = "~/TermAdd.aspx"; leftMenuTree.Nodes[n].Nodes.Add(node3); } } }