public static void PopulateCreditCardTypes(CreditCardTypeProvider creditCardTypeProvider, DropDownList dropdown, bool addEmptyOption = false) { dropdown.DataSource = creditCardTypeProvider.GetAll(); dropdown.DataTextField = "Description"; dropdown.DataValueField = "ID"; dropdown.DataBind(); if (addEmptyOption) { dropdown.Items.Insert(0, String.Empty); } }
public static void PopulateCreditCardTypes(DropDownList dropdown, bool addEmptyOption = false) { CreditCardTypeProvider provider = UnityContainerHelper.Container.Resolve <CreditCardTypeProvider>(); dropdown.DataSource = provider.GetAll(); dropdown.DataTextField = "Description"; dropdown.DataValueField = "ID"; dropdown.DataBind(); if (addEmptyOption) { dropdown.Items.Insert(0, String.Empty); } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { ddlCreditCardType.DataSource = creditCardTypeProvider.GetAll(); ddlCreditCardType.DataTextField = "Description"; ddlCreditCardType.DataValueField = "ID"; ddlCreditCardType.DataBind(); ddlBank.DataSource = bankProvider.GetActiveBanks(); ddlBank.DataTextField = "Name"; ddlBank.DataValueField = "ID"; ddlBank.DataBind(); ddlBank.Items.Insert(0, String.Empty); var cust = customerProvider.Get(Request["barcode"]); lblCustomer.Text = String.Format("{0} - {1} {2}", cust.Barcode, cust.FirstName.Trim(), cust.LastName.Trim()); } }
public CascadingDropDownNameValue[] GetCreditCardTypesByPaymentType (string knownCategoryValues, string category) { StringDictionary categoryValues = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues); int paymentTypeID = Convert.ToInt32(categoryValues["PaymentType"]); CreditCardTypeProvider creditCardTypeProvider = UnityContainerHelper.Container.Resolve <CreditCardTypeProvider>(); List <CascadingDropDownNameValue> list = new List <CascadingDropDownNameValue>(); if (paymentTypeID == 4) //Credit Card { foreach (var item in creditCardTypeProvider.GetAll()) { list.Add( new CascadingDropDownNameValue( item.Description, item.ID.ToString())); } } return(list.ToArray()); }