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 SubmitCaptureButton_Click(object sender, EventArgs e)
        {
            int     paymentId = AlwaysConvert.ToInt(HiddenPaymentId.Value);
            Payment payment   = PaymentDataSource.Load(paymentId);

            if (payment != null)
            {
                //GET THE CAPTURE AMOUNT
                decimal captureAmount = AlwaysConvert.ToDecimal(CaptureAmount.Text);
                bool    finalCapture  = NoAdditionalCapture.Checked;
                if (captureAmount > 0)
                {
                    payment.Capture(captureAmount, finalCapture, false);
                    if (!string.IsNullOrEmpty(CustomerNote.Text))
                    {
                        OrderNote note = new OrderNote(payment.Order.Id, AbleContext.Current.UserId, DateTime.UtcNow, CustomerNote.Text, NoteType.Public);
                        note.Save();
                    }
                }

                // UPDATE THE GRID
                CapturePopup.Hide();
                PaymentGrid.DataBind();
                SearchResultAjax.Update();
            }
        }
 protected void CaptureAllButton_Click(object sender, EventArgs e)
 {
     foreach (GridViewRow row in PaymentGrid.Rows)
     {
         CheckBox checkbox = (CheckBox)row.FindControl("SelectPaymentCheckBox");
         if ((checkbox != null) && (checkbox.Checked))
         {
             int     paymentId = Convert.ToInt32(PaymentGrid.DataKeys[row.RowIndex].Value);
             Payment payment   = PaymentDataSource.Load(paymentId);
             if (payment != null)
             {
                 if (payment.Amount > 0)
                 {
                     payment.Capture(payment.Amount, true, false);
                 }
             }
         }
     }
     PaymentGrid.DataBind();
     SearchResultAjax.Update();
 }
 protected void SearchButton_Click(object sender, EventArgs e)
 {
     OrderNotesGrid.DataBind();
     SearchResultAjax.Update();
 }
Exemplo n.º 6
0
 protected void SearchButton_Click(object sender, EventArgs e)
 {
     ResetSearchButton.Visible = true;
     OrderGrid.DataBind();
     SearchResultAjax.Update();
 }