//COMPLETE //A staff member can book a maximum of 4 slots per day. - DONE //The slots must be booked between the school working hours of 9am to 2pm and will always be booked at the start of the hour. - DONE //Each room can be booked for a maximum of 2 slots per day. - DONE //Create a new slot private static void CreateSlot() { Slot newSlot; Console.WriteLine("---Create Slot---"); Console.Write("Enter room name: "); string inputRoom = Console.ReadLine().ToUpper(); Console.Write("Enter date for slot(dd-MM-yyyy): "); string inputDate = Console.ReadLine(); Console.Write("Enter time for slot (HH:mm): "); string inputTime = Console.ReadLine(); Console.Write("Enter staff ID: "); string inputStaffID = Console.ReadLine(); newSlot = ValidateEngine.ValidateCreateSlot(inputRoom, inputDate, inputTime, inputStaffID); if (newSlot == null) { return; } else { var SlotList = new SlotManager(); SlotList.CreateSlot(newSlot); Console.WriteLine("Slot created successfully.");; } }
//A student can only make 1 booking per day. - DONE //A slot can have a maximum of 1 student booked into it. - DONE //Create a booking (assign the studentID to a slots booking field) for a specified slot static void MakeBooking() { Slot newSlot; Console.WriteLine("---Make booking---"); Console.Write("Enter room name: "); string inputRoom = Console.ReadLine().ToUpper(); Console.Write("Enter date for slot(dd-MM-yyyy): "); string inputDate = Console.ReadLine(); Console.Write("Enter time for slot (HH:mm): "); string inputTime = Console.ReadLine(); Console.Write("Enter student ID: "); string inputStudentID = Console.ReadLine(); newSlot = ValidateEngine.ValidateBookSlot(inputRoom, inputDate, inputTime, inputStudentID); if (newSlot == null) { return; } else { var SlotList = new SlotManager(); SlotList.UpdateBooking(newSlot); Console.WriteLine("Booking created successfully.");; } }
//COMPLETE //A staff member cannot delete a slot once it has been booked by a student. - DONE //Remove a slot private static void RemoveSlot() { Slot slotResult; Console.WriteLine("---Remove Slot---"); Console.Write("Enter room name: "); string inputRoom = Console.ReadLine().ToUpper(); Console.Write("Enter date for slot(dd-MM-yyyy): "); string inputDate = Console.ReadLine(); Console.Write("Enter time for slot (HH:mm): "); string inputTime = Console.ReadLine(); slotResult = ValidateEngine.ValidateRemoveSlot(inputRoom, inputDate, inputTime); if (slotResult == null) { return; } else { Console.WriteLine("Slot removed successfully."); } }
//DONE //Delete/Cancel a booking (assign the slot booking field to null) for a specified slot private static void CancelBooking() { Slot newSlot; Console.WriteLine("---Cancel booking---"); Console.Write("Enter room name: "); string inputRoom = Console.ReadLine().ToUpper(); Console.Write("Enter date for slot(dd-MM-yyyy): "); string inputDate = Console.ReadLine(); Console.Write("Enter time for slot (HH:mm): "); string inputTime = Console.ReadLine(); newSlot = ValidateEngine.ValidateCancelBookSlot(inputRoom, inputDate, inputTime); if (newSlot == null) { return; } else { var SlotList = new SlotManager(); SlotList.UpdateBooking(newSlot); Console.WriteLine("Slot cancelled successfully.");; } }