private void btnResOK_Click(object sender, EventArgs e) { //保存菜单 if (ResCheck() == -1) { return; } try { FrameWork.Management.PublicTrans.BeginTransaction(); PrivilegeService _proxy = Common.Util.CreateProxy(); using (_proxy as IDisposable) { currentRes = _proxy.SaveResourcesItem(ResGetValue()); } this.DialogResult = DialogResult.OK; FrameWork.Management.PublicTrans.Commit(); } catch (Exception ex) { currentRes = null; FrameWork.Management.PublicTrans.RollBack(); MessageBox.Show(ex.Message, "提示"); return; } this.Close(); }
public void AddType(String typeRes) { Neusoft.HISFC.BizLogic.Privilege.Model.Resource currentRes = new Neusoft.HISFC.BizLogic.Privilege.Model.Resource(); currentRes.ParentId = "ROOT"; currentRes.Type = "Menu"; currentRes.Enabled = true; currentRes.Layer = "1"; currentRes.UserId = Neusoft.FrameWork.Management.Connection.Operator.ID; currentRes.OperDate = FrameWork.Function.NConvert.ToDateTime(new FrameWork.Management.DataBaseManger().GetSysDateTime()); currentRes.Name = "新分类"; currentRes.ControlType = typeRes; //保存分类信息 try { PrivilegeService _proxy = Common.Util.CreateProxy(); FrameWork.Management.PublicTrans.BeginTransaction(); using (_proxy as IDisposable) { currentRes = _proxy.SaveResourcesItem(currentRes); } FrameWork.Management.PublicTrans.Commit(); } catch (Exception e) { FrameWork.Management.PublicTrans.RollBack(); MessageBox.Show(e.Message); return; } TreeNode _node = new TreeNode(currentRes.Name); _node.ImageIndex = 0; _node.SelectedImageIndex = 0; _node.Tag = currentRes; this.nTreeView1.Nodes.Add(_node); this.nTreeView1.SelectedNode = _node; AddMenuToList(currentRes); _node.BeginEdit(); }
private void nTreeView1_AfterLabelEdit(object sender, NodeLabelEditEventArgs e) { //保存编辑信息 Neusoft.HISFC.BizLogic.Privilege.Model.Resource currentRes = (Neusoft.HISFC.BizLogic.Privilege.Model.Resource)e.Node.Tag; if (e.Label == null || e.Label.Trim() == "") { e.CancelEdit = true; return; } if (!FrameWork.Public.String.ValidMaxLengh(e.Label, 60)) { e.CancelEdit = true; MessageBox.Show("分类的名称不能超过30个汉字!", "提示"); e.Node.BeginEdit(); return; } currentRes.Name = e.Label; //保存分类信息 try { PrivilegeService _proxy = Common.Util.CreateProxy(); using (_proxy as IDisposable) { currentRes = _proxy.SaveResourcesItem(currentRes); } if (currentRes == null) { return; } } catch (Exception ex) { MessageBox.Show(ex.Message); return; } AddMenuToList(currentRes); }