public static bool CheckAvalability(DateTime currentDate, Database db, string DOB, List <Kid> kids, List <Booking> bookings) { string group = getgroupfromage(DOB); BookingDB bookDB = new BookingDB(db); int groupID = bookDB.getgroupID(group); int bookingscount = bookDB.GetBookingSlot(currentDate, groupID); int counter = 0; foreach (Kid kid in kids) { if (kids.Count - 1 == counter) { break; } group = getgroupfromage(DOB); int newgroupID = bookDB.getgroupID(group); if (newgroupID == groupID) { List <DateTime> mondays = bookings[counter].Mondays; if (mondays.Contains(currentDate)) { bookingscount++; } } counter++; } bool overbooked = false; GroupDB gdb = new GroupDB(db); if (groupID == 1) { if (bookingscount > gdb.getANum()) { overbooked = true; } } else if (groupID == 2) { if (bookingscount > gdb.getBNum()) { overbooked = true; } } else if (groupID == 3) { if (bookingscount > gdb.getCNum()) { overbooked = true; } } return(overbooked); }
public static bool checkStaffAvaliability(Database db, string DOB) { string group = getgroupfromage(DOB); BookingDB bookDB = new BookingDB(db); int groupID = bookDB.getgroupID(group); StaffDB staffdb = new StaffDB(db); int staffNum = staffdb.countStaffbyid(groupID); if (staffNum < 2) { return(true); } else { return(false); } }