private void dgUsuario_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { txtIDUsuario.Text = dgUsuario.Rows[e.RowIndex].Cells[0].Value.ToString(); txtNome.Text = dgUsuario.Rows[e.RowIndex].Cells[1].Value.ToString(); txtLogin.Text = dgUsuario.Rows[e.RowIndex].Cells[2].Value.ToString(); //Robson if (dgUsuario.Rows[e.RowIndex].Cells[3].Value.ToString() == "Operador") { radOperador.Checked = true; } else if (dgUsuario.Rows[e.RowIndex].Cells[3].Value.ToString() == "Supervisor") { radSupervisor.Checked = true; } else if (dgUsuario.Rows[e.RowIndex].Cells[3].Value.ToString() == "BackOffice") { radBackoffice.Checked = true; } //Campanha usuarioCTL CUsuario = new usuarioCTL(); if (dgUsuario.Rows[e.RowIndex].Cells[4].Value.ToString() != "") { DataTable dataTable = CUsuario.RetornarCampanhasUsuario(Convert.ToInt32(dgUsuario.Rows[e.RowIndex].Cells[0].Value.ToString())); //chlCampanha.DataSource = dataTable; //Desmarca todas as Campanhas for (int i = 0; i < this.chlCampanha.Items.Count; ++i) { this.chlCampanha.SetItemChecked(i, false); } for (int i = 0; i < this.chlCampanha.Items.Count; ++i) { foreach (DataRow dataRow in dataTable.Rows) { if (chlCampanha.Items[i].ToString() == dataRow["Campanha"].ToString()) { this.chlCampanha.SetItemChecked(i, true); } } } } //Ativo if (dgUsuario.Rows[e.RowIndex].Cells[5].Value.ToString() == "Sim") { radSim.Checked = true; radNao.Checked = false; } else { radSim.Checked = false; radNao.Checked = true; } txtSenha.Text = CUsuario.RetornarSenha(Convert.ToInt32(dgUsuario.Rows[e.RowIndex].Cells[0].Value.ToString())); } }