Beispiel #1
0
        public static void PermanentlyDeleteUser(ProMaUser toDelete)
        {
            using (ProMaDB scope = new ProMaDB())
            {
                foreach (PostedNote currentNote in PostedNoteHandler.GetNotes
                             (shownToUser: toDelete.UserId, includeInactive: true, onlyInactive: false, includeComplete: true, onlyThisNoteId: -1, includeHibernatedNotes: true))
                {
                    PostedNoteHandler.PermanentlyDeleteNote(currentNote);
                }

                foreach (NoteType currentNoteType in NoteTypeHandler.GetNoteTypesForUser(toDelete.UserId))
                {
                    NoteTypeHandler.DeleteNoteType(currentNoteType);
                }

                foreach (SharedChoreMembership currentSharedChoreMembership in SharedChoreMembershipHandler.GetSharedChoreMembershipsForUser(toDelete.UserId))
                {
                    SharedChoreHandler.PermanentlyDeleteSharedChore(currentSharedChoreMembership.SharedChoreId);
                }

                foreach (CalendarEntry currentCalendarEntry in CalendarHandler.GetAllCalendarEntriesForUser(toDelete.UserId))
                {
                    CalendarHandler.DeleteCalendar(currentCalendarEntry.CalendarId);
                }

                scope.ProMaUsers.Remove(toDelete);
                scope.SaveChanges();

                ThisCache.Remove(toDelete);
            }
        }
Beispiel #2
0
        public static List <CompletedChore> GetChoreItemsForDateAndUser(int userId, DateTime day)
        {
            // first, get a list of all tasks this user is a part of
            List <SharedChoreMembership> taskMemberships = SharedChoreMembershipHandler.GetSharedChoreMembershipsForUser(userId).OrderBy(x => x.PersonalSortingOrder).ThenBy(x => x.SharedChoreId).ToList();

            // now, get the items that are for this chore item, on this day
            List <CompletedChore> existingChoreItems = GetChoreItems(taskMemberships.Select(x => x.SharedChoreId).ToList(), day);

            return(existingChoreItems);
        }