/// <summary> /// 保存权限 /// </summary> /// <param name="resourcesItem"></param> /// <returns></returns> public Neusoft.HISFC.BizLogic.Privilege.Model.Resource SaveResourcesItem(Neusoft.HISFC.BizLogic.Privilege.Model.Resource resourcesItem) { // Neusoft.Framework.Accessory.Context.ContextProcess _appContext = new Neusoft.Framework.Accessory.Context.ContextProcess(); //是新增菜单,插入 if (string.IsNullOrEmpty(resourcesItem.Id)) { resourcesItem.Id = this.GetSequence("PRIV.SEQ_RESOURCESID"); // _appContext.GetSequence("SEQ_RESOURCESID"); resourcesItem.Order = int.Parse(this.GetSequence("PRIV.SEQ_RESOURCESORDER")); //;_appContext.GetSequence("SEQ_RESOURCESORDER") int i = Insert(resourcesItem); if (i < 0) { return(null); } } else//更新 { int i = Update(resourcesItem); if (i < 0) { return(null); } } return(resourcesItem); }
public void RemoveRes() { if (fpSpread1_Sheet1.Rows.Count == 0) { return; } if (MessageBox.Show("是否要删除该资源?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return; } try { PrivilegeService _proxy = Common.Util.CreateProxy(); FrameWork.Management.PublicTrans.BeginTransaction(); using (_proxy as IDisposable) { Neusoft.HISFC.BizLogic.Privilege.Model.Resource res = new Neusoft.HISFC.BizLogic.Privilege.Model.Resource(); res.Id = fpSpread1_Sheet1.Cells[fpSpread1_Sheet1.ActiveRowIndex, 0].Text.Trim(); res.Type = fpSpread1_Sheet1.Cells[fpSpread1_Sheet1.ActiveRowIndex, 6].Text.Trim(); _proxy.RemoveResourcesItem(res); } FrameWork.Management.PublicTrans.Commit(); } catch (Exception e) { FrameWork.Management.PublicTrans.RollBack(); MessageBox.Show(e.Message, "提示"); return; } RemoveResFromList(fpSpread1_Sheet1.Cells[fpSpread1_Sheet1.ActiveRowIndex, 0].Text.Trim()); fpSpread1_Sheet1.Rows.Remove(fpSpread1_Sheet1.ActiveRowIndex, 1); }
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(); }
/// <summary> /// 添加操作构造函数 /// </summary> /// <param name="current"></param> public AddResourceForm(Neusoft.HISFC.BizLogic.Privilege.Model.Resource current, String pageType) { InitializeComponent(); currentParentRes = current; JudgePageType = pageType; ResInitNew(); }
private int RemoveResFromList(string resourcesId) { for (int i = 0; i < treeRes.Count; i++) { Neusoft.HISFC.BizLogic.Privilege.Model.Resource currentRes = treeRes[i]; if (currentRes.Id == resourcesId) { treeRes.Remove(currentRes); return(i); } } return(-1); }
private void AddMenuToList(Neusoft.HISFC.BizLogic.Privilege.Model.Resource currentRes) { //删除先 int i = RemoveResFromList(currentRes.Id); if (i >= 0) { treeRes.Insert(i, currentRes); } else { treeRes.Add(currentRes); } }
private void fpSpread1_CellDoubleClick(object sender, FarPoint.Win.Spread.CellClickEventArgs e) { Neusoft.HISFC.BizLogic.Privilege.Model.Resource oldResItem = new Neusoft.HISFC.BizLogic.Privilege.Model.Resource(); TranslateEntity(oldResItem); AddResourceForm _frmAdd = new AddResourceForm(oldResItem, (nTreeView1.SelectedNode.Tag as Neusoft.HISFC.BizLogic.Privilege.Model.Resource).ControlType, "updataRes"); _frmAdd.ShowDialog(); if (_frmAdd.DialogResult == DialogResult.OK) { Neusoft.HISFC.BizLogic.Privilege.Model.Resource currentResources = _frmAdd.currentRes; if (currentResources != null) { AddMenuToList(currentResources); } nTreeView1_AfterSelect(null, null); } }
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); }
private void TranslateEntity(Neusoft.HISFC.BizLogic.Privilege.Model.Resource resourcesItem) { resourcesItem.Id = fpSpread1_Sheet1.Cells[fpSpread1_Sheet1.ActiveRowIndex, 0].Text.Trim(); resourcesItem.Name = fpSpread1_Sheet1.Cells[fpSpread1_Sheet1.ActiveRowIndex, 1].Text.Trim(); resourcesItem.ParentId = fpSpread1_Sheet1.Cells[fpSpread1_Sheet1.ActiveRowIndex, 2].Text.Trim(); resourcesItem.Layer = fpSpread1_Sheet1.Cells[fpSpread1_Sheet1.ActiveRowIndex, 3].Text.Trim(); resourcesItem.DllName = fpSpread1_Sheet1.Cells[fpSpread1_Sheet1.ActiveRowIndex, 4].Text.Trim(); resourcesItem.WinName = fpSpread1_Sheet1.Cells[fpSpread1_Sheet1.ActiveRowIndex, 5].Text.Trim(); resourcesItem.ControlType = fpSpread1_Sheet1.Cells[fpSpread1_Sheet1.ActiveRowIndex, 6].Text.Trim(); resourcesItem.ShowType = fpSpread1_Sheet1.Cells[fpSpread1_Sheet1.ActiveRowIndex, 7].Text.Trim(); resourcesItem.Shortcut = fpSpread1_Sheet1.Cells[fpSpread1_Sheet1.ActiveRowIndex, 8].Text.Trim(); resourcesItem.Icon = fpSpread1_Sheet1.Cells[fpSpread1_Sheet1.ActiveRowIndex, 9].Text.Trim(); resourcesItem.Tooltip = fpSpread1_Sheet1.Cells[fpSpread1_Sheet1.ActiveRowIndex, 10].Text.Trim(); resourcesItem.Param = fpSpread1_Sheet1.Cells[fpSpread1_Sheet1.ActiveRowIndex, 11].Text.Trim(); resourcesItem.TreeDllName = fpSpread1_Sheet1.Cells[fpSpread1_Sheet1.ActiveRowIndex, 16].Text.Trim(); resourcesItem.TreeName = fpSpread1_Sheet1.Cells[fpSpread1_Sheet1.ActiveRowIndex, 17].Text.Trim(); resourcesItem.UserId = Neusoft.FrameWork.Management.Connection.Operator.ID; resourcesItem.OperDate = FrameWork.Function.NConvert.ToDateTime(new FrameWork.Management.DataBaseManger().GetSysDateTime()); resourcesItem.Enabled = FrameWork.Function.NConvert.ToBoolean(fpSpread1_Sheet1.Cells[fpSpread1_Sheet1.ActiveRowIndex, 12].Text.Trim()); }
public void AddRes() { if (nTreeView1.SelectedNode == null) { MessageBox.Show("请选择要选取的分类!"); return; } AddResourceForm _frmAdd = new AddResourceForm(nTreeView1.SelectedNode.Tag as Neusoft.HISFC.BizLogic.Privilege.Model.Resource, (nTreeView1.SelectedNode.Tag as Neusoft.HISFC.BizLogic.Privilege.Model.Resource).ControlType); _frmAdd.ShowDialog(); if (_frmAdd.DialogResult == DialogResult.OK) { Neusoft.HISFC.BizLogic.Privilege.Model.Resource currentRes = _frmAdd.currentRes; if (currentRes != null) { AddMenuToList(currentRes); } nTreeView1_AfterSelect(null, null); } }
private Neusoft.HISFC.BizLogic.Privilege.Model.Resource ResGetValue() { if (JudgeType == null) { currentRes = new Neusoft.HISFC.BizLogic.Privilege.Model.Resource(); currentRes.ParentId = currentParentRes.Id; currentRes.Layer = Convert.ToString(long.Parse(currentParentRes.Layer) + 1); } currentRes.Name = txtResName.Text.Trim(); currentRes.Shortcut = cmbResShortcut.Text.Trim(); currentRes.Tooltip = txtResTooltips.Text.Trim(); currentRes.DllName = txtResDllName.Text.Trim(); currentRes.WinName = txtResWinName.Text.Trim(); currentRes.TreeDllName = txtResTreeDllName.Text.Trim(); currentRes.TreeName = txtResTreeName.Text.Trim(); currentRes.Param = txtResParam.Text.Trim(); currentRes.ShowType = cmbResShowType.Text == "" ? "" : (cmbResShowType.Text == "模式窗体" ? "ShowDialog" : (cmbResShowType.Text == "无模式窗体" ? "Show" : "Web")); currentRes.Enabled = chbResEnabled.Checked; currentRes.UserId = Neusoft.FrameWork.Management.Connection.Operator.ID; currentRes.OperDate = FrameWork.Function.NConvert.ToDateTime(new FrameWork.Management.DataBaseManger().GetSysDateTime()); currentRes.ControlType = JudgePageType; return(currentRes); }