protected override void SaveForm() { try { if (CurrentUserProfileId > 0) { hccUserProfileNote note = null; if (this.PrimaryKeyIndex > 0) { note = hccUserProfileNote.GetById(this.PrimaryKeyIndex); } if (note == null) { note = new hccUserProfileNote { DateCreated = DateTime.Now, UserProfileID = CurrentUserProfileId, NoteTypeID = (int)CurrentNoteType } } ; if (AllowDisplayToUser) { note.DisplayToUser = chkNoteDisplayToUser.Checked; } else { note.DisplayToUser = false; } note.Note = txtNote.Text.Trim(); note.Save(); this.PrimaryKeyIndex = note.NoteID; Clear(); BindgvwNotes(); LoadAddEdit(); LoadUserDisplay(); OnSaved(new ControlSavedEventArgs(this.PrimaryKeyIndex)); } } catch (Exception) { throw; } }
void gvwNotes_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { int noteId = int.Parse(gvwNotes.DataKeys[e.RowIndex].Value.ToString()); hccUserProfileNote delNote = hccUserProfileNote.GetById(noteId); if (delNote != null) { delNote.Delete(); } Clear(); BindgvwNotes(); } catch (Exception ex) { throw ex; } }
void gvwNotes_SelectedIndexChanged(object sender, EventArgs e) { try { int noteId = int.Parse(gvwNotes.DataKeys[gvwNotes.SelectedIndex].Value.ToString()); if (noteId > 0) { this.PrimaryKeyIndex = noteId; hccUserProfileNote note = hccUserProfileNote.GetById(this.PrimaryKeyIndex); txtNote.Text = note.Note; if (AllowDisplayToUser) { chkNoteDisplayToUser.Checked = note.DisplayToUser; } } } catch (Exception ex) { throw ex; } }