Beispiel #1
0
        private void BtnEditClick(object sender, EventArgs e)
        {
            var selectedVal = _lbCurrencies.SelectedValue;

            if (!string.IsNullOrEmpty(selectedVal))
            {
                var cc = new CurrencyCode(selectedVal);
                _txtPriceIndex.Text = cc.PriceIndex.ToString();
                _dlCurrencies.Items.Cast <ListItem>().ToList().ForEach(li => li.Selected = false);
                _dlCurrencies.Items.FindByValue(cc.Code).Selected = true;
            }
        }
Beispiel #2
0
        private void BtnAddClick(object sender, EventArgs e)
        {
            var currencyCode = _dlCurrencies.SelectedItem.Value;
            var priceIndex   = _txtPriceIndex.Text;
            var currency     = new CurrencyCode(currencyCode, priceIndex);

            var existing = _lbCurrencies.Items.Cast <ListItem>().FirstOrDefault(li => li.Value.StartsWith(currencyCode));

            if (existing != null)
            {
                _lbCurrencies.Items.Remove(existing);
            }

            _lbCurrencies.Items.Add(currency.ToListItem());

            SortItems();
            Save();
        }