protected void btnAddNote_Click(object sender, EventArgs e) { var note = new PhotoNote(); if (txtNoteText.Text.Trim().Length > 0) note.Notes = txtNoteText.Text; if (ddNoteFriend.SelectedIndex > 0) { note.Username = ddNoteFriend.SelectedValue; } int noteX, noteY, noteW, noteH, notePhotoId; if (int.TryParse(hidNoteX.Value, out noteX) && int.TryParse(hidNoteY.Value, out noteY) && int.TryParse(hidNoteW.Value, out noteW) && int.TryParse(hidNoteH.Value, out noteH) && int.TryParse(hidNotePhotoId.Value, out notePhotoId) && !(note.Notes == null && note.Username == null)) { note.X = noteX; note.Y = noteY; note.Width = noteW; note.Height = noteH; note.PhotoId = notePhotoId; txtNoteText.Text = String.Empty; ddNoteFriend.SelectedIndex = 0; } else { return; } note.Timestamp = DateTime.Now; note.Save(); if (note.Username != null) AddTaggedOnPhotoEvent(note.Username, note.Id, note.PhotoId); loadPhotoNotes(notePhotoId); }