コード例 #1
0
        private void SaveNote(int rowIndex)
        {
            object note = NotesGrid.Rows[rowIndex].Cells["NoteColumn"].Value;

            if (note == null || note.ToString().Trim() == string.Empty)
            {
                return;
            }

            DateTime noteDate = InsertDateOnNote(rowIndex);

            int noteId;

            if (NotesGrid.Rows[rowIndex].Cells["IDColumn"].Value == null)
            {
                noteId = 0;
            }
            else
            {
                bool isInt = int.TryParse(NotesGrid.Rows[rowIndex].Cells["IDColumn"].Value.ToString(), out noteId);
                if (!isInt)
                {
                    noteId = 0;
                }
            }

            DataMethods tmp       = new DataMethods();
            Note        savedNote = tmp.AddNote(noteId, ConversationID, noteDate, note.ToString());

            DisplayNoteInGrid(rowIndex, savedNote);
        }