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 SaveButton_Click(object sender, EventArgs e)
        {
            int   orderId = AlwaysConvert.ToInt(HiddenOrderId.Value);
            Order order   = OrderDataSource.Load(orderId);

            if (MarkReadOnReply.Checked)
            {
                foreach (OrderNote note in order.Notes)
                {
                    note.IsRead = true;
                }
            }

            AbleContext.Current.Database.BeginTransaction();
            OrderNote newNote = new OrderNote(orderId, AbleContext.Current.UserId, LocaleHelper.LocalNow, NoteText.Text, (PrivateNote.Checked ? NoteType.Private : NoteType.Public));

            order.Notes.Add(newNote);
            order.Save(false, false);
            AbleContext.Current.Database.CommitTransaction();

            NoteText.Text = String.Empty;
            AddPopup.Hide();

            OrderNotesGrid.DataBind();
            SearchResultAjax.Update();
        }
        protected void BindOrderNotes()
        {
            IList <OrderNote> notes = _Order.Notes;

            notes.Sort(new PropertyComparer("CreatedDate", CommerceBuilder.Common.SortDirection.DESC));
            OrderNotesGrid.DataSource = notes;
            OrderNotesGrid.DataBind();
        }
 protected void Page_PreRender(object sender, EventArgs e)
 {
     if (this.Order != null)
     {
         StoreSettingsManager settings = AbleContext.Current.Store.Settings;
         AddNoteForm.Visible = settings.EnableCustomerOrderNotes;
         IList <OrderNote> publicNotes = this.Order.Notes.Where(NoteType => !NoteType.IsPrivate).ToList();
         OrderNotesGrid.DataSource = publicNotes;
         OrderNotesGrid.DataBind();
         OrderNotesPanel.Visible = settings.EnableCustomerOrderNotes || publicNotes.Count > 0;
     }
     else
     {
         OrderNotesPanel.Visible = false;
     }
 }
 protected void SearchButton_Click(object sender, EventArgs e)
 {
     OrderNotesGrid.DataBind();
     SearchResultAjax.Update();
 }