Exemplo n.º 1
0
        public void updategroup(string Forename, string Surname)
        {
            BookingDB bdb = new BookingDB(db);
            int       id  = bdb.getchildID(Forename, Surname);

            db.Cmd             = db.Conn.CreateCommand();
            db.Cmd.CommandText = $"UPDATE Booking SET GroupID = GroupID+1 WHERE ChildId = {id}";
            db.Cmd.ExecuteNonQuery();
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
            }
        }