Beispiel #1
0
        public void InsertJson(string jsonText)
        {
            List <Guest> newList = JsonConvert.DeserializeObject <List <Guest> >(jsonText);

            foreach (var eventItem in newList)
            {
                GuestList.Add(eventItem);
            }
        }
Beispiel #2
0
 //Opens park allowing people to come visit
 //Async to allow them to join a little at a time
 public async void OpenPark()
 {
     ParkIsOpen = true;
     for (int i = 0; i < 100; i++)
     {
         GuestList.Add(new Guest(this));
         await Task.Delay(1);
     }
 }
Beispiel #3
0
 /// <summary>
 /// When an IMoveable is making a request we are adding it in the request list
 /// in this case if the maid or guest wants to use the elevator they will be added to the list and
 /// the status will be changed
 /// </summary>
 public void AddDestinationFloor()
 {
     //Same issues as in perform action since we cannot use a foreach loop because of threading issues we
     //are using a forloop to counter it.
     //This is how we can remove guests without breaking the application. If we had more time we wanted to implement it differently
     for (int i = 0; i < RequestList.Count; i++)
     {
         if (RequestList[i] is IMovable g)
         {
             if (g.Position.Y == Position.Y)
             {
                 GuestList.Add(RequestList[i]);
                 if (g.FinalDes.Position.Y < Position.Y)
                 {
                     Up.Add(g.FinalDes.Position.Y);
                     UpdateList();
                 }
                 else
                 {
                     Down.Add(g.FinalDes.Position.Y);
                     UpdateList();
                 }
                 try
                 {
                     GuestList[i].Status = MovableStatus.IN_ELEVATOR;
                     RemoveGuests.Add(GuestList[i]);
                 }
                 catch (Exception)
                 {
                 }
             }
         }
     }
     for (int i = 0; i < RemoveGuests.Count; i++)
     {
         if (RemoveGuests[i] is IMovable g)
         {
             RequestList.Remove(RemoveGuests[i]);
         }
     }
 }
Beispiel #4
0
        /// <summary>
        /// als een gast inchecked bij het hotel
        /// </summary>
        /// <param name="data"> een Dictionary met een wens en een Id</param>
        public void WelcomeGuest(Dictionary <string, string> data)
        {
            //zet de value en key van de gegeven dictonary om naar variable
            string value = data.Values.ToList().Last().ToString();
            string key   = data.Keys.ToList().Last().ToString();

            //zet de value string om naar een wens
            int wish = Int32.Parse(Regex.Match(value, @"\d+").Value);

            //geef de gast een kamer
            AbstractRoom GivenRoom = ((Reception)reception).giveRoom(wish);

            //als de kamer niet null is voeg een nieuwe gast toe aan GuestList
            if (GivenRoom != null)
            {
                GuestList.Add((Guest)humanFactory.CreateGuest(reception, value.Split(' ').Last(), GivenRoom, key));
            }
            else //laat een bericht zien dat de kamer niet beschikbaar is
            {
                Debug.WriteLine("No Room Available");
            }
        }
Beispiel #5
0
 public void AddGuest(Guest newGuest)
 {
     GuestList.Add(newGuest);
 }
Beispiel #6
0
 public void AddGuest(Guest newGuest)
 {
     GuestList.Add(newGuest);
     var response = FacadeGuest.AddSingleGuestAsync(newGuest);
 }