private void displaydetailinfo(string strusername) { userMenu um = new userMenu(); System.Data.DataTable dt = um.getEditdata(strusername); string strhtml = "空白详细信息"; firsttree.UncheckAllNodes(); if (dt != null && dt.Rows.Count > 0) { strhtml = "<div style=\"line-height:27px;\">" + "用户名:" + strusername; string strmenuparent = ""; string strmenuname = ""; foreach (System.Data.DataRow r in dt.Rows) { if (strmenuparent != r["menuparent"].ToString().Trim()) { //  strhtml += "<br/>" + r["menuparent"].ToString().Trim() + "<br/>" + r["menuname"].ToString().Trim() + " || " + r["functionname"].ToString().Trim() + " "; strmenuparent = r["menuparent"].ToString().Trim(); strmenuname = r["menuname"].ToString().Trim(); } else { if (strmenuname != r["menuname"].ToString().Trim()) { strhtml += "<br/>" + r["menuname"].ToString().Trim() + " || " + r["functionname"].ToString().Trim() + " "; strmenuname = r["menuname"].ToString().Trim(); } else { strhtml += r["functionname"].ToString().Trim() + " "; } } //绑定树 isGo = false; if (r["buttonid"].ToString().Trim() == "") { treeRecursive(firsttree.Nodes[0], r["menuid"].ToString().Trim()); } else { treeRecursive(firsttree.Nodes[0], r["buttonid"].ToString().Trim()); } } strhtml += "</div>"; } detailinfo.Text = strhtml; }
private void inittreeMenu() { // 模拟从数据库返回数据表 userMenu um = new userMenu(); DataTable table = um.gettreeMenudata(SessionUserName); DataSet ds = new DataSet(); ds.Tables.Add(table); ds.Relations.Add("TreeRelation", ds.Tables[0].Columns["id"], ds.Tables[0].Columns["pid"]); foreach (DataRow row in ds.Tables[0].Rows) { if (row.IsNull("pid")) { FineUIPro.TreeNode node = new FineUIPro.TreeNode(); node.Text = row["nodetext"].ToString(); node.NodeID = row["nodeid"].ToString(); node.EnableCheckEvent = true; treeMenu.Nodes.Add(node); ResolveSubTree(row, node); } } }
protected void btnSave_Click(object sender, EventArgs e) { int[] intRowindexarray = mainGrid.SelectedRowIndexArray; if (intRowindexarray.Length < 1) { Alert.Show("请选择一个或多个用户"); return; } userMenu um = new userMenu(); List <Dictionary <string, string> > listddic = new List <Dictionary <string, string> >(); for (int i = 0; i < intRowindexarray.Length; i++) { Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("username", mainGrid.DataKeys[intRowindexarray[i]][1].ToString().Trim()); listddic.Add(dic); } um.deleteMutri("userMenu", listddic); int intresult = 0; List <Dictionary <string, string> > listdic = new List <Dictionary <string, string> >(); FineUIPro.TreeNode[] nodes = firsttree.GetCheckedNodes(); if (nodes.Length > 0) { foreach (FineUIPro.TreeNode node in nodes) { if (node.Leaf) { for (int i = 0; i < intRowindexarray.Length; i++) { Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("ID", Guid.NewGuid().ToString().Trim()); dic.Add("username", mainGrid.DataKeys[intRowindexarray[i]][1].ToString().Trim()); int k; if (System.Int32.TryParse(node.ParentNode.NodeID, out k)) { dic.Add("menuid", node.NodeID.ToString().Trim()); } else { dic.Add("menuid", node.ParentNode.NodeID.ToString().Trim()); dic.Add("buttonid", node.NodeID.ToString().Trim()); } listdic.Add(dic); } } } intresult = um.addMutri(listdic, "userMenu"); } Alert alert = new Alert(); if (intresult > 0) { alert.Icon = Icon.Information; alert.Message = "用户菜单分配成功"; } else { alert.MessageBoxIcon = MessageBoxIcon.Error; alert.Message = "用户菜单分配失败"; } alert.Show(); }
public void MarkAsModified(userMenu item) { }