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); }
public T Previous() { if (count == 0) { return(default(T)); } else { Note = Note.PreNote; return(Note.CurrentNote); } }
public T Next() { if (count == 0) { return(default(T)); } else { Note = Note.NextNote; return(Note.CurrentNote); } }
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); }
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); }
public CircleLink() { Note = new LinkNote <T>(); }