示例#1
0
      /// <summary>
      /// Adds the notes item.
      /// </summary>
      private void AddNotesItem(){
        try {
          if (tbcMain.SelectedTab != tbNotes) {
            tbcMain.SelectedTab = tbNotes;
          }

          Notes noteItem          = new Notes();
          NotesItemForm frm       = new NotesItemForm(ref noteItem);
          frm.ShowDialog();

          if (noteItem.GUID != "") {
            _noteControl.Add(noteItem);
            PopulateNotes();
          }

        } catch (Exception ex) {
          Utilities.ShowErrorMessage("Error Adding Note!", ex);
        }
      }
示例#2
0
      /// <summary>
      /// Edits the notes item.
      /// </summary>
      private void EditNotesItem(){
        bool status                 = false;

        try {
          if (tbcMain.SelectedTab != tbNotes) {
            tbcMain.SelectedTab = tbNotes;
          }

          if (tvNotes.SelectedNode != null) {
            Notes noteItem          = (Notes)tvNotes.SelectedNode.Tag;
            NotesItemForm frm       = new NotesItemForm(ref noteItem);
            frm.ShowDialog();

            if (noteItem.GUID != null) {
              status                = _noteControl.Edit(noteItem);

              if (status) {
                PopulateNotes();

              } else {
                throw new Exception();
              }
            }

          } else {
            MessageBox.Show("Please select the note you wish to edit.", "EDIT",
                            MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
          }

        } catch (Exception ex) {
          Utilities.ShowErrorMessage("Error Editing TimeSheet Item.", ex);
        }
      }