protected void btnSave_Click(object sender, EventArgs e) { try { FineOffice.Modules.SYS_MenuList model = new FineOffice.Modules.SYS_MenuList(); model.TabID = txtAuthorityValue.Text.Trim(); model.Icon = txtIcon.Text.Trim(); if (rdbMenuType.SelectedValue == "IsFunction") { model.IsFuntion = true; model.IsModule = false; } else { model.IsModule = true; model.IsFuntion = false; } model.NavigateUrl = txtNavigateUrl.Text.Trim(); model.Ordering = int.Parse(txtOrdering.Text); model.ParentID = int.Parse(hiddenParentID.Text); model.SingleClickExpand = true; model.Text = txtText.Text.Trim(); model.Remark = txtRemark.Text.Trim(); model.Stop = chkStop.Checked; menuBll.Add(model); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference("subwin_close")); } catch (Exception ex) { Alert.Show(ex.Message); } }
private void CreateXElement(XElement root, FineOffice.Modules.SYS_MenuList model) { List <FineOffice.Modules.SYS_MenuList> tempList = authorityList.Where(d => d.ParentID == model.ID).ToList(); foreach (FineOffice.Modules.SYS_MenuList temp in tempList) { XElement xe = new XElement("TreeNode", new object[] { new XAttribute("Text", temp.Text), new XAttribute("SingleClickExpand", temp.SingleClickExpand), new XAttribute("IconUrl", temp.Icon == null?"":string.Format("~/icon/{0}.png", temp.Icon)), new XAttribute("NodeID", temp.TabID == null?"":temp.TabID), }); root.Add(xe); if (temp.NavigateUrl != null) { object[] xas = new object[] { new XAttribute("NavigateUrl", temp.NavigateUrl), }; xe.Add(xas); } CreateXElement(xe, temp); } }
/// <summary> /// 取子节点 /// </summary> /// <param name="authority"></param> private void GetSubList(FineOffice.Modules.SYS_MenuList authority) { unEnabledList.Add(authority); List <FineOffice.Modules.SYS_MenuList> tempList = authorityList.Where(s => s.ParentID == authority.ID).ToList(); foreach (FineOffice.Modules.SYS_MenuList a in tempList) { GetSubList(a); } }
private void BuildSubTree(FineOffice.Modules.SYS_MenuList model, int level) { List <FineOffice.Modules.SYS_MenuList> tempList = menuList.Where(s => s.ParentID == model.ID).OrderBy(d => d.Ordering).ToList(); level++; foreach (FineOffice.Modules.SYS_MenuList a in tempList) { a.TreeLevel = level; treeList.Add(a); BuildSubTree(a, level); } }
/// <summary> /// 创建树第一级节点 /// </summary> private void CreateXElement(XElement root, FineOffice.Modules.SYS_MenuList model) { List <FineOffice.Modules.SYS_MenuList> tempList = authorityList.Where(d => d.ParentID == model.ID).ToList(); foreach (FineOffice.Modules.SYS_MenuList temp in tempList) { XElement xe = new XElement("TreeNode", new object[] { new XAttribute("Text", temp.Text), new XAttribute("EnablePostBack", true), new XAttribute("IconUrl", temp.Icon == null?"":string.Format("~/icon/{0}.png", temp.Icon)), new XAttribute("NodeID", temp.ID), }); root.Add(xe); CreateXElement(xe, temp); } }
protected void InitModule() { int id = int.Parse(Request["id"]); FineOffice.Modules.SYS_MenuList model = menuBll.GetModel(d => d.ID == id); hiddenID.Text = model.ID.ToString(); txtAuthorityValue.Text = model.TabID; txtIcon.Text = model.Icon; if (model.IsModule != null && model.IsModule.Value) { txtAuthorityValue.Enabled = false; txtNavigateUrl.Enabled = false; rdbMenuType.SelectedIndex = 0; } else { txtAuthorityValue.Enabled = true; txtNavigateUrl.Enabled = true; rdbMenuType.SelectedIndex = 1; } txtNavigateUrl.Text = model.NavigateUrl; txtOrdering.Text = model.Ordering.ToString(); hiddenParentID.Text = model.ParentID.ToString(); if (model.ParentID != 0) { FineOffice.Modules.SYS_MenuList temp = menuBll.GetModel(a => a.ID == model.ParentID); txtParent.Text = temp.Text; } txtText.Text = model.Text; txtRemark.Text = model.Remark; if (model.Stop != null) { chkStop.Checked = model.Stop.Value; } txtParent.OnClientTriggerClick = wdnSelectMenu.GetSaveStateReference(txtParent.ClientID, hiddenParentID.ClientID) + wdnSelectMenu.GetShowReference("../System/FrmSelectMenu.aspx?id=" + id); }