本文整理汇总了C#中Tomboy.Note.ToDTONote方法的典型用法代码示例。如果您正苦于以下问题:C# Note.ToDTONote方法的具体用法?C# Note.ToDTONote怎么用?C# Note.ToDTONote使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tomboy.Note
的用法示例。
在下文中一共展示了Note.ToDTONote方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConvertBackAndForth
public void ConvertBackAndForth()
{
var tn1 = new Note () {
Title = "This is my Title with Umlauts: äöü",
Text = "This is my note body text.",
CreateDate = DateTime.Now - new TimeSpan (365, 0, 0, 0),
MetadataChangeDate = DateTime.Now,
ChangeDate = DateTime.Now - new TimeSpan (14, 0, 0, 0)
// TODO check why OpenOnStartup is of type string in Tomboy
//OpenOnStartup = "true"
};
var dto_note = tn1.ToDTONote ();
var tn2 = dto_note.ToTomboyNote ();
// notes should be identical
Assert.AreEqual (tn1.Guid, tn2.Guid);
Assert.AreEqual (tn1.Uri, tn2.Uri);
Assert.AreEqual (tn1.Title, tn2.Title);
Assert.AreEqual (tn1.Text, tn2.Text);
Assert.AreEqual (tn1.ChangeDate, tn2.ChangeDate);
Assert.AreEqual (tn1.MetadataChangeDate, tn2.MetadataChangeDate);
Assert.AreEqual (tn1.CreateDate, tn2.CreateDate);
Assert.AreEqual (tn1.OpenOnStartup, tn2.OpenOnStartup);
Assert.AreEqual (tn1.Tags.Keys, tn2.Tags.Keys);
}
示例2: SaveNote
public override void SaveNote(Note note)
{
var db_note = note.ToDTONote ().ToDBNote (Username);
db_note.EncryptedKey = GetEncryptedNoteKey (db_note);
EncryptNoteBody (db_note);
base.SaveDBNote (db_note);
}
示例3: SaveNote
public void SaveNote(Note note)
{
var dbNote = note.ToDTONote ().ToDBNote (User);
// unforunately, we can't know if that note already exist
// so we delete any previous incarnations of that note and
// re-insert
db.Delete<DBNote> (n => n.CompoundPrimaryKey == dbNote.CompoundPrimaryKey);
db.Insert (dbNote);
}
示例4: SaveNote
public void SaveNote(Note note)
{
var dbNote = note.ToDTONote ().ToDBNote ();
dbNote.Username = Username;
// unforunately, we can't know if that note already exist
// so we delete any previous incarnations of that note and
// re-insert
db.Delete<DBNote> (n => n.Username == Username && n.Guid == dbNote.Guid);
db.Insert (dbNote);
}
示例5: DeleteNote
public void DeleteNote(Note note)
{
var dbNote = note.ToDTONote ().ToDBNote (User);
if (UseHistory) {
var archived_note = new DBArchivedNote ().PopulateWith(dbNote);
if (Manifest.NoteRevisions.ContainsKey (note.Guid)) {
archived_note.LastSyncRevision = Manifest.NoteRevisions[note.Guid];
}
var stored_note = db.FirstOrDefault<DBArchivedNote> (n => n.CompoundPrimaryKey == archived_note.CompoundPrimaryKey);
// if that revision already exists, do not store
if (stored_note == null)
db.Insert<DBArchivedNote> (archived_note);
}
db.Delete<DBNote> (n => n.CompoundPrimaryKey == dbNote.CompoundPrimaryKey);
}
示例6: DeleteNote
public void DeleteNote(Note note)
{
var dbNote = note.ToDTONote ().ToDBNote (User);
db.Delete<DBNote> (n => n.CompoundPrimaryKey == dbNote.CompoundPrimaryKey);
}
示例7: ConvertFromTomboyNoteToDTO
public void ConvertFromTomboyNoteToDTO()
{
var tomboy_note = new Note ();
tomboy_note.Title = "This is a sample note";
tomboy_note.Text = "This is some sample text";
tomboy_note.ChangeDate = DateTime.Now;
tomboy_note.CreateDate = DateTime.Now;
tomboy_note.MetadataChangeDate = DateTime.Now;
var dto_note = tomboy_note.ToDTONote ();
Assert.AreEqual (tomboy_note.Title, dto_note.Title);
Assert.AreEqual (tomboy_note.Text, dto_note.Text);
Assert.AreEqual (tomboy_note.ChangeDate, DateTime.Parse (dto_note.ChangeDate).ToUniversalTime ());
Assert.AreEqual (tomboy_note.CreateDate, DateTime.Parse (dto_note.CreateDate).ToUniversalTime ());
Assert.AreEqual (tomboy_note.MetadataChangeDate, DateTime.Parse (dto_note.MetadataChangeDate).ToUniversalTime ());
Assert.AreEqual (tomboy_note.Guid, dto_note.Guid);
var tag_intersection = dto_note.Tags.Intersect (tomboy_note.Tags.Keys);
Assert.AreEqual (dto_note.Tags.Count (), tag_intersection.Count ());
}
示例8: ConvertUriTests
public void ConvertUriTests()
{
var tomboy_note = new Note ();
tomboy_note.CreateDate = DateTime.Now;
tomboy_note.ChangeDate = DateTime.Now;
tomboy_note.MetadataChangeDate = DateTime.Now;
var dto_note = tomboy_note.ToDTONote ();
Assert.That (!string.IsNullOrEmpty (dto_note.Guid));
Assert.AreEqual (tomboy_note.Guid, dto_note.Guid);
Assert.That (tomboy_note.Uri.Contains (dto_note.Guid));
Assert.That (tomboy_note.Uri.Contains (tomboy_note.Guid));
var tomboy_note_2 = dto_note.ToTomboyNote ();
Assert.AreEqual (tomboy_note.Guid, tomboy_note_2.Guid);
Assert.AreEqual (tomboy_note.Uri, tomboy_note_2.Uri);
}
示例9: ConvertToDTOWithTags
public void ConvertToDTOWithTags()
{
var tomboy_note = new Note ();
tomboy_note.Tags.Add ("school", new Tag ("school"));
tomboy_note.Tags.Add ("shopping", new Tag ("shopping"));
tomboy_note.Tags.Add ("fun", new Tag ("fun"));
var dto_note = tomboy_note.ToDTONote ();
foreach (string tag in tomboy_note.Tags.Keys) {
Assert.Contains (tag, dto_note.Tags);
}
}
示例10: SaveNote
public virtual void SaveNote(Note note)
{
var db_note = note.ToDTONote ().ToDBNote (this.Username);
SaveDBNote (db_note);
}