private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; string[] valores = new string[e.ColumnIndex]; if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { for (int i = 0; i < e.ColumnIndex; i++) { valores[i] = dataGridView1.Rows[e.RowIndex].Cells[i].Value.ToString(); } if (criterioABM == "baja") { BajaHotel levantarBaja = new BajaHotel(valores, conexion); this.Close(); levantarBaja.ShowDialog(); } else { ModifHotel levantarModif = new ModifHotel(valores, conexion); this.Close(); levantarModif.ShowDialog(); } } }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; string[] valores = new string[e.ColumnIndex]; if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { for (int i = 0; i < e.ColumnIndex; i++) { valores[i] = dataGridView1.Rows[e.RowIndex].Cells[i].Value.ToString(); } if (criterioABM == "baja") { BajaHotel levantarBaja = new BajaHotel(valores, conexion); this.Close(); levantarBaja.ShowDialog(); } else { ModifHotel levantarModif = new ModifHotel(valores, conexion); this.Close(); levantarModif.ShowDialog(); } } }
private void CambiarEstado_Click(object sender, EventArgs e) { if (habilitado) { DialogResult bajo = new BajaHotel(TxtId.Text).ShowDialog(); if (bajo == DialogResult.OK) { habilitado = false; completarDatosDeEstado(); groupBox2.Enabled = false; } } else { DialogResult confirma = MessageBox.Show("Está seguro de volver a habilitar el hotel? No podrá deshacer el cambio.", "Habilitar hotel", MessageBoxButtons.YesNo); if (confirma == DialogResult.Yes) { BD bd = new BD(); string query = "UPDATE FUGAZZETA.HistorialBajasHotel SET Fecha_Fin = '" + Program.hoy().ToShortDateString() + "' WHERE Id_Hotel = " + TxtId.Text + " AND Fecha_Inicio = '" + TxtDesde.Text + "'"; bd.ejecutar(query); habilitado = true; completarDatosDeEstado(); groupBox2.Enabled = false; MessageBox.Show("Se ha habilitado el hotel con éxito.", this.Text,MessageBoxButtons.OK); } } }
private void button4_Click(object sender, EventArgs e) { BajaHotel baja = new BajaHotel(); baja.Show(); }