protected void MarkAsReadButton_Click(object sender, EventArgs e) { foreach (GridViewRow row in OrderNotesGrid.Rows) { CheckBox checkbox = (CheckBox)row.FindControl("SelectNoteCheckBox"); if ((checkbox != null) && (checkbox.Checked)) { int orderNoteId = Convert.ToInt32(OrderNotesGrid.DataKeys[row.RowIndex].Value); OrderNote note = OrderNoteDataSource.Load(orderNoteId); Order order = note.Order; if (order != null) { int index = order.Notes.IndexOf(orderNoteId); if (index >= 0) { order.Notes[index].IsRead = true; } order.Save(false, false); } } } OrderNotesGrid.DataBind(); SearchResultAjax.Update(); }
protected void EditButton_Click(object sender, EventArgs e) { int orderNoteId = AlwaysConvert.ToInt(EditId.Value); OrderNote n = OrderNoteDataSource.Load(orderNoteId); if (n != null && !string.IsNullOrEmpty(EditComment.Text)) { n.Comment = EditComment.Text; n.NoteType = EditIsPrivate.Checked ? NoteType.Private : NoteType.Public; n.IsRead = EditIsRead.Checked; n.Save(); BindOrderNotes(); } }
protected void OrderNotesGrid_RowCommand(object sender, GridViewCommandEventArgs e) { int orderNoteId = AlwaysConvert.ToInt(e.CommandArgument); if (e.CommandName == "EditNote") { OrderNote n = OrderNoteDataSource.Load(orderNoteId); EditComment.Text = n.Comment; EditIsPrivate.Checked = n.IsPrivate; EditIsRead.Checked = n.IsRead; EditId.Value = orderNoteId.ToString(); EditPopup.Show(); } else if (e.CommandName == "DeleteNote") { int index = _Order.Notes.IndexOf(orderNoteId); if (index > -1) { _Order.Notes.DeleteAt(index); } BindOrderNotes(); } }