Example #1
0
        public static AuctionEvent From(string message)
        {
            AuctionEvent aEvent = new AuctionEvent();

            foreach (string field in fieldsIn(message))
            {
                aEvent.addField(field);
            }

            return(aEvent);
        }
        public void Process(Message message)
        {
            var auctionEvent = AuctionEvent.From(message.Body);
            var eventType    = auctionEvent.EventType;

            if ("CLOSE".Equals(eventType))
            {
                auctionEventListener.AuctionClosed();
            }
            else if ("PRICE".Equals(eventType))
            {
                var currentPrice = auctionEvent.CurrentPrice;
                var increment    = auctionEvent.Increment;
                auctionEventListener.CurrentPrice(currentPrice, increment);
            }
        }
Example #3
0
        private void translate(string message)
        {
            var eventList = unpackEventFrom(message);

            AuctionEvent aEvent = AuctionEvent.From(message);

            string type = aEvent.Type;

            if ("CLOSE".Equals(type))
            {
                auctionEventListeners.ForEach(l => l.AuctionClosed());
            }
            else if ("PRICE".Equals(type))
            {
                auctionEventListeners.ForEach(l => l.CurrentPrice(aEvent.CurrentPrice, aEvent.Increment, aEvent.IsFrom(sniperId)));
            }
        }