Ejemplo n.º 1
0
        public static Boolean IsAvailable(String username, int Day, int Month, int Year)
        {
            Person person = Person.FetchByUsername(username);

            if (person == null)
            {
                return(false); //this shouldn't happen
            }
            Availability availability = Availability.FetchByPersonAndDate(person.Id, Month, Year, Day);

            if (availability == null)
            {
                return(false);
            }
            return(availability.Isavailable);
        }
Ejemplo n.º 2
0
        public static void MarkUnavailable(String username, int Day, int Month, int Year)
        {
            Person person = Person.FetchByUsername(username);

            if (person == null)
            {
                return; //this shouldn't happen
            }
            Availability availability = Availability.FetchByPersonAndDate(person.Id, Month, Year, Day);

            if (availability == null)
            {
                Availability.Insert(person.Id, Month, Year, Day, false);
            }
            else
            {
                availability.Isavailable = false;
                availability.Save();
            }
        }