Exemplo n.º 1
0
        private void dgvUserList_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
        {
            if (UserInfo.UserId == Convert.ToInt32(e.Row.Cells["UserId"].Value))
            {
                cmn.Show("不能删除自己!");
                e.Cancel = true;
                return;
            }
            if (!cmn.Confirm("确定删除用户" + e.Row.Cells["UserName"].Value))
            {
                e.Cancel = true;
                return;
            }

            var query = listUser.Where(c => c.UserId == Convert.ToInt32(e.Row.Cells["UserId"].Value));

            bUser.DeleteUserInfo(query.First());
        }