protected void SelectedPaymentMethod_SelectedIndexChanged(object sender, EventArgs e) { PaymentMethod method = GetSelectedMethod(); if (method != null) { selPaymentStatus.Items.Clear(); if (method.IsCreditOrDebitCard()) { foreach (PaymentStatus s in Enum.GetValues(typeof(PaymentStatus))) { ListItem item = new ListItem(StringHelper.SpaceName(s.ToString()), ((int)s).ToString()); selPaymentStatus.Items.Add(item); } } else { ListItem item = new ListItem(StringHelper.SpaceName(PaymentStatus.Unprocessed.ToString()), ((int)PaymentStatus.Unprocessed).ToString()); selPaymentStatus.Items.Add(item); item = new ListItem(StringHelper.SpaceName(PaymentStatus.Completed.ToString()), ((int)PaymentStatus.Completed).ToString()); selPaymentStatus.Items.Add(item); } } }
protected void Page_Load(object sender, EventArgs e) { _PaymentId = AlwaysConvert.ToInt(Request.QueryString["PaymentId"]); _Payment = PaymentDataSource.Load(_PaymentId); if (_Payment == null) { Response.Redirect("../Default.aspx"); } if (!Page.IsPostBack) { PaymentMethod paymentMethod = _Payment.PaymentMethod; if ((paymentMethod != null) && (paymentMethod.IsCreditOrDebitCard() || paymentMethod.PaymentInstrumentType == PaymentInstrumentType.PayPal)) { foreach (PaymentStatus s in Enum.GetValues(typeof(PaymentStatus))) { ListItem item = new ListItem(StringHelper.SpaceName(s.ToString()), ((int)s).ToString()); if (s == _Payment.PaymentStatus) { item.Selected = true; } CurrentPaymentStatus.Items.Add(item); } } else { ListItem item = new ListItem(StringHelper.SpaceName(PaymentStatus.Unprocessed.ToString()), ((int)PaymentStatus.Unprocessed).ToString()); if (PaymentStatus.Unprocessed == _Payment.PaymentStatus) { item.Selected = true; } CurrentPaymentStatus.Items.Add(item); item = new ListItem(StringHelper.SpaceName(PaymentStatus.Completed.ToString()), ((int)PaymentStatus.Completed).ToString()); if (PaymentStatus.Completed == _Payment.PaymentStatus) { item.Selected = true; } CurrentPaymentStatus.Items.Add(item); item = new ListItem(StringHelper.SpaceName(PaymentStatus.Void.ToString()), ((int)PaymentStatus.Void).ToString()); if (PaymentStatus.Void == _Payment.PaymentStatus) { item.Selected = true; } CurrentPaymentStatus.Items.Add(item); } PaymentDate.Text = string.Format("{0:g}", _Payment.PaymentDate); Amount.Text = string.Format("{0:F2}", _Payment.Amount); PaymentMethod.Text = _Payment.PaymentMethodName; Caption.Text = string.Format(Caption.Text, _Payment.PaymentMethodName, _Payment.ReferenceNumber); } }
protected bool IsMethodAssigned(object dataItem) { // DO NOT CHECK ANY PAYMENT ALREADY ASSIGNED TO A GATEWAY PaymentMethod method = (PaymentMethod)dataItem; if (method.Id != 0) { return(false); } // DEFAULT CHECKED FOR UNASSIGNED CREDIT CARD METHODS if (method.IsCreditOrDebitCard()) { return(true); } // DEFAULT CHECKED FOR PAYPAL IF THIS IS PAYPAL GATEWAY if (method.PaymentInstrumentType == PaymentInstrumentType.PayPal) { bool isPayPalGateway = (_ProviderInstance is CommerceBuilder.Payments.Providers.PayPal.PayPalProvider); return(isPayPalGateway); } return(false); }