//private void tvMenu_TreeNodeExpanded(object sender, TreeNodeEventArgs e) //{ // if (e.Node != null) // { // e.Node.ImageUrl = @"..\images\icons\Open.gif"; // } //} //private void tvMenu_TreeNodeCollapsed(object sender, TreeNodeEventArgs e) //{ // if (e.Node != null) // { // e.Node.ImageUrl = @"..\images\icons\TreeViewClose.gif"; // } //} private void BindTree() { FunctionController controller = new FunctionController(); DataSet dstMenu = controller.GetAllFunctions(); if (dstMenu == null || dstMenu.Tables[0].Rows.Count <= 0) { TreeNode node = new TreeNode(); node.Text = "系统功能"; node.Value = ""; node.NavigateUrl = ""; this.tvMenu.Nodes.Add(node); } else { DataRow[] drs = dstMenu.Tables[0].Select("functionparentid='0'"); if (drs.Length > 0) { foreach (DataRow dr in drs) { TreeNode node = new TreeNode(); node.Text = Convert.ToString(dr["functionname"]); node.Value = Convert.ToString(dr["oid"]); node.NavigateUrl = Convert.ToString(dr["functionurl"]); this.BindChildNode(dstMenu, node); this.tvMenu.Nodes.Add(node); } } } }
private void BindTree() { this.tvMenu.Nodes.Clear(); FunctionController controller = new FunctionController(); DataSet dstMenu = controller.QueryFunctions(this.txtQueryFunCode.Text.Trim(), this.txtQueryFunName.Text.Trim()); TreeNode node = new TreeNode(); node.Text = "系统功能"; node.Value = "0"; node.NavigateUrl = ""; this.tvMenu.Nodes.Add(node); if (dstMenu != null && dstMenu.Tables[0].Rows.Count > 0) { this.BindChildNode(dstMenu, node); } this.tvMenu.ExpandAll(); }
private void btnAdd_Click(object sender, EventArgs e) { TreeNode selectedNode = this.tvMenu.SelectedNode; if (selectedNode==null) { base.ShowMessage("请选择上一级菜单!"); return; } else if (selectedNode.Value != null) { this.btnSave.Visible = true; this.ClearAllControls(); FunctionEntity fun = new FunctionController().GetFunc(selectedNode.Value); if (fun == null) { txtFuncLevel.Text = "0"; } else { txtFuncLevel.Text = (Convert.ToInt32(txtFuncLevel.Text) + 1).ToString(); } txtFuncOrder.Text = new FunctionController().GetChildMaxOrder(selectedNode.Value); } }
private void tvMenu_SelectedNodeChanged(object sender, EventArgs e) { TreeNode selectedNode = this.tvMenu.SelectedNode; if (selectedNode.Value == "0") { btnSave.Visible = false; hfParentOID.Value = selectedNode.Value; } else { FunctionEntity fun = new FunctionController().GetFunc(selectedNode.Value); if (fun != null) { hfParentOID.Value = selectedNode.Value; hdfOID.Value = selectedNode.Value; txtFuncCode.Text = fun.FUNCTIONKEY; txtFuncMemo.Text = fun.MEMO; txtFuncName.Text = fun.FUNCTIONNAME; txtFuncOrder.Text = fun.FUNCTIONORDER.ToString(); txtFuncUrl.Text = fun.FUNCTIONURL; txtFuncLevel.Text = fun.FUNCTIONLEVEL.ToString(); drpFuncStatus.SelectedValue = fun.FUNCTIONSTATUS.ToString(); } } }
private void btnSave_Click(object sender, EventArgs e) { if (CheckSave()) { bool retValue = true; FunctionController controler = new FunctionController(); FunctionEntity fun = new FunctionEntity(); fun.OID = hdfOID.Value; fun.FUNCTIONPARENTID = hfParentOID.Value; fun.FUNCTIONKEY = txtFuncCode.Text.Trim(); fun.FUNCTIONLEVEL = Convert.ToInt32(txtFuncLevel.Text.Trim()); fun.FUNCTIONNAME = txtFuncName.Text.Trim(); fun.FUNCTIONORDER = Convert.ToInt32(txtFuncOrder.Text.Trim()); fun.FUNCTIONSTATUS = drpFuncStatus.SelectedValue; fun.FUNCTIONTYPE = 0; fun.FUNCTIONURL = txtFuncUrl.Text.Trim(); fun.MEMO = txtFuncMemo.Text.Trim(); fun.CUSER = AppCenter.CurrentPersonAccount; fun.MUSER = AppCenter.CurrentPersonAccount; if (string.IsNullOrEmpty(fun.OID)) { fun.OID = Guid.NewGuid().ToString(); retValue = controler.InsertFunction(fun); } else { retValue = controler.UpdateFunction(fun); } if (retValue) { base.ShowMessage(CommonMessage.SaveSuccess); this.ClearAllControls(); this.BindTree(); } else { base.ShowMessage(CommonMessage.SaveFailed); } } }
private void BindTree() { this.tvMenu.Nodes.Clear(); FunctionController controller = new FunctionController(); DataSet dstMenu = controller.GetAllFunctions(); TreeNode node = new TreeNode(); node.Text = "系统功能"; node.Value = "0"; node.NavigateUrl = ""; node.ShowCheckBox = true; this.tvMenu.Nodes.Add(node); if (dstMenu != null && dstMenu.Tables[0].Rows.Count > 0) { this.BindChildNode(dstMenu, node); } this.tvMenu.ExpandAll(); }