private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 0) { Direccion.mostraDir mostrar = new Direccion.mostraDir(dataGridView1.CurrentRow.Cells[9].Value.ToString()); mostrar.Show(); } if (e.ColumnIndex == 1) { decimal id=0; string nombre = dataGridView1.CurrentRow.Cells[2].Value.ToString(); string apellido = dataGridView1.CurrentRow.Cells[3].Value.ToString(); string tipoDoc = dataGridView1.CurrentRow.Cells[4].Value.ToString(); string nroDoc = dataGridView1.CurrentRow.Cells[5].Value.ToString(); string mail = dataGridView1.CurrentRow.Cells[6].Value.ToString(); consulta = "select idCli from GESTION_DE_GATOS.Cliente where mail = '"+mail+"'"; resultado = Home.BD.comando(consulta); if (resultado.Read() == true) { id = resultado.GetDecimal(0); } resultado.Close(); string telefono= dataGridView1.CurrentRow.Cells[7].Value.ToString(); string nacionalidad = dataGridView1.CurrentRow.Cells[8].Value.ToString(); string direccion=dataGridView1.CurrentRow.Cells[9].Value.ToString(); string fecha_nac = dataGridView1.CurrentRow.Cells[10].Value.ToString(); string habilitado = dataGridView1.CurrentRow.Cells[11].Value.ToString(); Modificacion modif = new Modificacion(id,nombre, apellido, tipoDoc, nroDoc, mail, telefono, nacionalidad, direccion, fecha_nac, habilitado); modif.Show(); } }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 0) { Direccion.mostraDir mostrar = new Direccion.mostraDir(dataGridView1.CurrentRow.Cells[4].Value.ToString()); mostrar.Show(); } }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 0) { Direccion.mostraDir mostrar = new Direccion.mostraDir(dataGridView1.CurrentRow.Cells[9].Value.ToString()); mostrar.Show(); } if (e.ColumnIndex == 1) { if (dataGridView1.CurrentRow.Cells[11].Value.ToString() == "False") { MessageBox.Show("El cliente ya esta dado de baja"); return; } decimal id=0; string mail = dataGridView1.CurrentRow.Cells[6].Value.ToString(); consulta = "select idCli from GESTION_DE_GATOS.Cliente where mail = '"+mail+"'"; resultado = Home.BD.comando(consulta); if (resultado.Read() == true) { id = resultado.GetDecimal(0); } resultado.Close(); if (MessageBox.Show("Estas seguro que desea inhabilitar al cliente?", "AVISO", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { consulta = "update GESTION_DE_GATOS.Cliente set habilitado=0 where idCli = " + id; resultado = Home.BD.comando(consulta); if (resultado.Read() == true) { } resultado.Close(); } dTable = FrbaHotel.Home.BD.dameDataTable(sAdapter); //BindingSource to sync DataTable and DataGridView BindingSource bSource = new BindingSource(); //set the BindingSource DataSource bSource.DataSource = dTable; //set the DataGridView DataSource dataGridView1.DataSource = bSource; } }