Esempio n. 1
0
        public static void AddFoodItem(FoodsMenu foodsMenu)
        {
            Console.WriteLine($"You have chosen to add a food");

            string item  = AskForMenuItem($"Enter food name: ");
            double price = AskForMenuItemPrice($"Enter price for {item}: ");

            string[] newArray = new string[(foodsMenu.Foods.Length + 1)];

            int i = 0;

            foreach (string menuItem in foodsMenu.Foods)
            {
                newArray[i] = menuItem;
                i++;
            }

            while (item.Length < 15)
            {
                item = item + " ";
            }

            string foodItem = $"{item} - {price}";

            newArray[i]     = foodItem;
            foodsMenu.Foods = newArray;

            JsonManager.SaveData <FoodsMenu>(foodsMenu, "FoodsMenu", "Menu");
            Console.WriteLine($"{foodItem} added");
        }
Esempio n. 2
0
        private static void EditInfoJson(Information information, string property)
        {
            Console.Clear();
            var currentValue = information.GetType().GetProperty(property).GetValue(information);

            Console.Write(
                $"Editing {property}, currently: {currentValue}\n" +
                $"Please enter new {property}: \n"
                );

            while (true)
            {
                string value = Console.ReadLine();
                if (value.Any())
                {
                    information.GetType().GetProperty(property).SetValue(information, value, null);
                    Console.Clear();
                    Console.WriteLine($"New {property}: {value}");
                    JsonManager.SaveData <Information>(information, "InfoPage", "information");
                    return;
                }
                else
                {
                    Console.WriteLine("You need to enter something");
                }
            }
        }
        public static void Menu()
        {
            List <Calender> listOfCalenders = new List <Calender>();

            //Kijkt of het bestand 'calender' bestaat, als dat niet zo is maakt hij deze aan
            if (!File.Exists(AJsonable.GetPath("Calender", "Calender")))
            {
                for (int i = 0; i < AJsonable.GetAll <EscapeRoom>("EscapeRooms").Count; i++)
                {
                    var rooms = AJsonable.GetAll <EscapeRoom>("EscapeRooms");
                    var cal   = new Calender(rooms[i].ID);
                    listOfCalenders.Add(cal);
                }
                JsonManager.SaveData <List <Calender> >(listOfCalenders, "Calender", "Calender");
            }
            else
            {
                listOfCalenders = JsonManager.GetData <List <Calender> >("Calender", "Calender");
            }

            Console.WriteLine("1. Book room\n2. Check bookings");
            string option = Console.ReadLine();

            if (option == "1")
            {
                BookRoom(listOfCalenders);
            }
            else if (option == "2")
            {
                CheckBookings(listOfCalenders);
            }
        }
Esempio n. 4
0
        public static void RemoveBeverageItem(FoodsMenu foodsMenu)
        {
            Console.Clear();
            Console.WriteLine("Removing beverage item: ");
            int i = 1;

            foreach (string item in foodsMenu.Beverages)
            {
                Console.WriteLine($"\t{i} : {item}");
                i++;
            }

            Console.WriteLine("\nChoose number you want to delete: ");

            int awnser = Int32.Parse(Console.ReadLine()) - 1;

            foodsMenu.Beverages = foodsMenu.Beverages.Where(val => val != foodsMenu.Beverages[awnser]).ToArray();
            JsonManager.SaveData <FoodsMenu>(foodsMenu, "FoodsMenu", "Menu");
            Console.WriteLine("Beverage removed");
        }
Esempio n. 5
0
 public override void Save()
 {
     JsonManager.SaveData(this, "EscapeRooms", this.Name);
 }
        public static void BookRoom(List <Calender> chosenList)
        {
            int roomIndex = 0;
            var list      = chosenList;

            while (true)
            {
                var room = RoomPicker();
                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i].RoomID == room.ID)
                    {
                        roomIndex = i;
                    }
                }
                Console.Clear();
                int numPlayers = NumberOfPlayers(room.MaxPlayers);
                Console.Clear();
                int dag = MenuOptions("How many days from now will you book?", 31, 0);
                list[roomIndex].DayCalender[dag].ShowSchedule();
                int hoeLaat   = Tijd();
                int endTime   = room.MaxDuration + hoeLaat;
                int setupTime = hoeLaat - room.SetupTime;
                Console.Clear();
                Console.WriteLine("What's your last name?");
                string lastName = Console.ReadLine();
                Console.Clear();
                Console.WriteLine("What's your telephone number?");
                string telephone = Console.ReadLine();
                Console.Clear();
                Console.WriteLine("Is the following info correct?\n\n" +
                                  "Name: " + lastName + "\nTelephone: " + telephone +
                                  "\nTime: " + TijdAndersom(hoeLaat) +
                                  "\nRoom: " + room.Name +
                                  "\nDays from now: " + dag +
                                  "\nHow many people: " + numPlayers);

                if (MenuOptions("1. Yes\n2. No", 2) == 1)
                {
                    var boeking = new Booking(numPlayers, hoeLaat, room.ID, lastName, telephone, dag, endTime, setupTime);
                    if (list[roomIndex].DayCalender[dag].AddBooking(boeking) == true)
                    {
                        JsonManager.SaveData <List <Calender> >(list, "Calender", "Calender");
                        Console.Clear();
                        Console.WriteLine("Booking Placed!\n");
                        return;
                    }
                    else
                    {
                        Console.Clear();
                        Console.WriteLine("There appears to be overlap. Please try again");
                        Thread.Sleep(3000);
                        Console.Clear();
                    }
                }
                else
                {
                    Console.Clear();
                    Console.WriteLine("Please enter the info again.");
                    Thread.Sleep(2000);
                }
            }
        }