Exemplo n.º 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);
            }
        }
Exemplo n.º 2
0
        public static PostedNote.PostedNotePayload GetPayloadNote(PostedNote raw, int?relevantUserId)
        {
            List <PostedNote.PostedNotePayload> returnThis = new List <PostedNote.PostedNotePayload>();

            List <NoteType> noteTypes = new List <NoteType>();

            if (relevantUserId.HasValue)
            {
                noteTypes = NoteTypeHandler.GetNoteTypesForUser(relevantUserId.Value);
            }

            return(new PostedNote.PostedNotePayload(raw, noteTypes));
        }
Exemplo n.º 3
0
        public static List <PostedNote.PostedNotePayload> GetPayloadNotes(List <PostedNote> raw, int?relevantUserId)
        {
            List <PostedNote.PostedNotePayload> returnThis = new List <PostedNote.PostedNotePayload>();

            List <NoteType> noteTypes = new List <NoteType>();

            if (relevantUserId.HasValue)
            {
                noteTypes = NoteTypeHandler.GetNoteTypesForUser(relevantUserId.Value);
            }

            foreach (PostedNote curNote in raw)
            {
                returnThis.Add(new PostedNote.PostedNotePayload(curNote, noteTypes));
            }

            return(returnThis);
        }