Esempio n. 1
0
        /// <summary>
        /// Handles incomming events
        /// </summary>
        /// <param name="evt">teh incomming event</param>
        public void Notify(HotelEvent evt)
        {
            if (evt.EventType == HotelEventType.EVACUATE)
            {
                Status               = MovableStatus.EVACUATING;
                LastStatus           = MovableStatus.EVACUATING;
                _hteCalculateCounter = 0;
                _hteTime             = 5;
            }
            else if (evt.EventType.Equals(HotelEventType.CLEANING_EMERGENCY))
            {
                CleaningEvent ce = new CleaningEvent();

                foreach (var item in evt.Data)
                {
                    if (item.Key.Contains("kamer"))
                    {
                        ce.ToClean = Hotel.GetAreaByID(int.Parse(item.Value));

                        if (Hotel.GetAreaByID(int.Parse(item.Value)).AreaStatus != AreaStatus.NEED_CLEANING)
                        {
                            Hotel.GetAreaByID(int.Parse(item.Value)).AreaStatus = AreaStatus.NEED_CLEANING;
                        }
                        else
                        {
                            return;
                        }
                    }
                    if (item.Key.Contains("HTE"))
                    {
                        ce.Time = int.Parse(item.Value);
                    }
                }

                ToCleanList.Enqueue(ce);
            }
        }