private void BtContactNoteSaveClick(object sender, EventArgs e) { Person personToEdit; if (cbContactNoteRelative.SelectedItem != null) personToEdit = ((Relative) cbContactNoteRelative.SelectedItem); else { personToEdit = ((Person) cbContactNoteContact.SelectedItem); } Note noteToAdd; if (btContactNoteSave.Text == "Save") { noteToAdd = new Note(); } else { noteToAdd = (Note) cbContactNoteNote.SelectedItem; personToEdit.Notes.Remove(noteToAdd); } noteToAdd.Subject = tbContactNoteSubject.Text; noteToAdd.NoteText = rtbContactNoteBody.Text; personToEdit.Notes.Add(noteToAdd); cbContactNoteContact.UpdateInfo(); cbContactNoteNote.UpdateInfo(); tbContactNoteSubject.Text = string.Empty; rtbContactNoteBody.Text = string.Empty; FileManager.SaveContacts(); }
public Appointment() { Location = new Address(); Notes = new Note(); }
private void SaveCompanyNoteClick(object sender, EventArgs e) { Note noteToAdd; if (btSaveCompanyNote.Text == "Save") { noteToAdd = new Note(); } else { noteToAdd = (Note) cbNoteCompanyNote.SelectedItem; ((Customer) cbNoteSelectCompany.SelectedItem).Notes.Remove(noteToAdd); } noteToAdd.Subject = tbNoteCompanySubject.Text; noteToAdd.NoteText = rtxNoteCompanyBody.Text; ((Customer) cbNoteSelectCompany.SelectedItem).Notes.Add(noteToAdd); cbNoteSelectCompany.UpdateInfo(); Controller.SaveCustomers(); Controller.AddNote(noteToAdd); Controller.SaveNotes(); }
public static void AddNote(Note noteToAdd) { _allNotesEver.Add(noteToAdd); SaveNotes(); }