private void btnGroupCustomerSave_Click(object sender, EventArgs e) { if (dgvGroupList.SelectedRows.Count == 0 || dgvGroupList.SelectedRows[0].Index < 0) { return; } var rowIndex = dgvGroupList.SelectedRows[0].Index; var row = dgvGroupList.Rows[rowIndex]; var groupId = int.Parse(row.Cells["Id"].Value?.ToString()); var customersList = (BindingList <Customer>)dgvGroupCustomerList.DataSource; var customersListId = customersList.Select(c => c.Id).ToList(); GroupBLL.SaveListCustomersOfGroup(groupId, customersListId); Thread loadCustomersInGroupThread = new Thread(() => LoadCustomersInGroup(groupId)); Thread loadCustomersNotInGroupThread = new Thread(() => LoadCustomersNotInGroup(groupId)); Thread loadGroupsThread = new Thread(() => LoadGroups()); loadCustomersInGroupThread.Start(); loadCustomersNotInGroupThread.Start(); loadGroupsThread.Start(); MessageBox.Show("Cập nhật danh sách khách hàng thành công"); }