void dgvAssign_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0 || e.ColumnIndex != colAssign.Index) { return; } List <string> checkedSystemNames = new List <string>(); checkedSystemNames.Add(dgvAssign.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()); SelectSystemsForm selectSystemsForm = new SelectSystemsForm(txCopyCountry.Text); selectSystemsForm.CheckSystems(checkedSystemNames); selectSystemsForm.SetSingleSelectionMode(false); if (selectSystemsForm.ShowDialog() == DialogResult.Cancel) { return; } if (selectSystemsForm.GetSelectedSystemRows().Count > 0) { dgvAssign.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = selectSystemsForm.GetSelectedSystemRows().First().Name; dgvAssign.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag = selectSystemsForm.GetSelectedSystemRows().First().ID; } else { dgvAssign.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = _labelNotAssigned; dgvAssign.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag = _labelNotAssigned; } }
void dgvBaseSystemFormatting_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } if (e.ColumnIndex == colBackColorBaseSystemFormatting.Index || e.ColumnIndex == colForeColorBaseSystemFormatting.Index) { SetBackOrTextColor(dgvBaseSystemFormatting, e.RowIndex, e.ColumnIndex); } if (e.ColumnIndex != colBaseSystem.Index) { return; } List <string> noShowSystemsIDs = new List <string>(); noShowSystemsIDs.Add(_countryConfigFacade.GetSystemRowByName(dgvBaseSystemFormatting.Rows[e.RowIndex].Cells[colSystem.Name].Value.ToString()).ID); List <string> checkedSystemNames = new List <string>(); checkedSystemNames.Add(dgvBaseSystemFormatting.Rows[e.RowIndex].Cells[colBaseSystem.Name].Value.ToString()); SelectSystemsForm selectSystemsForm = new SelectSystemsForm(lblCountry.Text, noShowSystemsIDs); selectSystemsForm.CheckSystems(checkedSystemNames); selectSystemsForm.SetSingleSelectionMode(false); if (selectSystemsForm.ShowDialog() == DialogResult.Cancel) { return; } dgvBaseSystemFormatting.Rows[e.RowIndex].Cells[colBaseSystem.Name].Value = string.Empty; if (selectSystemsForm.GetSelectedSystemRows().Count > 0) { dgvBaseSystemFormatting.Rows[e.RowIndex].Cells[colBaseSystem.Name].Value = selectSystemsForm.GetSelectedSystemRows().First().Name; } }