コード例 #1
0
        public static void DeleteNoteType(NoteType toDelete)
        {
            using (ProMaDB scope = new ProMaDB())
            {
                foreach (PostedNote curNote in PostedNoteHandler.GetAllNotesOfType(toDelete.NoteTypeId))
                {
                    PostedNote updateThis = PostedNoteHandler.GetNote(curNote.NoteId);
                    updateThis.NoteTypeId = null;
                    updateThis.Active     = false;
                    PostedNoteHandler.UpdatePostedNote(updateThis);
                }

                foreach (NoteTypeMembership membership in NoteTypeMembershipHandler.GetMembershipsForType(toDelete.NoteTypeId))
                {
                    NoteTypeMembershipHandler.RemoveNoteTypeMembership(membership);
                }

                scope.NoteTypes.Attach(toDelete);
                scope.NoteTypes.Remove(toDelete);

                scope.SaveChanges();

                ThisCache.Remove(toDelete);
            }
        }
コード例 #2
0
 public static void PermanentlyDeleteNote(PostedNote toDelete)
 {
     using (ProMaDB scope = new ProMaDB())
     {
         scope.PostedNotes.Remove(toDelete);
         scope.SaveChanges();
     }
 }
コード例 #3
0
 public static void UpdatePostedNote(PostedNote toUpdate)
 {
     using (ProMaDB scope = new ProMaDB())
     {
         scope.PostedNotes.Attach(toUpdate);
         scope.Entry(toUpdate).State = EntityState.Modified;
         scope.SaveChanges();
     }
 }
コード例 #4
0
 public static void AddPostedNote(PostedNote toAdd)
 {
     using (ProMaDB scope = new ProMaDB())
     {
         scope.PostedNotes.Add(toAdd);
         scope.Entry(toAdd).State = EntityState.Added;
         scope.SaveChanges();
     }
 }
コード例 #5
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));
        }
コード例 #6
0
            public PostedNotePayload(PostedNote toMake, List <NoteType> hydratedNoteTypes)
            {
                Data = toMake;

                PostedUser = new PostedNoteProMaUserPayload(ProMaUserHandler.GetUser(toMake.UserId));

                if (toMake.CompletedUserId.HasValue)
                {
                    CompletedUser = new PostedNoteProMaUserPayload(ProMaUserHandler.GetUser(toMake.CompletedUserId.Value));
                }

                if (toMake.EditedUserId.HasValue)
                {
                    EditedUser = new PostedNoteProMaUserPayload(ProMaUserHandler.GetUser(toMake.EditedUserId.Value));
                }

                TypeOfNote = hydratedNoteTypes.FirstOrDefault(x => x.NoteTypeId == toMake.NoteTypeId);
            }