private void btnCheckAllMClients_Click(object sender, EventArgs e) { int ClientGroupID = 0; if (dgvMClientsGroups.SelectedRows.Count > 0) { ClientGroupID = Convert.ToInt32(dgvMClientsGroups.SelectedRows[0].Cells["ClientGroupID"].Value); } OrdersManager.CheckMClients(true, ClientGroupID); OrdersManager.CheckMClientGroups(true, ClientGroupID); }