public static void AgregarReserva(Reserva rs) { using (SqlConnection con = new SqlConnection(SqlServer.CADENA_CONEXION)) { con.Open(); string textoCmd = "insert into Reserva (FechaHoraEntrada, FechaHoraSalida, Id_Habitacion, Id_Cliente, Id_Registrador, Costo_Total, Observacion)values (@FechaHoraEntrada, @FechaHoraSalida, @Id_Habitacion, @Id_Cliente, @Id_Registrador, @Costo_Total, @Observacion)"; SqlCommand cmd = new SqlCommand(textoCmd, con); cmd = rs.ObtenerParametros(cmd); cmd.ExecuteNonQuery(); } }
public static void ActualizarReserva(Reserva rs, int indice) { using (SqlConnection con = new SqlConnection(SqlServer.CADENA_CONEXION)) { con.Open(); string textoCMD = "update Reserva set FechaHoraEntrada = @FechaHoraEntrada, FechaHoraSalida = @FechaHoraSalida, Id_Habitacion = @Id_Habitacion, Id_Cliente = @Id_Cliente, Id_Registrador = @Id_Registrador, Costo_Total = @Costo_Total, Observacion = @Observacion where Id_Reserva = @Id_Reserva"; SqlCommand cmd = new SqlCommand(textoCMD, con); cmd = rs.ObtenerParametros(cmd, true); cmd.ExecuteNonQuery(); } }