private void btnAceptar_Click(object sender, EventArgs e) { TimeSpan ts = dtpFechaHasta.Value - dtpFechaDesde.Value; int diffDate = (int)Math.Round(Convert.ToDouble(ts.TotalDays), 0); int codReserva; if (operationType == 1) /* Agregar Reserva */ { ABM_de_Cliente.GestionHuesped formBusqueda = new FrbaHotel.ABM_de_Cliente.GestionHuesped(this); formBusqueda.Show(); formBusqueda.Cargar_Busqueda(true); // Es Busqueda en Reserva return; } else { codReserva = Convert.ToInt32(tbCodReserva.Text); if (operationType == 2) { using (SqlConnection connection = DbManager.dbConnect()) { using (SqlCommand command = new SqlCommand()) { command.Connection = connection; command.CommandType = CommandType.Text; command.CommandText = " UPDATE ENER_LAND.Reserva " + " SET idRegimen=@idRegimen, " + " fechaDesde=@fechaDesde, " + " Cantidad_dias=@cantDias, " + " Cantidad_huespedes=@cantHuespedes, " + " IdEstado_Reserva=2 " + " WHERE idReserva = @idReserva "; command.Parameters.AddWithValue("@idReserva", codReserva); command.Parameters.AddWithValue("@idRegimen", cmbRegHotel.SelectedValue); command.Parameters.AddWithValue("@fechaDesde", dtpFechaDesde.Value); command.Parameters.AddWithValue("@cantDias", diffDate); command.Parameters.AddWithValue("@cantHuespedes", udCantHuespedes.Value); //TODO validar > 0 command.ExecuteNonQuery(); } DbManager.dbSqlStatementExec("DELETE FROM ENER_LAND.Reserva_Habitacion WHERE idReserva =" + codReserva); reservarHabitaciones(codReserva); registrarAuditoria(codReserva, operationType, ""); MessageBox.Show("Modifcacion Exitosa"); parentForm.Show(); this.Dispose(); } } else /* Cancelacion de Reserva */ { Dialog_Form dialogForm = new Dialog_Form("Motivo de Cancelacion", "Favor ingrese el motivo para cancelar la reserva", this); dialogForm.Show(); this.Visible = false; } } }