public void ReceiveBestelStatusBijgewerktEvent(BestelStatusBijgewerktEvent bestelStatusBijgewerktEvent) { var bestelling = _bestellingDataMapper.GetById(bestelStatusBijgewerktEvent.Bestelling.Id); bestelling.BestelStatus = (BestelStatus)Enum.ToObject(typeof(BestelStatus), (int)bestelStatusBijgewerktEvent.Bestelling.BestelStatus); _bestellingDataMapper.Update(bestelling); }
public void HandleBetalingGeaccrediteerdEvent(BestellingGeaccrediteerdEvent message) { var bestelling = _bestellingDataMapper.GetByFactuurnummer(message.Factuurnummer); var status = bestelling.BestelStatus; bestelling.BestelStatus = status < BestelStatus.Betaald && status != BestelStatus.Verzonden ? BestelStatus.Goedgekeurd : BestelStatus.Afgerond; _bestellingDataMapper.Update(bestelling); var statusBijGewerktEvent = new BestelStatusBijgewerktEvent(bestelling, NameConstants.BestelServiceBestelStatusUpgedateEvent); _eventPublisher.Publish(statusBijGewerktEvent); }
private void UpdateBestelling(Bestelling bestelling) { try { _bestellingDataMapper.Update(bestelling); } catch (Exception ex) { _logger.LogError("DB exception occured with factuurnummer: {0}", bestelling.Factuurnummer); _logger.LogDebug( "DB exception occured while updating with factuurnummer {}, it threw exception: {}. Inner exception: {}", bestelling.Factuurnummer, ex.Message, ex.InnerException?.Message ); throw new DatabaseException("Something unexpected happend while updating the database"); } }
public long HandlePlaatsBestelling(PlaatsBestellingCommand request) { var bestelling = MapBestelling(request.Bestelling); try { _bestellingDataMapper.Insert(bestelling); bestelling.Factuurnummer = bestelling.Id; _bestellingDataMapper.Update(bestelling); } catch (Exception ex) { _logger.LogError("DB exception occured with klantnummer: {0}", bestelling.Klantnummer); _logger.LogDebug( "DB exception occured with klant {}, it threw exception: {}. Inner exception: {}", bestelling, ex.Message, ex.InnerException?.Message ); throw new DatabaseException("Something unexpected happend while inserting into the database"); } _eventPublish.Publish(new BestellingGeplaatstEvent(bestelling, NameConstants.BestelServiceBestellingGeplaatstEvent)); return(bestelling.Id); }