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 Page_Load(object sender, EventArgs e) { if (this.Order != null && this.Order.Payments.Count > 0) { //BIND PAYMENTS PaymentGrid.DataSource = this.Order.Payments; PaymentGrid.DataBind(); } else { PaymentPanel.Visible = false; } }
protected void Page_Init(object sender, EventArgs e) { int orderId = PageHelper.GetOrderId(); Order order = OrderDataSource.Load(orderId); if (order != null && order.Payments.Count > 0) { //BIND PAYMENTS PaymentGrid.DataSource = order.Payments; PaymentGrid.DataBind(); } else { PaymentPanel.Visible = false; } }
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) { PaymentGrid.DataBind(); SearchResultAjax.Update(); }