void DelMenu() { DevComponents.AdvTree.Node node = this.treMenu.SelectedNode; int menuID = 0; if (node == null) { this.ShowMessage("请选择要删除的菜单!"); return; } if (MessageBox.Show("是否真的删除当前记录?", "删除提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } menuID = node.Name.Substring(3).ToInt32(); Sys_MenuParam info = new Sys_MenuParam(); info.MenuID = menuID; Sys_MenuLogic logic = new Sys_MenuLogic(this); WCFAddUpdateResult rst = this.AsyncExecute <WCFAddUpdateResult, Sys_MenuParam>(info, logic.DelInfo, (a) => { if (a.Key > 0) { this.BindMenuTree(); } }); }
void GetMenuInfo(int menuID) { this.ShowWaitting(enuWaitMsgType.BindData); Sys_MenuResult info = new Sys_MenuResult(); Sys_MenuLogic logic = new Sys_MenuLogic(this); info = logic.GetInfo(new Sys_MenuParam() { MenuID = menuID }); this.ConvertEntityToControl <Sys_MenuResult>(this.grpEditMenu.Controls, info, null); this.HideWaitting(); }
private void BindMenuTree(TabPage tabpage) { this.ShowWaitting(enuWaitMsgType.BindData); //获取当前选中的tree adtMenu.Nodes.Clear(); Dictionary <string, DevComponents.AdvTree.Node> lstNode = new Dictionary <string, DevComponents.AdvTree.Node>(); Sys_MenuLogic logic = new Sys_MenuLogic(this); List <Sys_MenuResult> lstRst = new List <Sys_MenuResult>(); lstRst = logic.GetMenuTree(new Sys_MenuParam() { }); string beforeCode = "", parentCode = ""; DevComponents.AdvTree.Node beforeNode = null, currentNode = null; foreach (Sys_MenuResult info in lstRst) { #region 产生节点 if (!info.MenuCode.StartsWith(beforeCode) || beforeCode == "") { currentNode = new DevComponents.AdvTree.Node(); currentNode.Image = global::ZNLCRM.UI.Properties.Resources.folder16; currentNode.Text = info.MenuName; currentNode.Name = "trn" + info.MenuID; currentNode.Tag = info.MenuCode; currentNode.ImageExpanded = ZNLCRM.UI.Properties.Resources.folder16; adtMenu.Nodes.Add(currentNode); beforeNode = currentNode; beforeCode = info.MenuCode; } #endregion #region 产生子节点 else { parentCode = info.MenuCode.Substring(0, info.MenuCode.Length - 3); currentNode = new DevComponents.AdvTree.Node(); currentNode.Image = ZNLCRM.UI.Properties.Resources.folder16; currentNode.Text = info.MenuName; currentNode.Name = "trn" + info.MenuID; currentNode.Tag = info.MenuCode; currentNode.ImageExpanded = ZNLCRM.UI.Properties.Resources.folder16; lstNode[parentCode].Nodes.Add(currentNode); } #endregion lstNode.Add(info.MenuCode, currentNode); } HideWaitting(); }
void BindMenuTree() { this.ShowWaitting(enuWaitMsgType.BindData); this.treMenu.Nodes.Clear(); Dictionary <string, DevComponents.AdvTree.Node> lstNode = new Dictionary <string, DevComponents.AdvTree.Node>(); Sys_MenuLogic logic = new Sys_MenuLogic(this); List <Sys_MenuResult> lstRst = new List <Sys_MenuResult>(); lstRst = logic.GetMenuTree(new Sys_MenuParam() { }); string beforeCode = "", parentCode = ""; DevComponents.AdvTree.Node beforeNode = null, currentNode = null, topNode = null; #region 顶级树形菜单节点 topNode = new DevComponents.AdvTree.Node(); topNode.Image = global::ZNLCRM.UI.Properties.Resources.folder16; topNode.Text = "系统菜单目录"; topNode.Name = "trn0"; topNode.Tag = ""; topNode.Checked = true; topNode.Expanded = true; topNode.ImageExpanded = ZNLCRM.UI.Properties.Resources.folder16; this.treMenu.Nodes.Add(topNode); #endregion #region 产生子级节点 foreach (Sys_MenuResult info in lstRst) { #region 产生节点 if (!info.MenuCode.StartsWith(beforeCode) || beforeCode == "") { #region 顶级菜单的顶级 currentNode = new DevComponents.AdvTree.Node(); currentNode.Image = global::ZNLCRM.UI.Properties.Resources.folder16; currentNode.Text = info.MenuName; currentNode.Name = "trn" + info.MenuID; currentNode.Tag = info.MenuCode; currentNode.Expanded = true; currentNode.ImageExpanded = ZNLCRM.UI.Properties.Resources.folder16; topNode.Nodes.Add(currentNode); beforeNode = currentNode; beforeCode = info.MenuCode; #endregion } #endregion #region 产生子节点 else { parentCode = info.MenuCode.Substring(0, info.MenuCode.Length - 3); currentNode = new DevComponents.AdvTree.Node(); currentNode.Image = ZNLCRM.UI.Properties.Resources.folder16; currentNode.Text = info.MenuName; currentNode.Name = "trn" + info.MenuID; currentNode.Tag = info.MenuCode; currentNode.Expanded = true; currentNode.ImageExpanded = ZNLCRM.UI.Properties.Resources.folder16; lstNode[parentCode].Nodes.Add(currentNode); } #endregion lstNode.Add(info.MenuCode, currentNode); } #endregion //隐藏等待窗体 HideWaitting(); this.treMenu.SelectNode(this.treMenu.Nodes[0], DevComponents.AdvTree.eTreeAction.Expand); }
private void btnSaveMenu_Click(object sender, EventArgs e) { Sys_MenuResult info = Form_GetEditEntity("menu") as Sys_MenuResult; Sys_MenuLogic logic = new Sys_MenuLogic(this); WCFAddUpdateResult pageList = this.AsyncExecute <WCFAddUpdateResult, Sys_MenuResult>(info, logic.AddOrUpdate, SaveComplete); }
void BindMenuTree() { Sys_MenuLogic logic = new Sys_MenuLogic(this); List <Sys_MenuResult> lstRst = new List <Sys_MenuResult>(); Dictionary <string, DevComponents.AdvTree.Node> nodeList = new Dictionary <string, DevComponents.AdvTree.Node>(); Dictionary <string, ToolStripMenuItem> lstNode = new Dictionary <string, ToolStripMenuItem>(); adtMenu.Nodes.Clear(); this.menuStrip.Items.Clear(); Node treeNode = null; ToolStripMenuItem beforeNode = null, newNode = null; string beforeCode = "", parentCode = ""; lstRst = logic.GetEmpMenuTree(new Sys_MenuParam() { }); foreach (Sys_MenuResult info in lstRst) { if (!info.MenuCode.StartsWith(beforeCode) || beforeCode == "") { #region 添加菜单栏里的子项 newNode = new ToolStripMenuItem(info.MenuName); this.menuStrip.Items.Add(newNode); beforeCode = info.MenuCode; beforeNode = newNode; #endregion treeNode = new Node { VerticalCellLayoutAlignment = eHorizontalAlign.Left, CellLayout = eCellLayout.Vertical, Text = info.MenuName, Name = "trn" + info.MenuCode, Image = global::ZNLCRM.UI.Properties.Resources.menu_1, Tag = info.TargetForm }; nodeList.Add(info.MenuCode, treeNode); adtMenu.Nodes.Add(treeNode); } else { #region 添加菜单栏里的子项 parentCode = info.MenuCode.Substring(0, info.MenuCode.Length - 3); newNode = new ToolStripMenuItem(info.MenuName); newNode.Tag = info.TargetForm; newNode.Click += menuClick; lstNode[parentCode].DropDownItems.Add(newNode); #endregion #region 添加advtree的节点 if (info.MenuType == "Leaf")//menu下dodule { treeNode = new Node { VerticalCellLayoutAlignment = eHorizontalAlign.Left, CellLayout = eCellLayout.Vertical, Text = info.MenuName, Name = "trn" + info.MenuCode, Image = global::ZNLCRM.UI.Properties.Resources.module, Tag = info.TargetForm }; nodeList[parentCode].Nodes.Add(treeNode);//添加 treeNode.NodeClick += menuClick; } else//二级menu { treeNode = new Node { VerticalCellLayoutAlignment = eHorizontalAlign.Left, CellLayout = eCellLayout.Vertical, Text = info.MenuName, Name = "trn" + info.MenuCode, Image = global::ZNLCRM.UI.Properties.Resources.menu_2, Tag = info.TargetForm }; nodeList[parentCode].Nodes.Add(treeNode); nodeList.Add(info.MenuCode, treeNode);//添加节点 } #endregion } lstNode.Add(info.MenuCode, newNode); //添加节点 } }