public NotesGrid()
 {
     _mode  = NotesGridMode.GridView;
     _notes = new List <notes>();
     InitializeComponent();
     bsNotes.DataSource = _notes;
 }
 private void lblEditNote_Click(object sender, EventArgs e)
 {
     if (dgvNotes.SelectedRows.Count == 1)
     {
         editNote     = GetNoteFromGrid(dgvNotes.SelectedRows[0].Index);
         rtbNote.Text = editNote.Note;
         Mode         = NotesGridMode.Editor;
         rtbNote.Focus();
     }
 }
        private void lblAddNote_Click(object sender, EventArgs e)
        {
            editNote     = new notes();
            rtbNote.Text = "";
            Mode         = NotesGridMode.Editor;
            rtbNote.Focus();

            if (NewNotes != null)
            {
                NewNotes(this, new EventArgs());
            }
        }
        public void SaveNote()
        {
            if ((editNote != null) && (rtbNote.Text != ""))
            {
                bool isNew = (!editNote.created_on.HasValue);
                editNote.Note = rtbNote.Text.Trim();
                if ((editNote.CallId == 0) && (CurrentCall != null))
                {
                    editNote.CallId = CurrentCall.id;
                }
                else
                {
                    editNote.CallId = 0;
                }

                if ((editNote.claim_id == 0) && (CurrentClaim != null))
                {
                    editNote.claim_id = CurrentClaim.id;
                }
                else
                {
                    editNote.claim_id = 0;
                }

                editNote.operatorId = ActiveUser.UserObject.username;
                if (!editNote.created_on.HasValue)
                {
                    editNote.created_on = DateTime.Now;
                }
                editNote.updated_on = DateTime.Now;

                ActiveUser.LogAction(ActiveUser.ActionTypes.CreateNote, editNote.claim_id, editNote.CallId, "");
                editNote.Save();

                if (isNew)
                {
                    editNote.Note += CreateNoteAdditionalText(editNote);
                    Notes.Insert(0, editNote);
                }

                editNote     = null;
                rtbNote.Text = "";
                Mode         = NotesGridMode.GridView;
                bsNotes.ResetBindings(false);
            }
            else
            {
                CancelNote();
            }
        }
 private void CancelNote()
 {
     editNote     = null;
     rtbNote.Text = "";
     Mode         = NotesGridMode.GridView;
 }