Beispiel #1
0
        private void ribeDeleteUserRole_Click(object sender, EventArgs e)
        {
            UserRolesVM userRolesVM = this.gvUserRoles.GetRow(this.gvUserRoles.FocusedRowHandle) as UserRolesVM;//获取选中行的实体

            if (userRolesVM.UserName.ToLower() == "admin" || userRolesVM.RoleName.ToLower() == "admin")
            {
                DevExpress.XtraEditors.XtraMessageBox.Show("can not delete role or user  admin!", "提示", MessageBoxButtons.OK);
                return;
            }


            int resDeleteUserRoles = _bll.DeleteUserRoles(userRolesVM);

            if (resDeleteUserRoles > 0)
            {
                DevExpress.XtraEditors.XtraMessageBox.Show("删除成功!", "提示", MessageBoxButtons.OK);
                RequestUserRolesData();
                this.slueUsers.EditValue = null;
            }
            else
            {
                DevExpress.XtraEditors.XtraMessageBox.Show("删除失败!", "提示", MessageBoxButtons.OK);
            }
        }