Beispiel #1
0
 public void ProcessEvent(List <ITischEvent> tischInhalt, ITischEvent tischEvent)
 {
     foreach (var processor in EventProcessors)
     {
         if (processor.Handled(tischInhalt, tischEvent))
         {
             break;
         }
     }
 }
Beispiel #2
0
        public bool Handled(List <ITischEvent> tischInhalt, ITischEvent tischEvent)
        {
            var bestellung = tischEvent as ArtikelBestelltEvent;

            if (bestellung == null)
            {
                return(false);
            }
            tischInhalt.Add(bestellung);
            return(true);
        }
Beispiel #3
0
 TischEintragDto CreateDtoFromEvent(ITischEvent evt)
 {
     if (evt is ArtikelBestelltEvent bestellt)
     {
         return(Mapper.Map <ArtikelBestelltDto>(bestellt));
     }
     if (evt is ArtikelStorniertEvent storniert)
     {
         return(Mapper.Map <ArtikelStorniertDto>(storniert));
     }
     return(null);
 }
Beispiel #4
0
        public bool Handled(List <ITischEvent> tischInhalt, ITischEvent tischEvent)
        {
            var storno = tischEvent as ArtikelStorniertEvent;

            if (storno == null)
            {
                return(false);
            }
            var bestellung = (ArtikelBestelltEvent)tischInhalt.FirstOrDefault(x => x.Id == storno.Bestellung);

            if (bestellung != null)
            {
                bestellung.Anzahl -= storno.Anzahl;
            }
            return(true);
        }
Beispiel #5
0
 public void AddEvent(ITischEvent tischEvent)
 {
     // Todo: in ctor or here? tischEvent.Id = GetNächsteId();
     _events.Add(tischEvent);
 }