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); }
public void RemoveType() { EndTreeEdit(); TreeNode _node = nTreeView1.SelectedNode; if (_node == null) { MessageBox.Show("请选择要删除的类!"); return; } if (MessageBox.Show("是否要删除该分类?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return; } if (currentResourcesLists.Count > 0) { MessageBox.Show("改分类中有数据,不能删除!!"); return; } try { PrivilegeService _proxy = Common.Util.CreateProxy(); FrameWork.Management.PublicTrans.BeginTransaction(); using (_proxy as IDisposable) { _proxy.RemoveResourcesItem((_node.Tag as Neusoft.HISFC.BizLogic.Privilege.Model.Resource).Id); } FrameWork.Management.PublicTrans.Commit(); } catch (Exception e) { FrameWork.Management.PublicTrans.RollBack(); MessageBox.Show(e.Message, "提示"); return; } RemoveResFromList((_node.Tag as Neusoft.HISFC.BizLogic.Privilege.Model.Resource).Id); nTreeView1.Nodes.Remove(_node); }