本文整理汇总了C#中Note.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Note.Save方法的具体用法?C# Note.Save怎么用?C# Note.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Note
的用法示例。
在下文中一共展示了Note.Save方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NoteInsert
public static Note NoteInsert(Note note)
{
note = note.Save();
SourceRepository.SourceAdd(note.NoteId, SourceType.Note, note.Body);
FeedRepository.FeedAdd(FeedAction.Created, note);
return note;
}
示例2: HomeModule
public HomeModule()
{
Get["/"] = _ => View["index"];
Post["api/newcall"] = _ =>
{
try
{
var posts = this.Bind<NewCallObject>();
var rnd = new Random();
var sc = new SupportCall
{
RecordID = Guid.NewGuid(),
AssignedTo = Guid.Parse(posts.assignTo),
Customer = Guid.Parse(posts.contact),
CreatedBy = Guid.Parse(posts.createdBy),
CustomerReference = posts.customerRef,
CustomerSite = Guid.Parse(posts.location),
Product = Convert.ToInt32(posts.product),
InternalReference = "MHA" + rnd.Next(1736, 9999),
Status = 0,
CreatedDateTime = DateTime.Now,
UpdatedDateTime = DateTime.Now
};
var Initialnote = new Note
{
CallRecordID = sc.RecordID,
RecordID = Guid.NewGuid(),
CreatedBy = sc.CreatedBy,
NoteType = 6,
NoteSubType = Convert.ToInt32(posts.prc),
NoteText = posts.issueDescription,
TimeSpent = 0,
CreatedDateTime = DateTime.Now,
UpdatedDateTime = DateTime.Now
};
var note = new Note
{
CallRecordID = sc.RecordID,
RecordID = Guid.NewGuid(),
CreatedBy = sc.CreatedBy,
NoteType = 0,
NoteSubType = Convert.ToInt32(posts.prc),
NoteText = posts.prcDescription,
TimeSpent = 0,
CreatedDateTime = DateTime.Now,
UpdatedDateTime = DateTime.Now
};
if (sc.Save())
{
if (Initialnote.Save())
{
return note.Save() ? HttpStatusCode.OK : HttpStatusCode.BadRequest;
}
return HttpStatusCode.BadRequest;
}
return HttpStatusCode.BadRequest;
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
return HttpStatusCode.BadRequest;
}
};
Get["api/supportCalls"] = _ =>
{
var calls = SupportCall.ToList();
return Response.AsJson(calls);
};
Get["api/loadNotes/{id}"] = _ =>
{
var id = Guid.Parse(_.id);
List<NoteDTO> notes = Note.LoadFromCall(id);
return Response.AsJson(notes);
};
Get["api/export"] = _ =>
{
return Export.ExportToCSV();
};
Post["api/addNote"] = _ =>
{
var posts = this.Bind<NewNoteObject>();
var note = new Note
{
CreatedBy = Guid.Parse(posts.CreatedBy),
CallRecordID = Guid.Parse(posts.CallRecordID),
CreatedDateTime = DateTime.Now,
//.........这里部分代码省略.........
示例3: RenameNote
// TODO: This appears to add <link:internal> around the note title
// in the content.
private void RenameNote (Note note, string newTitle, bool updateReferencingNotes)
{
string oldTitle = note.Title;
// Rename the note (skip for now...never using updateReferencingNotes option)
//if (updateReferencingNotes) // NOTE: This might never work, or lead to a ton of conflicts
// note.Title = newTitle;
//else
// note.RenameWithoutLinkUpdate (newTitle);
//string oldContent = note.XmlContent;
//note.XmlContent = NoteArchiver.Instance.GetRenamedNoteXml (oldContent, oldTitle, newTitle);
// Preserve note information
note.Save (); // Write to file
bool noteOpen = note.IsOpened;
string newContent = //note.XmlContent;
NoteArchiver.Instance.GetRenamedNoteXml (note.XmlContent, oldTitle, newTitle);
string newCompleteContent = //note.GetCompleteNoteXml ();
NoteArchiver.Instance.GetRenamedNoteXml (note.GetCompleteNoteXml (), oldTitle, newTitle);
//Logger.Debug ("RenameNote: newContent: " + newContent);
//Logger.Debug ("RenameNote: newCompleteContent: " + newCompleteContent);
// We delete and recreate the note to simplify content conflict handling
Tomboy.DefaultNoteManager.Delete (note);
// Create note with old XmlContent just in case GetCompleteNoteXml failed
Logger.Debug ("RenameNote: about to create " + newTitle);
Note renamedNote = Tomboy.DefaultNoteManager.Create (newTitle, newContent);
if (newCompleteContent != null) {// TODO: Anything to do if it is null?
try {
renamedNote.LoadForeignNoteXml (newCompleteContent, ChangeType.OtherDataChanged);
} catch {} // TODO: Handle exception in case that newCompleteContent is invalid XML
}
if (noteOpen)
renamedNote.Window.Present ();
}
示例4: NoteTaker5Page
public NoteTaker5Page()
{
// Create Entry and Editor views.
Entry entry = new Entry
{
Placeholder = "Title (optional)"
};
Editor editor = new Editor
{
Keyboard = Keyboard.Create(KeyboardFlags.All),
BackgroundColor = Device.OnPlatform(Color.Default,
Color.Default,
Color.White),
VerticalOptions = LayoutOptions.FillAndExpand
};
// Set data bindings.
Note note = new Note();
this.BindingContext = note;
entry.SetBinding(Entry.TextProperty, "Title");
editor.SetBinding(Editor.TextProperty, "Text");
// Create Save and Load buttons.
Button saveButton = new Button
{
Text = "Save",
HorizontalOptions = LayoutOptions.CenterAndExpand
};
Button loadButton = new Button
{
Text = "Load",
IsEnabled = false,
HorizontalOptions = LayoutOptions.CenterAndExpand
};
// Set Clicked handlers.
saveButton.Clicked += (sender, args) =>
{
note.Save(FILENAME);
loadButton.IsEnabled = true;
};
loadButton.Clicked += (sender, args) => note.Load(FILENAME);
// Check if the file is available.
FileHelper.Exists(FILENAME, (exists) =>
{
loadButton.IsEnabled = exists;
});
// Assemble page.
this.Padding =
new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 0);
this.Content = new StackLayout
{
Children =
{
new Label
{
Text = "Title:"
},
entry,
new Label
{
Text = "Note:"
},
editor,
new StackLayout
{
Orientation = StackOrientation.Horizontal,
Children =
{
saveButton,
loadButton
}
}
}
};
}
示例5: NoteUpdate
public static Note NoteUpdate(Note note)
{
if (!note.IsDirty)
{
return note;
}
note = note.Save();
SourceRepository.SourceUpdate(note.NoteId, SourceType.Note, note.Body);
FeedRepository.FeedAdd(FeedAction.Edited, note);
return note;
}