/// <summary> /// Binds the payment options. /// </summary> private void BindPaymentOptions() { if (_order != null && _order.OrderForms.Count > 0) { PaymentOptionList.DataSource = GetPaymentOptionDataSource(); PaymentOptionList.DataBind(); } }
/// <summary> /// Binds the payment options. /// </summary> private void BindPaymentOptions() { //if (!this.IsPostBack) { if (_PaymentOptions == null) { _PaymentOptions = PaymentManager.GetPaymentMethods(CMSContext.Current.LanguageName); } PaymentOptionList.DataSource = _PaymentOptions; PaymentOptionList.DataBind(); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); //Get active payments, order by ordering (escending) var payments = PaymentManager.GetPaymentMethods("en").PaymentMethod.AsQueryable().Where(c => c.IsActive); var paymentList = new List <PaymentMethod>(); var defaultPayment = payments.OrderByDescending(c => c.Ordering).FirstOrDefault(c => c.IsDefault); if (defaultPayment == null) { defaultPayment = payments.OrderByDescending(c => c.Ordering).FirstOrDefault(); } if (defaultPayment == null) { ErrorManager.GenerateError("No payment method available."); return; } foreach (var paymentRow in payments) { var paymentMethod = new PaymentMethod(paymentRow); var marketId = _currentMarketService.GetCurrentMarket().MarketId; if (!paymentMethod.MarketId.Contains(marketId)) { continue; } paymentList.Add(paymentMethod); string controlId; if (defaultPayment.PaymentMethodId == paymentMethod.PaymentMethodId) { controlId = BindPaymentControls(paymentMethod, true); ActiveControlId = controlId; } else { controlId = BindPaymentControls(paymentMethod, false); } _paymentDictionary.Add(paymentMethod, controlId); } PaymentOptionList.DataSource = paymentList; PaymentOptionList.DataBind(); }
/// <summary> /// Called when [need rebind]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="oArgs">The <see cref="System.EventArgs"/> instance containing the event data.</param> public void OnNeedRebind(object sender, System.EventArgs oArgs) { PaymentOptionList.DataBind(); }