Exemple #1
0
        public int SaveNote(Note note, LinkNote linkNote)
        {
            this.Context.Notes.InsertOnSubmit(note);
            this.Context.SubmitChanges();
            linkNote.NoteId = note.Id;
            this.Context.LinkNotes.InsertOnSubmit(linkNote);
            this.Context.SubmitChanges();

            return(note.Id);
        }
Exemple #2
0
 public T Previous()
 {
     if (count == 0)
     {
         return(default(T));
     }
     else
     {
         Note = Note.PreNote;
         return(Note.CurrentNote);
     }
 }
Exemple #3
0
 public T Next()
 {
     if (count == 0)
     {
         return(default(T));
     }
     else
     {
         Note = Note.NextNote;
         return(Note.CurrentNote);
     }
 }
Exemple #4
0
 public int Delete()
 {
     if (count == 0)
     {
         throw new Exception("链表为空,无法删除");
     }
     if (count == 1)
     {
         Note = new LinkNote <T>();
     }
     else
     {
         Note.PreNote.NextNote = Note.NextNote;
         Note.NextNote.PreNote = Note.PreNote;
         Note = Note.NextNote;
     }
     count = count - 1;
     return(count);
 }
Exemple #5
0
        public int Add(T NewNote)
        {
            LinkNote <T> CurrenteNote = new LinkNote <T>();

            CurrenteNote.CurrentNote = NewNote;
            if (Note.CurrentNote == null || count == 0)
            {
                CurrenteNote.NextNote = CurrenteNote;
                CurrenteNote.PreNote  = CurrenteNote;
                Note = CurrenteNote;
            }
            else
            {
                Note.NextNote.PreNote = CurrenteNote;
                CurrenteNote.NextNote = Note.NextNote;
                Note.NextNote         = CurrenteNote;
                CurrenteNote.PreNote  = Note;
            }
            count = count + 1;
            return(count);
        }
Exemple #6
0
 public CircleLink()
 {
     Note = new LinkNote <T>();
 }