Пример #1
0
        private void DeleteUser()
        {
            if (origin.Id == "admin")
            {
                MessageBox.Show("系统默认用户不能删除!");
                return;
            }
            //{8846BB2A-7B61-4a8a-9ED2-293F6F0A4ABA}
            if (MessageBox.Show("【删除用户】操作将删除用户下的所有权限,请您慎重!\n您确认要删除该用户吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
            {
                return;
            }

            PrivilegeService proxy = Common.Util.CreateProxy();

            using (proxy as IDisposable)
            {
                int ret = proxy.DeleteAuthority(origin);
                if (ret >= 0)
                {
                    this.DialogResult = DialogResult.OK;
                    base.Close();
                }
            }
        }
        public void DeleteUser()
        {
            if (nTreeListView1.SelectedItems.Count == 0)
            {
                MessageBox.Show("请选择要删除行!");
                return;
            }

            if ((nTreeListView1.SelectedItems[0].Tag as User).Id == "admin")
            {
                MessageBox.Show("系统默认用户不能删除!");
                return;
            }

            if (MessageBox.Show("是否要删除该行?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
            {
                return;
            }

            PrivilegeService proxy = Common.Util.CreateProxy();

            using (proxy as IDisposable)
            {
                int ret = proxy.DeleteAuthority(nTreeListView1.SelectedItems[0].Tag as User);
            }
            LoadUser();
        }