private void btnOK_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(tbTypeName.Text.Trim())) { MessageBox.Show("资源名称不能为空!!"); return; } PrivilegeService _proxy = Common.Util.CreateProxy(); try { FrameWork.Management.PublicTrans.BeginTransaction(); using (_proxy as IDisposable) { if (pageUpdate == JudgeOperate) { _proxy.UpdateRoleResource(SetRoleResource()); } else { _proxy.InsertRoleResource(SetRoleResource()); } } FrameWork.Management.PublicTrans.Commit(); this.DialogResult = DialogResult.OK; base.Close(); } catch (Exception ex) { FrameWork.Management.PublicTrans.RollBack(); MessageBox.Show(ex.ToString()); //new SystemErrorForm(ex).ShowDialog(); } }