예제 #1
0
        void btnSave_Click(object sender, EventArgs e)
        {
            if (Check() == -1)
            {
                return;
            }

            Neusoft.Privilege.BizLogic.Model.Priv _res = GetValue();

            int ret;

            try
            {
                PrivilegeService _proxy = Common.Util.CreateProxy();
                NFC.Management.PublicTrans.BeginTransaction();

                if (_current.Id == _current.ParentId)
                {
                    _current = null;
                }
                else
                {
                    using (_proxy as IDisposable)
                    {
                        ret = _proxy.SaveResource((Neusoft.Privilege.BizLogic.Model.Priv)_res);

                        //if (ret == 0)
                        //{
                        //    _current = null;
                        //}
                        //else
                        //{
                        //    _current = _res;
                        //}
                    }
                }
                NFC.Management.PublicTrans.Commit();
            }
            catch (Exception ex)
            {
                _current = null;
                NFC.Management.PublicTrans.RollBack();

                MessageBox.Show(ex.Message, "提示");
                return;
            }
            this.DialogResult = DialogResult.OK;
            base.Close();
            this.txtResId.Enabled = false;
        }